﻿---
title: Applies switch
description: 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...
url: https://www.elastic.co/elastic/docs-builder/docs/3272/reference/docs-builder/syntax/applies-switch
products:
  - Elastic Docs Builder
---

# 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.

## Basic usage

<tab-set>
  <tab-item title="Output">
    <applies-switch>
      <applies-item title="stack: ga 9.0+" applies-to="Elastic Stack: Generally available since 9.0">
        Content for Stack
      </applies-item>

      <applies-item title="serverless: ga" applies-to="Elastic Cloud Serverless: Generally available">
        Content for Serverless
      </applies-item>
    </applies-switch>
  </tab-item>

  <tab-item title="Markdown">
    ```markdown
    ::::{applies-switch}

    :::{applies-item} stack: ga 9.0+
    Content for Stack
    :::

    :::{applies-item} serverless: ga
    Content for Serverless
    :::

    ::::
    ```
  </tab-item>
</tab-set>


## Multiple `applies_to` definitions

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.
<tab-set>
  <tab-item title="Output">
    <applies-switch>
      <applies-item title="{ ece: ga 4.0+, ess: ga }" applies-to="Elastic Cloud Hosted: Generally available, Elastic Cloud Enterprise: Generally available since 4.0">
        Content for ECE and ECH
      </applies-item>

      <applies-item title="serverless: ga" applies-to="Elastic Cloud Serverless: Generally available">
        Content for Serverless
      </applies-item>
    </applies-switch>
  </tab-item>

  <tab-item title="Markdown">
    ```markdown
    ::::{applies-switch}

    :::{applies-item} { ece: ga 4.0+, ess: ga }
    Content for ECE and ECH
    :::

    :::{applies-item} serverless: ga
    Content for Serverless
    :::

    ::::
    ```
  </tab-item>
</tab-set>


## Automatic grouping

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: ga 9.1+`, `{ "stack": "ga 9.1+" }`, and `{ stack: "ga 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.
<tab-set>
  <tab-item title="Output">
    <applies-switch>
      <applies-item title="{ "stack": "ga 9.1+" }" applies-to="Elastic Stack: Generally available since 9.1">
        Content for versions 9.1 and newer
      </applies-item>

      <applies-item title="{ "stack": "preview =9.0" }" applies-to="Elastic Stack: Preview in 9.0">
        Content for version 9.0
      </applies-item>
    </applies-switch>

    <applies-switch>
      <applies-item title="stack: ga 9.1+" applies-to="Elastic Stack: Generally available since 9.1">
        Other content for versions 9.1 and newer
      </applies-item>

      <applies-item title="stack: preview =9.0" applies-to="Elastic Stack: Preview in 9.0">
        Other content for version 9.0
      </applies-item>
    </applies-switch>
  </tab-item>

  <tab-item title="Markdown">
    ```markdown
    ::::{applies-switch}
    :::{applies-item} { "stack": "ga 9.1+" }
    Content for versions 9.1 and newer
    :::
    :::{applies-item} { "stack": "preview =9.0" }
    Content for version 9.0
    :::
    ::::

    ::::{applies-switch}
    :::{applies-item} stack: ga 9.1+
    Other content for versions 9.1 and newer
    :::
    :::{applies-item} stack: preview =9.0
    Other content for version 9.0
    :::
    ::::
    ```
  </tab-item>
</tab-set>


## Supported `applies_to` definitions

The `applies-item` directive accepts any valid applies_to definition that would work with the `{applies_to}` role.
See the [Applies to](https://www.elastic.co/elastic/docs-builder/docs/3272/reference/docs-builder/syntax/applies) page for more details on valid `applies_to` definitions.

## When to use

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