oneslash-design-system 2.20.0 → 2.22.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.
Files changed (167) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +34 -1
  3. package/dist/cases/about-page/profile.d.ts +1 -0
  4. package/dist/cases/about-page/profile.jsx +64 -0
  5. package/dist/cases/about-page.md +114 -0
  6. package/dist/cases/admin-inbox/list.d.ts +1 -0
  7. package/dist/cases/admin-inbox/list.jsx +104 -0
  8. package/dist/cases/admin-inbox/split.d.ts +1 -0
  9. package/dist/cases/admin-inbox/split.jsx +68 -0
  10. package/dist/cases/admin-inbox.md +254 -0
  11. package/dist/cases/api-keys.md +1 -1
  12. package/dist/cases/app-shell/top-tabs.jsx +10 -4
  13. package/dist/cases/app-shell.md +13 -5
  14. package/dist/cases/blog-index/cards.d.ts +1 -0
  15. package/dist/cases/blog-index/cards.jsx +45 -0
  16. package/dist/cases/blog-index/list.d.ts +1 -0
  17. package/dist/cases/blog-index/list.jsx +46 -0
  18. package/dist/cases/blog-index.md +160 -0
  19. package/dist/cases/changelog/by-month.d.ts +1 -0
  20. package/dist/cases/changelog/by-month.jsx +70 -0
  21. package/dist/cases/changelog/one-page.d.ts +1 -0
  22. package/dist/cases/changelog/one-page.jsx +70 -0
  23. package/dist/cases/changelog.md +200 -0
  24. package/dist/cases/code-sample/block.d.ts +1 -0
  25. package/dist/cases/code-sample/block.jsx +19 -0
  26. package/dist/cases/code-sample/command.d.ts +1 -0
  27. package/dist/cases/code-sample/command.jsx +17 -0
  28. package/dist/cases/code-sample.md +96 -0
  29. package/dist/cases/contact-page/form.d.ts +1 -0
  30. package/dist/cases/contact-page/form.jsx +83 -0
  31. package/dist/cases/contact-page/links.d.ts +1 -0
  32. package/dist/cases/contact-page/links.jsx +19 -0
  33. package/dist/cases/contact-page.md +142 -0
  34. package/dist/cases/docs-component-page/reference.d.ts +1 -0
  35. package/dist/cases/docs-component-page/reference.jsx +93 -0
  36. package/dist/cases/docs-component-page.md +144 -0
  37. package/dist/cases/faq/accordion.d.ts +1 -0
  38. package/dist/cases/faq/accordion.jsx +25 -0
  39. package/dist/cases/faq/open-list.d.ts +1 -0
  40. package/dist/cases/faq/open-list.jsx +27 -0
  41. package/dist/cases/faq.md +110 -0
  42. package/dist/cases/feature-grid/cards.d.ts +1 -0
  43. package/dist/cases/feature-grid/cards.jsx +33 -0
  44. package/dist/cases/feature-grid/rows.d.ts +1 -0
  45. package/dist/cases/feature-grid/rows.jsx +30 -0
  46. package/dist/cases/feature-grid.md +132 -0
  47. package/dist/cases/image-viewer/gallery.d.ts +1 -0
  48. package/dist/cases/image-viewer/gallery.jsx +32 -0
  49. package/dist/cases/image-viewer/single.d.ts +1 -0
  50. package/dist/cases/image-viewer/single.jsx +25 -0
  51. package/dist/cases/image-viewer.md +123 -0
  52. package/dist/cases/landing-hero/centered.d.ts +1 -0
  53. package/dist/cases/landing-hero/centered.jsx +22 -0
  54. package/dist/cases/landing-hero/split.d.ts +1 -0
  55. package/dist/cases/landing-hero/split.jsx +30 -0
  56. package/dist/cases/landing-hero.md +114 -0
  57. package/dist/cases/legal-page/sections.d.ts +1 -0
  58. package/dist/cases/legal-page/sections.jsx +61 -0
  59. package/dist/cases/legal-page.md +96 -0
  60. package/dist/cases/long-form-page/article.d.ts +1 -0
  61. package/dist/cases/long-form-page/article.jsx +58 -0
  62. package/dist/cases/long-form-page/with-contents.d.ts +1 -0
  63. package/dist/cases/long-form-page/with-contents.jsx +41 -0
  64. package/dist/cases/long-form-page.md +170 -0
  65. package/dist/cases/message-actions/hover-toolbar.jsx +11 -8
  66. package/dist/cases/message-actions/menu.jsx +10 -7
  67. package/dist/cases/message-actions.md +19 -13
  68. package/dist/cases/message-attachments/in-composer.jsx +2 -2
  69. package/dist/cases/message-attachments/in-message.jsx +16 -11
  70. package/dist/cases/message-attachments.md +29 -17
  71. package/dist/cases/one-main-action.md +33 -0
  72. package/dist/cases/overflow-menu/in-a-header.jsx +9 -6
  73. package/dist/cases/overflow-menu/on-a-row.jsx +9 -6
  74. package/dist/cases/overflow-menu.md +16 -10
  75. package/dist/cases/page-end/cta-band.d.ts +1 -0
  76. package/dist/cases/page-end/cta-band.jsx +24 -0
  77. package/dist/cases/page-end/next-link.d.ts +1 -0
  78. package/dist/cases/page-end/next-link.jsx +18 -0
  79. package/dist/cases/page-end.md +88 -0
  80. package/dist/cases/password-gate/inline.d.ts +1 -0
  81. package/dist/cases/password-gate/inline.jsx +94 -0
  82. package/dist/cases/password-gate/modal.d.ts +1 -0
  83. package/dist/cases/password-gate/modal.jsx +81 -0
  84. package/dist/cases/password-gate/page.d.ts +1 -0
  85. package/dist/cases/password-gate/page.jsx +82 -0
  86. package/dist/cases/password-gate.md +351 -0
  87. package/dist/cases/pricing-section/cards.d.ts +1 -0
  88. package/dist/cases/pricing-section/cards.jsx +41 -0
  89. package/dist/cases/pricing-section.md +87 -0
  90. package/dist/cases/product-cards/grid.d.ts +1 -0
  91. package/dist/cases/product-cards/grid.jsx +20 -0
  92. package/dist/cases/product-cards.md +71 -0
  93. package/dist/cases/reply-feedback/thumbs.jsx +11 -8
  94. package/dist/cases/reply-feedback/with-reason.jsx +11 -8
  95. package/dist/cases/reply-feedback.md +20 -14
  96. package/dist/cases/section-index/cards.d.ts +1 -0
  97. package/dist/cases/section-index/cards.jsx +25 -0
  98. package/dist/cases/section-index/list.d.ts +1 -0
  99. package/dist/cases/section-index/list.jsx +56 -0
  100. package/dist/cases/section-index.md +140 -0
  101. package/dist/cases/settings-page/top-tabs.jsx +9 -6
  102. package/dist/cases/settings-page.md +13 -7
  103. package/dist/cases/site-header.md +1 -1
  104. package/dist/cases/site-search/dialog.d.ts +1 -0
  105. package/dist/cases/site-search/dialog.jsx +131 -0
  106. package/dist/cases/site-search.md +176 -0
  107. package/dist/cases/tabbed-panels/tabs.d.ts +1 -0
  108. package/dist/cases/tabbed-panels/tabs.jsx +40 -0
  109. package/dist/cases/tabbed-panels.md +81 -0
  110. package/dist/cases.json +1177 -31
  111. package/dist/components/accordion.d.ts +31 -0
  112. package/dist/components/accordion.jsx +103 -0
  113. package/dist/components/button.d.ts +2 -0
  114. package/dist/components/button.jsx +2 -2
  115. package/dist/components/codeBlock.d.ts +26 -0
  116. package/dist/components/codeBlock.jsx +101 -0
  117. package/dist/components/lightbox.d.ts +34 -0
  118. package/dist/components/lightbox.jsx +206 -0
  119. package/dist/components/linkCard.d.ts +10 -1
  120. package/dist/components/linkCard.jsx +32 -6
  121. package/dist/components/menuItem.jsx +1 -1
  122. package/dist/components/modal.d.ts +10 -2
  123. package/dist/components/modal.jsx +17 -12
  124. package/dist/components/pageHeader.jsx +1 -1
  125. package/dist/components/searchDialog.d.ts +44 -0
  126. package/dist/components/searchDialog.jsx +152 -0
  127. package/dist/components/siteHeader.d.ts +13 -2
  128. package/dist/components/siteHeader.jsx +21 -12
  129. package/dist/components/tab.d.ts +5 -1
  130. package/dist/components/tab.jsx +2 -2
  131. package/dist/components/tabPanel.d.ts +16 -0
  132. package/dist/components/tabPanel.jsx +12 -0
  133. package/dist/components/tabsContainer.d.ts +5 -1
  134. package/dist/components/tabsContainer.jsx +2 -2
  135. package/dist/components/tag.d.ts +6 -1
  136. package/dist/components/tag.jsx +10 -5
  137. package/dist/index.d.ts +5 -0
  138. package/dist/index.js +5 -0
  139. package/dist/internal/accordion.d.ts +4 -0
  140. package/dist/internal/accordion.js +53 -0
  141. package/dist/internal/combobox.d.ts +20 -0
  142. package/dist/internal/combobox.js +28 -0
  143. package/dist/internal/highlight.d.ts +5 -0
  144. package/dist/internal/highlight.js +18 -0
  145. package/dist/native-mapping.json +31 -1
  146. package/dist/stories/Accordion.stories.d.ts +11 -0
  147. package/dist/stories/Accordion.stories.jsx +93 -0
  148. package/dist/stories/Button.stories.jsx +12 -8
  149. package/dist/stories/Cases.generated.stories.d.ts +34 -0
  150. package/dist/stories/Cases.generated.stories.jsx +68 -0
  151. package/dist/stories/CodeBlock.stories.d.ts +12 -0
  152. package/dist/stories/CodeBlock.stories.jsx +65 -0
  153. package/dist/stories/Lightbox.stories.d.ts +11 -0
  154. package/dist/stories/Lightbox.stories.jsx +83 -0
  155. package/dist/stories/LinkCard.stories.d.ts +6 -0
  156. package/dist/stories/LinkCard.stories.jsx +17 -0
  157. package/dist/stories/MenuItem.stories.d.ts +1 -0
  158. package/dist/stories/MenuItem.stories.jsx +8 -0
  159. package/dist/stories/PageHeader.stories.d.ts +2 -0
  160. package/dist/stories/PageHeader.stories.jsx +13 -0
  161. package/dist/stories/SearchDialog.stories.d.ts +17 -0
  162. package/dist/stories/SearchDialog.stories.jsx +111 -0
  163. package/dist/stories/SiteHeader.stories.d.ts +4 -0
  164. package/dist/stories/SiteHeader.stories.jsx +89 -0
  165. package/dist/stories/TabPanel.stories.d.ts +7 -0
  166. package/dist/stories/TabPanel.stories.jsx +31 -0
  167. package/package.json +1 -1
@@ -0,0 +1,176 @@
1
+ # Site search
2
+
3
+ A site has many pages, and a person wants to reach one by its name or by a word in it, from any page.
4
+
5
+ ## Do
6
+
7
+ - Put a 'Search' `Button` with `decoIcon="Search"` in the `SiteHeader`, in `phoneAction`, so it stays in the bar at every width. Give it `aria-haspopup="dialog"` and `aria-keyshortcuts="Meta+K Control+K"`.
8
+ - Put Search before 'Sign Up' in `phoneAction` on a site with a main action, as an `IconButton` named 'Search', so both fit on a phone.
9
+ - Open the same dialog with Cmd+K, or Ctrl+K on Windows, using `useHotkey('k', …)`. The shortcut does nothing while a person types in a field. Say it on the page in words, as the case 'Quick switcher' does.
10
+ - Use `SearchDialog`. Keep the query and the results in your page and pass them in with `status`. Focus stays in the field; the arrow keys move the highlight, Enter follows the highlighted link and Escape closes it.
11
+ - Group the results under names such as 'Components' and 'Cases', and give each a `secondLabel` that says where it is and an `excerpt` of the text around the match. The words typed are marked in the title and the excerpt, as written, so 'c++ (beta)' is not read as a pattern.
12
+ - Set `status` to 'loading' when you ask and 'done' when the answer comes. After 300 ms the dialog says 'Searching' once and keeps the old results, marked `aria-busy`. A search that is faster than that shows no flash.
13
+ - Number each request and drop a reply for an older query. Keep timers in a ref and clear them on unmount.
14
+ - Show `recent` places before anything is typed, at most six, newest first.
15
+ - Let the dialog say what was searched when nothing matches, with 'Clear Search' that puts focus back in the field, as the case 'Empty search' says. Set `status` to 'error' when the request fails: it says 'Search is not working right now.' with 'Try Again'; pass `onRetry`.
16
+ - Use the case 'Quick switcher' instead inside an app, with workspaces, channels and people.
17
+
18
+ ## Don't
19
+
20
+ - Do not put the Search Button in `actions`. On a phone it moves into the menu, which closes when it is chosen, so the dialog has no Button to give focus back to.
21
+ - Do not search on every key with no wait for the answer. Drop an answer that is out of date instead.
22
+ - Do not build the dialog, the list and the keys by hand. `SearchDialog` does the roles, the focus and the status.
23
+ - Do not write the match as a pattern. A person may type brackets or a plus sign.
24
+ - Do not show a spinner in place of the results. Keep the old results on screen while the new ones load.
25
+ - Do not close the dialog when 'Clear Search' is pressed. A person who cleared the words wants to search again.
26
+
27
+ ## Example: Search in a dialog
28
+
29
+ Uses: `Button`, `Heading`, `PageShell`, `Paragraph`, `SearchDialog`, `SiteHeader`, `Stack`, `useHotkey`
30
+
31
+ ```tsx
32
+ 'use client';
33
+ import { useEffect, useRef, useState } from 'react';
34
+ import SiteHeader from 'oneslash-design-system/components/siteHeader';
35
+ import SearchDialog, { type SearchGroup, type SearchResult } from 'oneslash-design-system/components/searchDialog';
36
+ import useHotkey from 'oneslash-design-system/components/useHotkey';
37
+ import Button from 'oneslash-design-system/components/button';
38
+ import PageShell from 'oneslash-design-system/components/pageShell';
39
+ import Heading from 'oneslash-design-system/components/heading';
40
+ import Paragraph from 'oneslash-design-system/components/paragraph';
41
+ import { Stack } from 'oneslash-design-system/components/layout';
42
+
43
+ type Entry = SearchResult & { group: 'Components' | 'Cases'; text: string };
44
+
45
+ // A real site asks its server, which has every page. These are the pages of a made-up docs site.
46
+ const entries: Entry[] = [
47
+ { id: 'button', group: 'Components', title: 'Button', secondLabel: 'Components', href: '#button', iconName: 'MousePointerClick', text: 'The control that starts an action, in four sizes.' },
48
+ { id: 'tag', group: 'Components', title: 'Tag', secondLabel: 'Components', href: '#tag', iconName: 'Tag', text: 'A short label for a state, such as Paid or Draft.' },
49
+ { id: 'tabs', group: 'Components', title: 'Tabs', secondLabel: 'Components', href: '#tabs', iconName: 'PanelTop', text: 'Switch between views of one thing on one page.' },
50
+ { id: 'table', group: 'Components', title: 'Table', secondLabel: 'Components', href: '#table', iconName: 'Table', text: 'Rows and columns that scroll inside their own region.' },
51
+ { id: 'accordion', group: 'Components', title: 'Accordion', secondLabel: 'Components', href: '#accordion', iconName: 'ChevronsUpDown', text: 'Headings that open a panel under them.' },
52
+ { id: 'faq', group: 'Cases', title: 'FAQ', secondLabel: 'Cases', href: '#faq', iconName: 'CircleHelp', text: 'Answer the questions a visitor asks before signing up.' },
53
+ { id: 'pricing', group: 'Cases', title: 'Pricing section', secondLabel: 'Cases', href: '#pricing', iconName: 'CreditCard', text: 'Show the plans side by side with one price each.' },
54
+ { id: 'login', group: 'Cases', title: 'Login page', secondLabel: 'Cases', href: '#login', iconName: 'LogIn', text: 'Let a person log in with an email or a provider.' },
55
+ { id: 'tabbed', group: 'Cases', title: 'Tabbed panels', secondLabel: 'Cases', href: '#tabbed', iconName: 'PanelTop', text: 'Four views of one thing, and a visitor reads one.' },
56
+ ];
57
+
58
+ const SEARCH_MS = 300;
59
+
60
+ // A stand-in for the request. A real site calls its server here and may fail.
61
+ function searchPages(query: string, keep: (t: ReturnType<typeof setTimeout>) => void): Promise<SearchGroup[]> {
62
+ return new Promise((resolve) => {
63
+ keep(setTimeout(() => {
64
+ const words = query.toLowerCase().split(/\s+/).filter(Boolean);
65
+ const found = entries.filter((e) => words.every((w) => `${e.title} ${e.text}`.toLowerCase().includes(w)));
66
+ const groups = (['Components', 'Cases'] as const)
67
+ .map((label) => ({ label, items: found.filter((e) => e.group === label).map(({ group, text, ...item }) => ({ ...item, excerpt: text })) }))
68
+ .filter((g) => g.items.length > 0);
69
+ resolve(groups);
70
+ }, SEARCH_MS));
71
+ });
72
+ }
73
+
74
+ // Visited pages, most recent first. A real site keeps them for the person.
75
+ const recent: SearchResult[] = entries.slice(0, 3).map(({ group, text, ...item }) => item);
76
+
77
+ export default function SiteSearchDialog() {
78
+ const [open, setOpen] = useState(false);
79
+ const [query, setQuery] = useState('');
80
+ const [groups, setGroups] = useState<SearchGroup[]>([]);
81
+ const [status, setStatus] = useState<'idle' | 'loading' | 'done' | 'error'>('idle');
82
+ // Each request has a number; only the newest one may answer.
83
+ const latest = useRef(0);
84
+ const timer = useRef<ReturnType<typeof setTimeout>>();
85
+ useEffect(() => () => clearTimeout(timer.current), []);
86
+
87
+ function run(next: string) {
88
+ const id = ++latest.current;
89
+ if (next.trim() === '') {
90
+ setStatus('idle');
91
+ setGroups([]);
92
+ return;
93
+ }
94
+ setStatus('loading');
95
+ // An older request's timer is cleared, so only one is ever pending and unmount clears it
96
+ searchPages(next, (t) => {
97
+ clearTimeout(timer.current);
98
+ timer.current = t;
99
+ })
100
+ .then((found) => {
101
+ // A reply for an older query is dropped
102
+ if (id !== latest.current) return;
103
+ setGroups(found);
104
+ setStatus('done');
105
+ })
106
+ .catch(() => {
107
+ if (id !== latest.current) return;
108
+ setStatus('error');
109
+ });
110
+ }
111
+
112
+ function change(next: string) {
113
+ setQuery(next);
114
+ run(next);
115
+ }
116
+
117
+ function show() {
118
+ setQuery('');
119
+ run('');
120
+ setOpen(true);
121
+ }
122
+
123
+ // Cmd+K, or Ctrl+K on Windows, from anywhere on the page except a text field
124
+ useHotkey('k', () => {
125
+ if (!open) show();
126
+ });
127
+
128
+ return (
129
+ <>
130
+ {/* The Search Button is the main action of the bar, so it stays beside the brand at every width. */}
131
+ <SiteHeader
132
+ brand={{ href: '#top', name: 'Acme' }}
133
+ links={[
134
+ { label: 'Guides', href: '#guides' },
135
+ { label: 'Components', href: '#components', current: true },
136
+ { label: 'Cases', href: '#cases' },
137
+ ]}
138
+ phoneAction={
139
+ <Button
140
+ size="medium"
141
+ type="secondary"
142
+ state="enabled"
143
+ label="Search"
144
+ decoIcon="Search"
145
+ aria-haspopup="dialog"
146
+ aria-keyshortcuts="Meta+K Control+K"
147
+ onClickButton={show}
148
+ />
149
+ }
150
+ mainId="site-search-main"
151
+ />
152
+ <PageShell id="site-search-main" tabIndex={-1}>
153
+ <Stack gap="large">
154
+ <Heading level={1} size="h5">Components</Heading>
155
+ <Paragraph tone="secondary" measure="none">Press Cmd+K, or Ctrl+K on Windows, to search every page.</Paragraph>
156
+ </Stack>
157
+ </PageShell>
158
+ <SearchDialog
159
+ isOpen={open}
160
+ onClose={() => setOpen(false)}
161
+ query={query}
162
+ onQueryChange={change}
163
+ groups={groups}
164
+ status={status}
165
+ onRetry={() => run(query)}
166
+ recent={recent}
167
+ placeholder="Search components and cases"
168
+ />
169
+ </>
170
+ );
171
+ }
172
+ ```
173
+
174
+ ## Native
175
+
176
+ On Apple use `searchable` on a `NavigationStack`, with `searchSuggestions` for recent places and `searchScopes` for the groups. On Android use a `SearchBar` with a `DockedSearchBar` or a full-screen search view.
@@ -0,0 +1 @@
1
+ export default function TabbedPanelsTabs(): import("react").JSX.Element;
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+ import { useState } from 'react';
3
+ import PageShell from '../../components/pageShell';
4
+ import SectionIntro from '../../components/sectionIntro';
5
+ import TabsContainer from '../../components/tabsContainer';
6
+ import Tab from '../../components/tab';
7
+ import TabPanel from '../../components/tabPanel';
8
+ import Heading from '../../components/heading';
9
+ import Paragraph from '../../components/paragraph';
10
+ import List from '../../components/list';
11
+ import { PageSection, Stack } from '../../components/layout';
12
+ // Four views of one thing, and a visitor reads one. The first is the one most visitors need.
13
+ var views = [
14
+ { id: 'channels', label: 'Channels', title: 'One place for each subject', line: 'A channel holds the talk about one team or project.', points: ['Everyone in a channel sees every message.', 'Pin the messages people need again.', 'Turn a message into a task when it needs an owner.'] },
15
+ { id: 'tasks', label: 'Tasks', title: 'A task and its talk together', line: 'A task keeps its owner, its status and its talk together.', points: ['Give a task one owner and one due date.', 'Reply in the task, not in the channel.', 'Close the task when the work is done.'] },
16
+ { id: 'notes', label: 'Notes', title: 'Notes the whole team can search', line: 'Write a decision once and find it later.', points: ['Link a note to the task it came from.', 'Search every note from one box.', 'Export a note to PDF on Pro and Business.'] },
17
+ { id: 'agent', label: 'Agent', title: 'Answers with their sources', line: 'Ask the agent a question in any channel or task.', points: ['It says which notes and messages it used.', 'It never reads a channel you are not in.', 'Each reply counts as one AI agent response.'] },
18
+ ];
19
+ export default function TabbedPanelsTabs() {
20
+ var _a = useState('channels'), selected = _a[0], setSelected = _a[1];
21
+ return (<PageShell>
22
+ <PageSection gap="xxlarge">
23
+ <SectionIntro id="how-it-works" name="How it works" statement="Four parts, each for one kind of work."/>
24
+ <Stack gap="xlarge">
25
+ {/* Title Case, one short word each. The tablist is named by the section's heading, and each Tab controls its panel. */}
26
+ <TabsContainer aria-labelledby="how-it-works">
27
+ {views.map(function (v) { return (<Tab key={v.id} id={"tabbed-panels-tab-".concat(v.id)} controls={"tabbed-panels-panel-".concat(v.id)} size="small" label={v.label} isSelected={v.id === selected} onClickTab={function () { return setSelected(v.id); }}/>); })}
28
+ </TabsContainer>
29
+ {/* Every panel is in the page. Only the selected one shows. */}
30
+ {views.map(function (v) { return (<TabPanel key={v.id} id={"tabbed-panels-panel-".concat(v.id)} labelledBy={"tabbed-panels-tab-".concat(v.id)} selected={v.id === selected}>
31
+ <Stack gap="medium">
32
+ <Heading level={3} size="h5">{v.title}</Heading>
33
+ <Paragraph tone="secondary" measure="none">{v.line}</Paragraph>
34
+ <List items={v.points} marker="dot"/>
35
+ </Stack>
36
+ </TabPanel>); })}
37
+ </Stack>
38
+ </PageSection>
39
+ </PageShell>);
40
+ }
@@ -0,0 +1,81 @@
1
+ # Tabbed panels
2
+
3
+ A page shows several views of one thing, and a visitor reads one of them at a time.
4
+
5
+ ## Do
6
+
7
+ - Put the section's name in `SectionIntro`, so the section has a level 2 heading. Give the panel's title a level 3 `Heading`.
8
+ - Use `TabsContainer` with one `Tab` for each view. Write each label in Title Case, as one short word, and use `size="small"` so four fit on a phone.
9
+ - Give each `Tab` an `id` and `controls`, and put each view in a `TabPanel` named by its Tab. Every panel is in the page; only the selected one shows. Name the tablist with `aria-labelledby` on `TabsContainer`.
10
+ - Keep the selected tab in state. Put the view most visitors need first.
11
+ - Keep two to five tabs, and four when you can: they fit on a phone. A fifth scrolls inside the row and the page does not.
12
+ - Give every panel the same shape: a title, a line and a short `List`, so the page does not jump when a visitor changes tab.
13
+ - Use stacked sections, each with its own level 2 heading, for more than five views or for views everyone must read.
14
+ - Use `SegmentedControl` instead when the choice changes a value, as the case 'Range switch' says.
15
+
16
+ ## Don't
17
+
18
+ - Do not hide something a visitor must read behind a tab.
19
+ - Do not use these tabs for a site's sections or an app's areas. Those are `Tab`s with `href`, as the cases 'Site header' and 'Settings page' say.
20
+ - Do not give a tab an icon or a long label. It will not fit on a phone.
21
+ - Do not change the tab on a timer.
22
+ - Do not nest tabs inside a panel.
23
+
24
+ ## Example: Tabs over one panel
25
+
26
+ Uses: `Heading`, `List`, `PageSection`, `PageShell`, `Paragraph`, `SectionIntro`, `Stack`, `Tab`, `TabPanel`, `TabsContainer`
27
+
28
+ ```tsx
29
+ 'use client';
30
+ import { useState } from 'react';
31
+ import PageShell from 'oneslash-design-system/components/pageShell';
32
+ import SectionIntro from 'oneslash-design-system/components/sectionIntro';
33
+ import TabsContainer from 'oneslash-design-system/components/tabsContainer';
34
+ import Tab from 'oneslash-design-system/components/tab';
35
+ import TabPanel from 'oneslash-design-system/components/tabPanel';
36
+ import Heading from 'oneslash-design-system/components/heading';
37
+ import Paragraph from 'oneslash-design-system/components/paragraph';
38
+ import List from 'oneslash-design-system/components/list';
39
+ import { PageSection, Stack } from 'oneslash-design-system/components/layout';
40
+
41
+ // Four views of one thing, and a visitor reads one. The first is the one most visitors need.
42
+ const views = [
43
+ { id: 'channels', label: 'Channels', title: 'One place for each subject', line: 'A channel holds the talk about one team or project.', points: ['Everyone in a channel sees every message.', 'Pin the messages people need again.', 'Turn a message into a task when it needs an owner.'] },
44
+ { id: 'tasks', label: 'Tasks', title: 'A task and its talk together', line: 'A task keeps its owner, its status and its talk together.', points: ['Give a task one owner and one due date.', 'Reply in the task, not in the channel.', 'Close the task when the work is done.'] },
45
+ { id: 'notes', label: 'Notes', title: 'Notes the whole team can search', line: 'Write a decision once and find it later.', points: ['Link a note to the task it came from.', 'Search every note from one box.', 'Export a note to PDF on Pro and Business.'] },
46
+ { id: 'agent', label: 'Agent', title: 'Answers with their sources', line: 'Ask the agent a question in any channel or task.', points: ['It says which notes and messages it used.', 'It never reads a channel you are not in.', 'Each reply counts as one AI agent response.'] },
47
+ ];
48
+
49
+ export default function TabbedPanelsTabs() {
50
+ const [selected, setSelected] = useState('channels');
51
+ return (
52
+ <PageShell>
53
+ <PageSection gap="xxlarge">
54
+ <SectionIntro id="how-it-works" name="How it works" statement="Four parts, each for one kind of work." />
55
+ <Stack gap="xlarge">
56
+ {/* Title Case, one short word each. The tablist is named by the section's heading, and each Tab controls its panel. */}
57
+ <TabsContainer aria-labelledby="how-it-works">
58
+ {views.map((v) => (
59
+ <Tab key={v.id} id={`tabbed-panels-tab-${v.id}`} controls={`tabbed-panels-panel-${v.id}`} size="small" label={v.label} isSelected={v.id === selected} onClickTab={() => setSelected(v.id)} />
60
+ ))}
61
+ </TabsContainer>
62
+ {/* Every panel is in the page. Only the selected one shows. */}
63
+ {views.map((v) => (
64
+ <TabPanel key={v.id} id={`tabbed-panels-panel-${v.id}`} labelledBy={`tabbed-panels-tab-${v.id}`} selected={v.id === selected}>
65
+ <Stack gap="medium">
66
+ <Heading level={3} size="h5">{v.title}</Heading>
67
+ <Paragraph tone="secondary" measure="none">{v.line}</Paragraph>
68
+ <List items={v.points} marker="dot" />
69
+ </Stack>
70
+ </TabPanel>
71
+ ))}
72
+ </Stack>
73
+ </PageSection>
74
+ </PageShell>
75
+ );
76
+ }
77
+ ```
78
+
79
+ ## Native
80
+
81
+ On Apple use a segmented `Picker` for two to five views, and a `TabView` only for the app's own areas. On Android use a `TabRow`.