@splunk/react-ui 5.7.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion.js +6 -6
- package/Box.js +83 -34
- package/CHANGELOG.md +34 -0
- package/CollapsiblePanel.js +11 -11
- package/ComboBox.js +31 -27
- package/ControlGroup.js +92 -91
- package/DefinitionList.js +9 -9
- package/Drawer.d.ts +2 -0
- package/Drawer.js +679 -0
- package/DualListbox.js +1 -1
- package/JSONTree.js +73 -72
- package/Link.js +2 -2
- package/MIGRATION.md +10 -0
- package/Menu.js +338 -240
- package/Modal.js +127 -109
- package/Multiselect.js +437 -351
- package/Paginator.js +14 -12
- package/Popover.js +4 -1
- package/README.md +11 -0
- package/RadioBar.js +1 -1
- package/Search.js +103 -88
- package/Select.js +42 -40
- package/SelectBase.js +374 -328
- package/SidePanel.js +346 -167
- package/SlidingPanels.js +11 -11
- package/StepBar.js +7 -7
- package/Switch.js +5 -5
- package/Text.js +24 -24
- package/TextArea.js +7 -7
- package/TransitionOpen.js +204 -185
- package/docs-llm/Accordion.md +267 -0
- package/docs-llm/Anchor Menu.md +115 -0
- package/docs-llm/Anchor.md +54 -0
- package/docs-llm/AnimationToggle.md +254 -0
- package/docs-llm/Avatar.md +298 -0
- package/docs-llm/Badge.md +212 -0
- package/docs-llm/Breadcrumbs.md +306 -0
- package/docs-llm/Button Group.md +53 -0
- package/docs-llm/Button.md +361 -0
- package/docs-llm/Card Layout.md +286 -0
- package/docs-llm/Card.md +619 -0
- package/docs-llm/Checkbox.md +218 -0
- package/docs-llm/Chip.md +291 -0
- package/docs-llm/Clickable.md +160 -0
- package/docs-llm/Code.md +292 -0
- package/docs-llm/Collapsible Panel.md +744 -0
- package/docs-llm/Color.md +253 -0
- package/docs-llm/Column Layout.md +391 -0
- package/docs-llm/Combo Box.md +540 -0
- package/docs-llm/Control Group.md +594 -0
- package/docs-llm/Date.md +270 -0
- package/docs-llm/Definition List.md +278 -0
- package/docs-llm/Divider.md +216 -0
- package/docs-llm/Drawer.md +414 -0
- package/docs-llm/Dropdown.md +472 -0
- package/docs-llm/Dual Listbox.md +325 -0
- package/docs-llm/File.md +653 -0
- package/docs-llm/Form Rows.md +374 -0
- package/docs-llm/Heading.md +179 -0
- package/docs-llm/Image.md +109 -0
- package/docs-llm/JSON Tree.md +260 -0
- package/docs-llm/Layer.md +74 -0
- package/docs-llm/Layout.md +50 -0
- package/docs-llm/Link.md +318 -0
- package/docs-llm/List.md +189 -0
- package/docs-llm/Markdown.md +179 -0
- package/docs-llm/Menu.md +735 -0
- package/docs-llm/Message Bar.md +236 -0
- package/docs-llm/Message.md +248 -0
- package/docs-llm/Modal.md +443 -0
- package/docs-llm/Monogram.md +159 -0
- package/docs-llm/Multiselect.md +937 -0
- package/docs-llm/Number.md +298 -0
- package/docs-llm/Paginator.md +395 -0
- package/docs-llm/Paragraph.md +148 -0
- package/docs-llm/Phone Number.md +254 -0
- package/docs-llm/Popover.md +166 -0
- package/docs-llm/Progress.md +141 -0
- package/docs-llm/Radio Bar.md +303 -0
- package/docs-llm/Radio List.md +350 -0
- package/docs-llm/Resize.md +362 -0
- package/docs-llm/Screen Reader Content.md +73 -0
- package/docs-llm/Scroll Container Context.md +155 -0
- package/docs-llm/Scroll.md +152 -0
- package/docs-llm/Search.md +381 -0
- package/docs-llm/Select.md +985 -0
- package/docs-llm/Side Panel.md +777 -0
- package/docs-llm/Slider.md +339 -0
- package/docs-llm/Sliding Panels.md +340 -0
- package/docs-llm/Split Button.md +295 -0
- package/docs-llm/Static Content.md +90 -0
- package/docs-llm/Step Bar.md +292 -0
- package/docs-llm/Switch.md +268 -0
- package/docs-llm/Tab Bar.md +439 -0
- package/docs-llm/Tab Layout.md +398 -0
- package/docs-llm/Table.md +2642 -0
- package/docs-llm/Text Area.md +253 -0
- package/docs-llm/Text.md +339 -0
- package/docs-llm/Tooltip.md +325 -0
- package/docs-llm/Transition Open.md +406 -0
- package/docs-llm/Tree.md +586 -0
- package/docs-llm/Typography.md +125 -0
- package/docs-llm/Wait Spinner.md +121 -0
- package/docs-llm/llms.txt +97 -0
- package/package.json +6 -5
- package/types/src/Box/Box.d.ts +2 -10
- package/types/src/Drawer/Body.d.ts +17 -0
- package/types/src/Drawer/Drawer.d.ts +114 -0
- package/types/src/Drawer/DrawerContext.d.ts +11 -0
- package/types/src/Drawer/Footer.d.ts +25 -0
- package/types/src/Drawer/Header.d.ts +41 -0
- package/types/src/Drawer/docs/examples/Basic.d.ts +6 -0
- package/types/src/Drawer/docs/examples/ContainerPosition.d.ts +7 -0
- package/types/src/Drawer/docs/examples/InitialFocus.d.ts +9 -0
- package/types/src/Drawer/docs/examples/InlinePosition.d.ts +7 -0
- package/types/src/Drawer/docs/examples/PagePosition.d.ts +7 -0
- package/types/src/Drawer/index.d.ts +2 -0
- package/types/src/JSONTree/JSONTree.d.ts +12 -5
- package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
- package/types/src/Menu/Item.d.ts +2 -1
- package/types/src/Menu/docs/examples/SelectableCheckbox.d.ts +7 -0
- package/types/src/Modal/Modal.d.ts +1 -2
- package/types/src/Select/Option.d.ts +6 -3
- package/types/src/Select/Select.d.ts +8 -5
- package/types/src/Select/docs/examples/Dimmed.d.ts +7 -0
- package/types/src/SelectBase/OptionBase.d.ts +6 -3
- package/types/src/SelectBase/SelectBase.d.ts +8 -3
- package/types/src/SidePanel/SidePanel.d.ts +43 -2
- package/types/src/SidePanel/docs/examples/DockLayout.d.ts +17 -0
- package/types/src/SidePanel/docs/examples/InitialFocus.d.ts +9 -0
- package/types/src/TransitionOpen/TransitionOpen.d.ts +29 -4
- package/types/src/useKeyPress/index.d.ts +9 -2
- package/types/src/useOnClickOutside/index.d.ts +2 -0
- package/types/src/useOnClickOutside/useOnClickOutside.d.ts +4 -0
- package/useKeyPress.js +23 -18
- package/useOnClickOutside.d.ts +2 -0
- package/useOnClickOutside.js +79 -0
- package/types/src/RadioList/docs/examples/Row.d.ts +0 -6
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# Tab Layout
|
|
2
|
+
|
|
3
|
+
## Examples
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Uncontrolled
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
import React from 'react';
|
|
10
|
+
|
|
11
|
+
import P from '@splunk/react-ui/Paragraph';
|
|
12
|
+
import TabLayout from '@splunk/react-ui/TabLayout';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
function Uncontrolled() {
|
|
16
|
+
return (
|
|
17
|
+
<TabLayout defaultActivePanelId="platform">
|
|
18
|
+
<TabLayout.Panel label="Platform" panelId="platform">
|
|
19
|
+
<P>
|
|
20
|
+
The extensible data platform powers unified security, full-stack observability
|
|
21
|
+
and limitless custom applications.
|
|
22
|
+
</P>
|
|
23
|
+
</TabLayout.Panel>
|
|
24
|
+
<TabLayout.Panel label="Security" panelId="security">
|
|
25
|
+
<P>
|
|
26
|
+
Protect your business and modernize your security operations with a
|
|
27
|
+
best-in-class data platform, advanced analytics and automated investigations and
|
|
28
|
+
response.
|
|
29
|
+
</P>
|
|
30
|
+
</TabLayout.Panel>
|
|
31
|
+
<TabLayout.Panel label="Observability" panelId="observability">
|
|
32
|
+
<P>
|
|
33
|
+
Solve problems in seconds with the only full-stack, analytics-powered and
|
|
34
|
+
OpenTelemetry-native observability solution.
|
|
35
|
+
</P>
|
|
36
|
+
</TabLayout.Panel>
|
|
37
|
+
</TabLayout>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default Uncontrolled;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Controlled
|
|
47
|
+
|
|
48
|
+
In this example, the open Panel is controlled by the parent component.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import React, { useState } from 'react';
|
|
52
|
+
|
|
53
|
+
import P from '@splunk/react-ui/Paragraph';
|
|
54
|
+
import TabLayout, { TabLayoutChangeHandler } from '@splunk/react-ui/TabLayout';
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
function Controlled() {
|
|
58
|
+
const [activePanelId, setActivePanelId] = useState<string | undefined>('platform');
|
|
59
|
+
|
|
60
|
+
const handleChange: TabLayoutChangeHandler = (e, { activePanelId: panelId }) => {
|
|
61
|
+
setActivePanelId(panelId);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<TabLayout activePanelId={activePanelId} onChange={handleChange}>
|
|
66
|
+
<TabLayout.Panel label="Platform" panelId="platform">
|
|
67
|
+
<P>
|
|
68
|
+
The extensible data platform powers unified security, full-stack observability
|
|
69
|
+
and limitless custom applications.
|
|
70
|
+
</P>
|
|
71
|
+
</TabLayout.Panel>
|
|
72
|
+
<TabLayout.Panel label="Security" panelId="security">
|
|
73
|
+
<P>
|
|
74
|
+
Protect your business and modernize your security operations with a
|
|
75
|
+
best-in-class data platform, advanced analytics and automated investigations and
|
|
76
|
+
response.
|
|
77
|
+
</P>
|
|
78
|
+
</TabLayout.Panel>
|
|
79
|
+
<TabLayout.Panel label="Observability" panelId="observability">
|
|
80
|
+
<P>
|
|
81
|
+
Solve problems in seconds with the only full-stack, analytics-powered and
|
|
82
|
+
OpenTelemetry-native observability solution.
|
|
83
|
+
</P>
|
|
84
|
+
</TabLayout.Panel>
|
|
85
|
+
</TabLayout>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default Controlled;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Auto activate
|
|
95
|
+
|
|
96
|
+
In this example, switching to a tab with the keyboard automatically activates it.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import React from 'react';
|
|
100
|
+
|
|
101
|
+
import P from '@splunk/react-ui/Paragraph';
|
|
102
|
+
import TabLayout from '@splunk/react-ui/TabLayout';
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
function AutoActivate() {
|
|
106
|
+
return (
|
|
107
|
+
<TabLayout autoActivate defaultActivePanelId="platform">
|
|
108
|
+
<TabLayout.Panel label="Platform" panelId="platform">
|
|
109
|
+
<P>
|
|
110
|
+
The extensible data platform powers unified security, full-stack observability
|
|
111
|
+
and limitless custom applications.
|
|
112
|
+
</P>
|
|
113
|
+
</TabLayout.Panel>
|
|
114
|
+
<TabLayout.Panel label="Security" panelId="security">
|
|
115
|
+
<P>
|
|
116
|
+
Protect your business and modernize your security operations with a
|
|
117
|
+
best-in-class data platform, advanced analytics and automated investigations and
|
|
118
|
+
response.
|
|
119
|
+
</P>
|
|
120
|
+
</TabLayout.Panel>
|
|
121
|
+
<TabLayout.Panel label="Observability" panelId="observability">
|
|
122
|
+
<P>
|
|
123
|
+
Solve problems in seconds with the only full-stack, analytics-powered and
|
|
124
|
+
OpenTelemetry-native observability solution.
|
|
125
|
+
</P>
|
|
126
|
+
</TabLayout.Panel>
|
|
127
|
+
</TabLayout>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default AutoActivate;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### Icons
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
import React from 'react';
|
|
140
|
+
|
|
141
|
+
import ChartBarIcon from '@splunk/react-icons/ChartBar';
|
|
142
|
+
import SearchIcon from '@splunk/react-icons/Magnifier';
|
|
143
|
+
import TableIcon from '@splunk/react-icons/Table';
|
|
144
|
+
import Heading from '@splunk/react-ui/Heading';
|
|
145
|
+
import Paragraph from '@splunk/react-ui/Paragraph';
|
|
146
|
+
import Prose from '@splunk/react-ui/Prose';
|
|
147
|
+
import TabLayout from '@splunk/react-ui/TabLayout';
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
function Icons() {
|
|
151
|
+
return (
|
|
152
|
+
<TabLayout defaultActivePanelId="search">
|
|
153
|
+
<TabLayout.Panel label="Search" panelId="search" icon={<SearchIcon />}>
|
|
154
|
+
<Prose>
|
|
155
|
+
<Heading level={4}>Search</Heading>
|
|
156
|
+
<Paragraph>
|
|
157
|
+
There are six broad types for all of the search commands: distributable
|
|
158
|
+
streaming, centralized streaming, transforming, generating, orchestrating
|
|
159
|
+
and dataset processing.
|
|
160
|
+
</Paragraph>
|
|
161
|
+
</Prose>
|
|
162
|
+
</TabLayout.Panel>
|
|
163
|
+
<TabLayout.Panel label="Statistics" panelId="statistics" icon={<TableIcon />}>
|
|
164
|
+
<Prose>
|
|
165
|
+
<Heading level={4}>Statistics</Heading>
|
|
166
|
+
<Paragraph>
|
|
167
|
+
You can use the statistical and charting functions with the chart, stats,
|
|
168
|
+
and timechart commands.
|
|
169
|
+
</Paragraph>
|
|
170
|
+
</Prose>
|
|
171
|
+
</TabLayout.Panel>
|
|
172
|
+
<TabLayout.Panel
|
|
173
|
+
label="Visualizations"
|
|
174
|
+
panelId="visualizations"
|
|
175
|
+
icon={<ChartBarIcon />}
|
|
176
|
+
>
|
|
177
|
+
<Prose>
|
|
178
|
+
<Heading level={4}>Visualizations</Heading>
|
|
179
|
+
<Paragraph>
|
|
180
|
+
There are many different types of visualizations available, including line
|
|
181
|
+
charts, area charts, and bar charts to name a few.
|
|
182
|
+
</Paragraph>
|
|
183
|
+
</Prose>
|
|
184
|
+
</TabLayout.Panel>
|
|
185
|
+
</TabLayout>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export default Icons;
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
### Vertical
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
import React from 'react';
|
|
198
|
+
|
|
199
|
+
import Heading from '@splunk/react-ui/Heading';
|
|
200
|
+
import Paragraph from '@splunk/react-ui/Paragraph';
|
|
201
|
+
import Prose from '@splunk/react-ui/Prose';
|
|
202
|
+
import TabLayout from '@splunk/react-ui/TabLayout';
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
function Vertical() {
|
|
206
|
+
return (
|
|
207
|
+
<TabLayout defaultActivePanelId="platform" layout="vertical">
|
|
208
|
+
<TabLayout.Panel label="Platform" panelId="platform">
|
|
209
|
+
<Prose>
|
|
210
|
+
<Heading level={4}>Platform</Heading>
|
|
211
|
+
<Paragraph>
|
|
212
|
+
The extensible data platform powers unified security, full-stack
|
|
213
|
+
observability and limitless custom applications.
|
|
214
|
+
</Paragraph>
|
|
215
|
+
</Prose>
|
|
216
|
+
</TabLayout.Panel>
|
|
217
|
+
<TabLayout.Panel label="Security" panelId="security">
|
|
218
|
+
<Prose>
|
|
219
|
+
<Heading level={4}>Security</Heading>
|
|
220
|
+
<Paragraph>
|
|
221
|
+
Protect your business and modernize your security operations with a
|
|
222
|
+
best-in-class data platform, advanced analytics and automated investigations
|
|
223
|
+
and response.
|
|
224
|
+
</Paragraph>
|
|
225
|
+
</Prose>
|
|
226
|
+
</TabLayout.Panel>
|
|
227
|
+
<TabLayout.Panel label="Observability" panelId="observability">
|
|
228
|
+
<Prose>
|
|
229
|
+
<Heading level={4}>Observability</Heading>
|
|
230
|
+
<Paragraph>
|
|
231
|
+
Solve problems in seconds with the only full-stack, analytics-powered and
|
|
232
|
+
OpenTelemetry-native observability solution.
|
|
233
|
+
</Paragraph>
|
|
234
|
+
</Prose>
|
|
235
|
+
</TabLayout.Panel>
|
|
236
|
+
</TabLayout>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export default Vertical;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
### Vertical Icons
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
import React from 'react';
|
|
249
|
+
|
|
250
|
+
import ChartBarIcon from '@splunk/react-icons/ChartBar';
|
|
251
|
+
import SearchIcon from '@splunk/react-icons/Magnifier';
|
|
252
|
+
import TableIcon from '@splunk/react-icons/Table';
|
|
253
|
+
import Heading from '@splunk/react-ui/Heading';
|
|
254
|
+
import Paragraph from '@splunk/react-ui/Paragraph';
|
|
255
|
+
import Prose from '@splunk/react-ui/Prose';
|
|
256
|
+
import TabLayout from '@splunk/react-ui/TabLayout';
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
function VerticalIcons() {
|
|
260
|
+
return (
|
|
261
|
+
<TabLayout defaultActivePanelId="search" layout="vertical">
|
|
262
|
+
<TabLayout.Panel label="Search" panelId="search" icon={<SearchIcon />}>
|
|
263
|
+
<Prose>
|
|
264
|
+
<Heading level={4}>Search</Heading>
|
|
265
|
+
<Paragraph>
|
|
266
|
+
There are six broad types for all of the search commands: distributable
|
|
267
|
+
streaming, centralized streaming, transforming, generating, orchestrating
|
|
268
|
+
and dataset processing.
|
|
269
|
+
</Paragraph>
|
|
270
|
+
</Prose>
|
|
271
|
+
</TabLayout.Panel>
|
|
272
|
+
<TabLayout.Panel label="Statistics" panelId="statistics" icon={<TableIcon />}>
|
|
273
|
+
<Prose>
|
|
274
|
+
<Heading level={4}>Statistics</Heading>
|
|
275
|
+
<Paragraph>
|
|
276
|
+
You can use the statistical and charting functions with the chart, stats,
|
|
277
|
+
and timechart commands.
|
|
278
|
+
</Paragraph>
|
|
279
|
+
</Prose>
|
|
280
|
+
</TabLayout.Panel>
|
|
281
|
+
<TabLayout.Panel
|
|
282
|
+
label="Visualizations"
|
|
283
|
+
panelId="visualizations"
|
|
284
|
+
icon={<ChartBarIcon />}
|
|
285
|
+
>
|
|
286
|
+
<Prose>
|
|
287
|
+
<Heading level={4}>Visualizations</Heading>
|
|
288
|
+
<Paragraph>
|
|
289
|
+
There are many different types of visualizations available, including line
|
|
290
|
+
charts, area charts, and bar charts to name a few.
|
|
291
|
+
</Paragraph>
|
|
292
|
+
</Prose>
|
|
293
|
+
</TabLayout.Panel>
|
|
294
|
+
</TabLayout>
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export default VerticalIcons;
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
## API
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
### TabLayout API
|
|
308
|
+
|
|
309
|
+
The `TabLayout` is a group of managed `Panels`. Only one panel can be open at a time.
|
|
310
|
+
`TabLayout` supports both the controlled and uncontrolled patterns.
|
|
311
|
+
|
|
312
|
+
#### Props
|
|
313
|
+
|
|
314
|
+
| Name | Type | Required | Default | Description |
|
|
315
|
+
|------|------|------|------|------|
|
|
316
|
+
| activePanelId | string | no | | The `panelId` of the `TabLayout.Panel` to activate. If set, an `onChange` callback is required. |
|
|
317
|
+
| autoActivate | boolean | no | | If `true`, tabs will trigger the `onChange` callback when they receive focus. |
|
|
318
|
+
| children | React.ReactNode | no | | Must be `TabLayout.Panel`. |
|
|
319
|
+
| defaultActivePanelId | string | no | | Sets the active panel on the initial render. It must match the `panelId` of one of the child `TabLayout.Panel`s. Only use `defaultActivePanelId` when using `TabLayout` as an uncontrolled component. |
|
|
320
|
+
| elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
|
|
321
|
+
| iconPosition | 'above' \| 'left' | no | | **DEPRECATED**: This prop is deprecated and will be removed in the next major version. Position of icon in `TabBar.Tab` if it has an icon. Defaults to "left". |
|
|
322
|
+
| layout | 'horizontal' \| 'vertical' | no | 'horizontal' | The layout direction for tabs. |
|
|
323
|
+
| maxTabWidth | number | no | | Max width of each `TabBar.Tab` in pixels. Leave blank for auto max width. |
|
|
324
|
+
| onChange | TabLayoutChangeHandler | no | | A callback that receives the event and data (`selectedPanelId`). If activePanelId is set, this callback is required. |
|
|
325
|
+
|
|
326
|
+
#### Types
|
|
327
|
+
|
|
328
|
+
| Name | Type | Description |
|
|
329
|
+
|------|------|------|
|
|
330
|
+
| TabLayoutChangeHandler | ( event: React.MouseEvent<HTMLButtonElement> \| React.FocusEvent<HTMLButtonElement>, data: { activePanelId?: string } ) => void | |
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
### TabLayout.Panel API
|
|
335
|
+
|
|
336
|
+
#### Props
|
|
337
|
+
|
|
338
|
+
| Name | Type | Required | Default | Description |
|
|
339
|
+
|------|------|------|------|------|
|
|
340
|
+
| children | React.ReactNode | no | | |
|
|
341
|
+
| count | number | no | | Inserts number in tab label. |
|
|
342
|
+
| disabled | boolean | no | false | Prevents user from clicking the tab. |
|
|
343
|
+
| elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
|
|
344
|
+
| icon | React.ReactNode | no | | See Icon documentation for more information. |
|
|
345
|
+
| inset | boolean | no | true | By default, adds padding to panel content. If set to false, renders panel content without padding. |
|
|
346
|
+
| label | React.ReactNode | no | | The text shown in the button. |
|
|
347
|
+
| panelId | string | yes | | A unique `id` for this panel and used by the `TabLayout` to keep track of the open panel. |
|
|
348
|
+
| tooltip | React.ReactNode | no | | Content to show in a tooltip when the user hovers over or focuses on the tab. Note: The tooltip will override the label for the Panel for screen readers. |
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
## Accessibility
|
|
355
|
+
|
|
356
|
+
> NOT suported by design system: tab list overflow, configurable (add, delete, reorder) tab lists
|
|
357
|
+
|
|
358
|
+
## Visual Design
|
|
359
|
+
- Color contrast ratio **MUST** be:
|
|
360
|
+
- >= 4.5:1 for normal text: 14 pt (typically 18.66px) and bold or larger [SC 1.4.3][1]
|
|
361
|
+
- >= 3:1 for large text: 18 pt (typically 24px) or larger [SC 1.4.3][1]
|
|
362
|
+
- >= 3:1 for tab bar against page background [SC 1.4.11][2]
|
|
363
|
+
- Focus State: if the focus ring has a radius of [SC 1.4.11][2]
|
|
364
|
+
- < 3px: >= 4.5.1 between button <> focus <> background
|
|
365
|
+
- > 3px: >= 3.1 button button <> focus <> background
|
|
366
|
+
- `alt=""` for decorative icons [SC 1.1.1][3]
|
|
367
|
+
|
|
368
|
+
## States
|
|
369
|
+
- Color contrast guidelines do not apply to disabled tabs
|
|
370
|
+
|
|
371
|
+
## Interaction Design
|
|
372
|
+
- **Define Manual vs. Automatic:** Designers **MUST** specify which interaction model they want in specs for engineering. By default, Splunk Design System uses manual tabs and supports automatic tabs.
|
|
373
|
+
- **Automatic activation:** When a user focuses on a tab, it automatically loads. This is recommended for static text and some images.
|
|
374
|
+
- **Manual activation:** A user must click the tab or use <kbd>Enter/Space</kbd> to load the content in tabs. This is recommended for dynamic content such as tables, visualizations, etc.
|
|
375
|
+
- Focus state does **SHOULD NOT** cover visual design elements that illustate which tab a user is on, or that the elements are not the same color as the selected bar.
|
|
376
|
+
- **MUST** have keyboard navigation [SC 2.1][4]:
|
|
377
|
+
- <kbd>Tab</kbd> and <kbd>Shift+Tab</kbd> to move into the tablist, focusing on active tab
|
|
378
|
+
|
|
379
|
+
- A second <kbd>Tab</kbd> and <kbd>Shift+Tab</kbd> moves to the next interactive element in the sequence
|
|
380
|
+
- If the design has a tablist that runs..
|
|
381
|
+
- Horizontally: <kbd>Left</kbd> and <kbd>Right Arrow</kbd> to circle thru tabs
|
|
382
|
+
- Vertically: <kbd>Up</kbd> and <kbd>Down Arrow</kbd> to circle thru tabs
|
|
383
|
+
- disabled tabs **MUST** be skipped in navigation
|
|
384
|
+
|
|
385
|
+
## Implementation
|
|
386
|
+
- Tabs **MUST** be implemented as a list so users receive correct information
|
|
387
|
+
- As a fallback mechanism, this allows tabs to gracefully degrade back to a list of content
|
|
388
|
+
- Tabs as part of a navigation bar **MUST** be implemented as links and use manual navigation
|
|
389
|
+
- If tabs use quantifier, this number **MUST** to be announced by screen reader
|
|
390
|
+
- Vertical tab bars **MUST** have `aria-orientation=vertical`
|
|
391
|
+
- Observe specifications for manual or automatic activation as prescribed by the interaction model section
|
|
392
|
+
|
|
393
|
+
[1]: https://www.w3.org/TR/WCAG21/#contrast-minimum
|
|
394
|
+
[2]: https://www.w3.org/TR/WCAG21/#non-text-contrast
|
|
395
|
+
[3]: https://www.w3.org/TR/WCAG21/#non-text-content
|
|
396
|
+
[4]: https://www.w3.org/TR/WCAG21/#keyboard-accessible
|
|
397
|
+
|
|
398
|
+
|