Applies switch
The applies-switch directive creates tabbed content where each tab displays an applies_to badge instead of a text title. This is useful for showing content that varies by deployment type, version, or other applicability criteria.
Content for Serverless
Content for Stack
::::{applies-switch}
:::{applies-item} stack:
Content for Stack
:::
:::{applies-item} serverless:
Content for Serverless
:::
::::
You can specify multiple applies_to definitions in a single applies-item using YAML object notation with curly braces {}.
This is useful when content applies to multiple deployment types or versions simultaneously.
Content for Serverless
Content for ECE and ECH
::::{applies-switch}
:::{applies-item} { ece:, ess: }
Content for ECE and ECH
:::
:::{applies-item} serverless:
Content for Serverless
:::
::::
Applies-switch tabs are automatically ordered according to documentation standards, regardless of how they appear in the source file. This ensures consistency across documentation.
The ordering rules are:
- Serverless appears first
- Stack versions appear second, ordered from latest to oldest
- Deployment types appear third, in this order:
- ECH/ESS (Elastic Cloud Hosted)
- ECE (Elastic Cloud Enterprise)
- ECK (Elastic Cloud on Kubernetes)
- Self-managed
- Items with unavailable lifecycle always appear last
Example:
Even if you write the tabs in a different order:
::::{applies-switch}
:::{applies-item} stack: ga 8.11
Old stack version
:::
:::{applies-item} serverless: ga
Serverless content
:::
:::{applies-item} stack: preview 9.1
New stack version
:::
::::
They will automatically render in the correct order: Serverless → Stack 9.1 → Stack 8.11
You don't need to manually order tabs anymore. Focus on content, and the system will handle the ordering for consistency.
All applies switches on a page automatically sync together. When you select an applies_to definition in one switch, all other switches will switch to the same applies_to definition.
The format of the applies_to definition doesn't matter - stack: preview 9.1, { "stack": "preview 9.1" }, and { stack: "preview 9.1" } all identify the same content and will sync together.
In the following example, both switch sets are automatically grouped and will stay in sync.
Content for 9.1 version
Content for 9.0 version
Other content for 9.1 version
Other content for 9.0 version
::::{applies-switch}
:::{applies-item} { "stack": "preview 9.0" }
Content for 9.0 version
:::
:::{applies-item} { "stack": "ga 9.1" }
Content for 9.1 version
:::
::::
::::{applies-switch}
:::{applies-item} stack: preview 9.0
Other content for 9.0 version
:::
:::{applies-item} stack: ga 9.1
Other content for 9.1 version
:::
::::
The applies-item directive accepts any valid applies_to definition that would work with the {applies_to} role.
See the Applies to page for more details on valid applies_to definitions.
Use applies switches when:
- Content varies significantly by deployment type, version, or other applicability criteria
- You want to show applies_to badges as tab titles instead of text
- You need to group related content that differs by applicability
- You want to provide a clear visual indication of what each content section applies to