You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: www/src/documentation/components/content/tabs.mdx
+41-65Lines changed: 41 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,81 +3,57 @@ title: Tabs
3
3
storybook: true
4
4
---
5
5
6
-
Tabs expects to receive a TabList with one or more Tab components. TabPanels expects TabPanel(s). Tabs manages the visibility of a single TabPanel based on its internal state.
6
+
`Tabs` expects to receive a `TabList` with one or more `Tab` components. `TabPanels` expects `TabPanel`(s). `Tabs` manages the visibility of a single `TabPanel` based on its internal state.
7
7
8
-
The order in which elements are placed inside TabList and TabPanels defines the relationship between them. The first Tab is related to the first TabPanel and so on.
8
+
The order in which elements are placed inside `TabList` and `TabPanels` defines the relationship between them. The first `Tab` is related to the first `TabPanel` and so on.
9
9
10
-
To create a disabled Tab add the disabled prop. You must still create a TabPanel for each Tab to keep the index positions in sync.
10
+
```jsx
11
+
<Tabs>
12
+
<TabList>
13
+
<Tab>Dog</Tab>
14
+
<Tab>Cat</Tab>
15
+
</TabList>
16
+
<TabPanels>
17
+
<TabPanel>🐶 Dog</TabPanel>
18
+
<TabPanel>🐱 Cat</TabPanel>
19
+
</TabPanels>
20
+
</Tabs>
21
+
```
22
+
23
+
## Horizonal Scroll
11
24
12
-
Tabs supports scrolling when the number of Tabs are greater then the space alocated for it. - Try scrolling left-right.
25
+
`Tabs` supports scrolling when the tabs' combined width cannot be accomdated within the viewport width. - Try scrolling left-right.
26
+
27
+
```jsx
28
+
<Tabs>
29
+
<TabList>
30
+
<Tab>Really long tab title that should help demonstrate side-scroll</Tab>
31
+
<Tab>Yet-another-tab-title to get things width enough</Tab>
32
+
<Tab>Really, you must be obsessed with these long tab titles?</Tab>
33
+
<Tab>Okay, okay, we get it you want to see scrolling in action...</Tab>
34
+
</TabList>
35
+
<TabPanels>
36
+
<TabPanel>Tab Content 1</TabPanel>
37
+
<TabPanel>Tab Content 2</TabPanel>
38
+
<TabPanel>Tab Content 3</TabPanel>
39
+
<TabPanel>Tab Content 4</TabPanel>
40
+
</TabPanels>
41
+
</Tabs>
42
+
```
43
+
44
+
## Disabled Tab(s)
45
+
46
+
To create a disabled Tab add the `disabled` prop. NOTE: A `TabPanel` must still exist for disabled tabs to allow for tabs to keep the index positions in sync.
0 commit comments