Skip to content

Commit 3cdb3a6

Browse files
committed
Simplify docs
1 parent ee1beb0 commit 3cdb3a6

File tree

1 file changed

+58
-101
lines changed

1 file changed

+58
-101
lines changed

docs/syntax/applies-switch.md

Lines changed: 58 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,120 @@
1-
# Applies Switch
1+
# Applies switch
22

33
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.
44

5-
## Basic Usage
5+
## Basic usage
66

7-
### Example
7+
::::::{tab-set}
8+
:::::{tab-item} Output
89

9-
#### Syntax
10-
11-
```markdown
12-
:::::{applies-switch}
10+
::::{applies-switch}
1311

14-
::::{applies-item} stack: preview 9.1
15-
:::{tip}
16-
This feature is in preview for Elastic Stack 9.1.
12+
:::{applies-item} stack:
13+
Content for Stack
1714
:::
18-
::::
1915

20-
::::{applies-item} ess: preview 9.1
21-
:::{note}
22-
This feature is available for Elastic Cloud.
16+
:::{applies-item} serverless:
17+
Content for Serverless
2318
:::
24-
::::
2519

26-
::::{applies-item} ece: removed
27-
:::{warning}
28-
This feature has been removed from Elastic Cloud Enterprise.
29-
:::
3020
::::
3121

3222
:::::
33-
```
34-
35-
#### Result
23+
:::::{tab-item} Markdown
3624

37-
:::::{applies-switch}
25+
```markdown
26+
::::{applies-switch}
3827

39-
::::{applies-item} stack: preview 9.1
40-
:::{tip}
41-
This feature is in preview for Elastic Stack 9.1.
28+
:::{applies-item} stack:
29+
Content for Stack
4230
:::
43-
::::
4431

45-
::::{applies-item} ess: preview 9.1
46-
:::{note}
47-
This feature is available for Elastic Cloud.
32+
:::{applies-item} serverless:
33+
Content for Serverless
4834
:::
49-
::::
5035

51-
::::{applies-item} ece: removed
52-
:::{warning}
53-
This feature has been removed from Elastic Cloud Enterprise.
54-
:::
5536
::::
56-
37+
```
5738
:::::
39+
::::::
5840

59-
## Automatic Grouping
60-
61-
Applies switches are automatically grouped together by default. This means all applies switches on a page will sync with each other - when you select a version in one switch, all other switches will automatically switch to the same version.
41+
## Multiple `applies_to` definitions
6242

63-
Items with the same applies_to definition will sync together across all switches on the page. For example, if you have `stack: preview 9.1` in multiple switches, selecting it in one will select it in all others.
64-
65-
### Example
66-
67-
In the following example we have two applies switch sets that are automatically grouped together.
68-
Hence, both switch sets will be in sync.
43+
You can specify multiple `applies_to` definitions in a single `applies-item` using YAML object notation with curly braces `{}`.
44+
This is useful when content applies to multiple deployment types or versions simultaneously.
6945

70-
#### Syntax
46+
::::::{tab-set}
47+
:::::{tab-item} Output
7148

72-
```markdown
7349
::::{applies-switch}
74-
:::{applies-item} stack: ga 8.11
75-
Content for GA version
50+
51+
:::{applies-item} { ece:, ess: }
52+
Content for ECE and ECH bla
7653
:::
7754

78-
:::{applies-item} stack: preview 9.1
79-
Content for preview version
55+
:::{applies-item} serverless:
56+
Content for Serverless
8057
:::
8158

8259
::::
8360

61+
:::::
62+
:::::{tab-item} Markdown
63+
64+
```markdown
8465
::::{applies-switch}
85-
:::{applies-item} stack: ga 8.11
86-
Other content for GA version
66+
67+
:::{applies-item} { ece:, ess: }
68+
Content for ECE and ECH bla
8769
:::
8870

89-
:::{applies-item} stack: preview 9.1
90-
Other content for preview version
71+
:::{applies-item} serverless:
72+
Content for Serverless
9173
:::
9274

9375
::::
9476
```
77+
:::::
78+
::::::
79+
80+
## Automatic grouping
9581

96-
#### Result
82+
Applies switches are automatically grouped together by default. This means all applies switches on a page will sync with each other - when you select a version in one switch, all other switches will automatically switch to the same version.
83+
84+
Items with the same applies_to definition will sync together across all switches on the page. For example, if you have `stack: preview 9.1` in multiple switches, selecting it in one will select it in all others.
9785

98-
##### Automatically Grouped Applies Switches
86+
In the following example we have two applies switch sets that are automatically grouped together.
87+
Hence, both switch sets will be in sync.
9988

10089
::::{applies-switch}
101-
:::{applies-item} stack: ga 8.11
102-
Content for GA version
90+
:::{applies-item} stack: ga 9.0
91+
Other content for 9.0 version
10392
:::
104-
105-
:::{applies-item} stack: preview 9.1
106-
Content for preview version
93+
:::{applies-item} stack: ga 9.1
94+
Other content for 9.1 version
10795
:::
108-
10996
::::
11097

11198
::::{applies-switch}
112-
:::{applies-item} stack: ga 8.11
113-
Other content for GA version
99+
:::{applies-item} stack: ga 9.0
100+
Other content for 9.0 version
114101
:::
115-
116-
:::{applies-item} stack: preview 9.1
117-
Other content for preview version
102+
:::{applies-item} stack: ga 9.1
103+
Other content for 9.1 version
118104
:::
119-
120105
::::
121106

122-
## Supported Applies To Definitions
107+
## Supported `applies_to` definitions
123108

124-
The `applies-item` directive accepts any valid applies_to definition that would work with the `{applies_to}` role. This includes:
109+
The `applies-item` directive accepts any valid applies_to definition that would work with the `{applies_to}` role.
125110

126-
- **Stack versions**: `stack: ga 8.11`, `stack: preview 9.1`
127-
- **Deployment types**: `ess: preview 9.1`, `ece: removed`, `eck: ga 8.11`
128-
- **Product versions**: `product: preview 9.1`
129-
- **Serverless projects**: `serverless: observability: preview 9.1`
111+
See the [](applies.md) page for more details on valid `applies_to` definitions.
130112

131-
## Best Practices
132-
133-
**DOs**<br>
134-
**Do:** Use clear, descriptive applies_to definitions<br>
135-
**Do:** Make sure all switch items have the same type of content and similar goals<br>
136-
**Do:** Keep switch content scannable and self-contained<br>
137-
**Do:** Include other block elements in switches, like [admonitions](admonitions.md)<br>
138-
**Do:** Use applies_to definitions that are meaningful to your users
139-
140-
**DON'Ts**<br>
141-
**Don't:** Nest applies switches<br>
142-
**Don't:** Split step-by-step procedures across switches<br>
143-
**Don't:** Use more than 6 switch items (use as few as possible)<br>
144-
**Don't:** Use applies switches in [dropdowns](dropdowns.md)<br>
145-
**Don't:** Use applies_to definitions that are too similar or confusing
146-
147-
## When to Use
113+
## When to use
148114

149115
Use applies switches when:
150116

151117
- Content varies significantly by deployment type, version, or other applicability criteria
152118
- You want to show applies_to badges as tab titles instead of text
153119
- You need to group related content that differs by applicability
154120
- You want to provide a clear visual indication of what each content section applies to
155-
156-
## Comparison with Regular Tabs
157-
158-
| Feature | Regular Tabs | Applies Switch |
159-
|---------|--------------|----------------|
160-
| Tab titles | Text labels | Applies_to badges |
161-
| Use case | General content organization | Content that varies by applicability |
162-
| Visual indication | Text | Badge with version/deployment info |
163-
| Best for | General content grouping | Version-specific or deployment-specific content |

0 commit comments

Comments
 (0)