@tempoxyz/ds 0.3.14 → 0.3.15
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/dist/docs/AGENTS.md +73 -10
- package/dist/docs/{marketing/introduction/getting-started.md → marketing.md} +28 -20
- package/dist/docs/product/components/actions.md +2058 -0
- package/dist/docs/product/components/blockchain.md +3825 -0
- package/dist/docs/product/components/data-display.md +5901 -0
- package/dist/docs/product/components/feedback-and-status.md +4008 -0
- package/dist/docs/product/components/forms-and-inputs.md +10543 -0
- package/dist/docs/product/components/layout.md +3339 -0
- package/dist/docs/product/components/navigation.md +2914 -0
- package/dist/docs/product/components/overlays.md +4917 -0
- package/dist/docs/product/components.md +125 -125
- package/dist/docs/product/foundations.md +4596 -0
- package/dist/docs/product/patterns.md +10129 -0
- package/package.json +1 -1
- package/dist/docs/index.md +0 -145
- package/dist/docs/product/components/accordion.md +0 -489
- package/dist/docs/product/components/address-card.md +0 -147
- package/dist/docs/product/components/agent-logo.md +0 -194
- package/dist/docs/product/components/alert-dialog.md +0 -631
- package/dist/docs/product/components/alert.md +0 -448
- package/dist/docs/product/components/amount-input.md +0 -305
- package/dist/docs/product/components/amount.md +0 -794
- package/dist/docs/product/components/app-shell.md +0 -559
- package/dist/docs/product/components/asset-chip.md +0 -294
- package/dist/docs/product/components/autocomplete.md +0 -620
- package/dist/docs/product/components/avatar.md +0 -321
- package/dist/docs/product/components/badge.md +0 -339
- package/dist/docs/product/components/badged-logo.md +0 -116
- package/dist/docs/product/components/banner.md +0 -379
- package/dist/docs/product/components/bar-chart.md +0 -208
- package/dist/docs/product/components/breadcrumbs.md +0 -380
- package/dist/docs/product/components/button-group.md +0 -286
- package/dist/docs/product/components/button.md +0 -650
- package/dist/docs/product/components/calendar.md +0 -375
- package/dist/docs/product/components/callout.md +0 -96
- package/dist/docs/product/components/checkbox-group.md +0 -521
- package/dist/docs/product/components/checkbox.md +0 -467
- package/dist/docs/product/components/choice-group.md +0 -516
- package/dist/docs/product/components/choicebox.md +0 -641
- package/dist/docs/product/components/code.md +0 -100
- package/dist/docs/product/components/combobox.md +0 -939
- package/dist/docs/product/components/container.md +0 -257
- package/dist/docs/product/components/copy-button.md +0 -642
- package/dist/docs/product/components/date-picker.md +0 -514
- package/dist/docs/product/components/dialog.md +0 -1332
- package/dist/docs/product/components/drawer.md +0 -966
- package/dist/docs/product/components/empty.md +0 -340
- package/dist/docs/product/components/field.md +0 -570
- package/dist/docs/product/components/fieldset.md +0 -398
- package/dist/docs/product/components/frame.md +0 -434
- package/dist/docs/product/components/gauge.md +0 -299
- package/dist/docs/product/components/get-started-visual.md +0 -117
- package/dist/docs/product/components/grid.md +0 -288
- package/dist/docs/product/components/hero-visual.md +0 -155
- package/dist/docs/product/components/hex.md +0 -487
- package/dist/docs/product/components/icon-tile.md +0 -292
- package/dist/docs/product/components/identicon.md +0 -371
- package/dist/docs/product/components/inline.md +0 -233
- package/dist/docs/product/components/inset.md +0 -225
- package/dist/docs/product/components/kbd.md +0 -423
- package/dist/docs/product/components/list-group.md +0 -981
- package/dist/docs/product/components/loading-dots.md +0 -237
- package/dist/docs/product/components/menu.md +0 -934
- package/dist/docs/product/components/native-select.md +0 -204
- package/dist/docs/product/components/network-logo.md +0 -248
- package/dist/docs/product/components/number-field.md +0 -543
- package/dist/docs/product/components/otp-field.md +0 -616
- package/dist/docs/product/components/pagination.md +0 -516
- package/dist/docs/product/components/popover.md +0 -544
- package/dist/docs/product/components/progress.md +0 -388
- package/dist/docs/product/components/qr.md +0 -314
- package/dist/docs/product/components/radio-group.md +0 -528
- package/dist/docs/product/components/secret-value.md +0 -406
- package/dist/docs/product/components/select.md +0 -751
- package/dist/docs/product/components/separator.md +0 -379
- package/dist/docs/product/components/sidebar-menu.md +0 -922
- package/dist/docs/product/components/skeleton.md +0 -517
- package/dist/docs/product/components/slider.md +0 -539
- package/dist/docs/product/components/snippet.md +0 -424
- package/dist/docs/product/components/spinner.md +0 -216
- package/dist/docs/product/components/split-bar.md +0 -139
- package/dist/docs/product/components/split-button.md +0 -464
- package/dist/docs/product/components/stack.md +0 -299
- package/dist/docs/product/components/status-chip.md +0 -226
- package/dist/docs/product/components/status-indicator.md +0 -119
- package/dist/docs/product/components/status-row.md +0 -174
- package/dist/docs/product/components/stepper.md +0 -451
- package/dist/docs/product/components/success-hero.md +0 -157
- package/dist/docs/product/components/surface.md +0 -639
- package/dist/docs/product/components/switch.md +0 -472
- package/dist/docs/product/components/table.md +0 -968
- package/dist/docs/product/components/tabs.md +0 -627
- package/dist/docs/product/components/tempo-logo.md +0 -185
- package/dist/docs/product/components/text-input.md +0 -624
- package/dist/docs/product/components/textarea.md +0 -352
- package/dist/docs/product/components/toast.md +0 -535
- package/dist/docs/product/components/token-logo.md +0 -371
- package/dist/docs/product/components/token.md +0 -247
- package/dist/docs/product/components/tooltip.md +0 -490
- package/dist/docs/product/components/verification-code.md +0 -116
- package/dist/docs/product/components/visual.md +0 -249
- package/dist/docs/product/foundations/accessibility.md +0 -377
- package/dist/docs/product/foundations/agents.md +0 -159
- package/dist/docs/product/foundations/color.md +0 -522
- package/dist/docs/product/foundations/content/tone.md +0 -194
- package/dist/docs/product/foundations/content/voice.md +0 -194
- package/dist/docs/product/foundations/content/writing-style.md +0 -406
- package/dist/docs/product/foundations/iconography.md +0 -282
- package/dist/docs/product/foundations/intent.md +0 -360
- package/dist/docs/product/foundations/layout.md +0 -508
- package/dist/docs/product/foundations/linter.md +0 -523
- package/dist/docs/product/foundations/motion.md +0 -151
- package/dist/docs/product/foundations/radius-and-padding.md +0 -86
- package/dist/docs/product/foundations/typography.md +0 -331
- package/dist/docs/product/introduction/faq.md +0 -133
- package/dist/docs/product/introduction/getting-started.md +0 -377
- package/dist/docs/product/patterns/blockchain-values.md +0 -709
- package/dist/docs/product/patterns/dashboards.md +0 -638
- package/dist/docs/product/patterns/destructive-actions.md +0 -626
- package/dist/docs/product/patterns/empty-states.md +0 -612
- package/dist/docs/product/patterns/errors-and-validation.md +0 -808
- package/dist/docs/product/patterns/feedback-and-status.md +0 -518
- package/dist/docs/product/patterns/forms.md +0 -679
- package/dist/docs/product/patterns/loading.md +0 -630
- package/dist/docs/product/patterns/navigation.md +0 -397
- package/dist/docs/product/patterns/payments.md +0 -765
- package/dist/docs/product/patterns/responsive-layout.md +0 -997
- package/dist/docs/product/patterns/tables-and-lists.md +0 -1170
- package/dist/docs/product/products/tempo-console.md +0 -671
- package/dist/docs/product/products/tempo-performance.md +0 -435
- package/dist/docs/product/products/tempo-wallet.md +0 -438
|
@@ -0,0 +1,2914 @@
|
|
|
1
|
+
# Navigation
|
|
2
|
+
|
|
3
|
+
Each component section states its guidance first, then its Examples and Use Cases. Read a section up to its Examples heading before you use the component, then read the examples it needs.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
Components that move between pages, views, and steps.
|
|
8
|
+
|
|
9
|
+
- [Breadcrumbs](#breadcrumbs): Shows where the current page sits in the site hierarchy.
|
|
10
|
+
- [Pagination](#pagination): Moves between pages of a long list.
|
|
11
|
+
- [SidebarMenu](#sidebarmenu): Vertical navigation for sidebars and drawers.
|
|
12
|
+
- [Stepper](#stepper): Shows progress through a fixed sequence of steps.
|
|
13
|
+
- [Tabs](#tabs): Switches between related views.
|
|
14
|
+
|
|
15
|
+
## Breadcrumbs
|
|
16
|
+
|
|
17
|
+
Shows where the current page sits in the site hierarchy.
|
|
18
|
+
|
|
19
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Breadcrumbs.tsx)
|
|
20
|
+
|
|
21
|
+
### Overview
|
|
22
|
+
|
|
23
|
+
A trail of links from the current page back to its ancestors.
|
|
24
|
+
|
|
25
|
+
### Anatomy
|
|
26
|
+
|
|
27
|
+
Import the component and assemble its parts.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Breadcrumbs } from '@tempoxyz/ds'
|
|
31
|
+
|
|
32
|
+
<Breadcrumbs>
|
|
33
|
+
<Breadcrumbs.Item />
|
|
34
|
+
</Breadcrumbs>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Guidelines
|
|
38
|
+
|
|
39
|
+
#### When to Use
|
|
40
|
+
|
|
41
|
+
* Mark pages three or more levels deep, such as a webhook endpoint inside a project in Tempo Console.
|
|
42
|
+
* Mark detail pages that people reach from a list and return to often, such as one API key under Checkout › API keys.
|
|
43
|
+
|
|
44
|
+
#### When Not to Use
|
|
45
|
+
|
|
46
|
+
* Use [SidebarMenu](#sidebarmenu) to move between top-level sections.
|
|
47
|
+
* Use [Stepper](#stepper) to show progress through a flow, such as Send payment.
|
|
48
|
+
* Use [Tabs](#tabs) to switch between views of the same page.
|
|
49
|
+
* Use `Button.Link` from [Button](actions.md#button) with `variant="tertiary"` for a single Back link in a two-level product.
|
|
50
|
+
|
|
51
|
+
#### Reserve Breadcrumbs for Deep Hierarchies
|
|
52
|
+
|
|
53
|
+
Add a trail only at three or more levels deep. On shallower pages, a trail repeats the sidebar and the page title.
|
|
54
|
+
|
|
55
|
+
**Do:** Show a trail on a page nested under a project and a section.
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
/**
|
|
59
|
+
* Do example for "Reserve Breadcrumbs for Deep Hierarchies" on the Breadcrumbs page.
|
|
60
|
+
* Show a trail on a page nested under a project and a section.
|
|
61
|
+
* @module
|
|
62
|
+
*/
|
|
63
|
+
import { Breadcrumbs, style } from '@tempoxyz/ds'
|
|
64
|
+
|
|
65
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
66
|
+
export function Demo() {
|
|
67
|
+
return (
|
|
68
|
+
<div {...styles.page()}>
|
|
69
|
+
<Breadcrumbs>
|
|
70
|
+
<Breadcrumbs.Item href="#">Checkout</Breadcrumbs.Item>
|
|
71
|
+
<Breadcrumbs.Item href="#">API keys</Breadcrumbs.Item>
|
|
72
|
+
<Breadcrumbs.Item current>Production</Breadcrumbs.Item>
|
|
73
|
+
</Breadcrumbs>
|
|
74
|
+
<span {...styles.title()}>Production</span>
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
namespace styles {
|
|
80
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
81
|
+
|
|
82
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h2' })
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Don't:** Add a trail to a top-level page, where it repeats the sidebar.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
/**
|
|
90
|
+
* Don't example for "Reserve Breadcrumbs for Deep Hierarchies" on the Breadcrumbs page.
|
|
91
|
+
* Don't add a trail to a top-level page, where it repeats the sidebar.
|
|
92
|
+
* @module
|
|
93
|
+
*/
|
|
94
|
+
import { Breadcrumbs, style } from '@tempoxyz/ds'
|
|
95
|
+
|
|
96
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
97
|
+
export function Demo() {
|
|
98
|
+
return (
|
|
99
|
+
<div {...styles.page()}>
|
|
100
|
+
<Breadcrumbs>
|
|
101
|
+
<Breadcrumbs.Item href="#">Home</Breadcrumbs.Item>
|
|
102
|
+
<Breadcrumbs.Item current>Activity</Breadcrumbs.Item>
|
|
103
|
+
</Breadcrumbs>
|
|
104
|
+
<span {...styles.title()}>Activity</span>
|
|
105
|
+
</div>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
namespace styles {
|
|
110
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
111
|
+
|
|
112
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h2' })
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### Reflect the Hierarchy, Not History
|
|
117
|
+
|
|
118
|
+
Build the trail from the product's structure. A transaction page shows the same trail from Activity, a search result, or a shared link. The browser's Back button covers history.
|
|
119
|
+
|
|
120
|
+
**Do:** Show the pages that contain the current page.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
/**
|
|
124
|
+
* Do example for "Reflect the Hierarchy, Not History" on the Breadcrumbs page.
|
|
125
|
+
* Show the pages that contain the current page.
|
|
126
|
+
* @module
|
|
127
|
+
*/
|
|
128
|
+
import { Breadcrumbs, style } from '@tempoxyz/ds'
|
|
129
|
+
|
|
130
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
131
|
+
export function Demo() {
|
|
132
|
+
return (
|
|
133
|
+
<div {...styles.page()}>
|
|
134
|
+
<Breadcrumbs>
|
|
135
|
+
<Breadcrumbs.Item href="#">Checkout</Breadcrumbs.Item>
|
|
136
|
+
<Breadcrumbs.Item href="#">Activity</Breadcrumbs.Item>
|
|
137
|
+
<Breadcrumbs.Item current>0x8f3a…c21d</Breadcrumbs.Item>
|
|
138
|
+
</Breadcrumbs>
|
|
139
|
+
<span {...styles.title()}>0x8f3a…c21d</span>
|
|
140
|
+
</div>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
namespace styles {
|
|
145
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
146
|
+
|
|
147
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h2' })
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Don't:** List the pages someone visited on the way.
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
/**
|
|
155
|
+
* Don't example for "Reflect the Hierarchy, Not History" on the Breadcrumbs page.
|
|
156
|
+
* Don't list the pages someone visited on the way.
|
|
157
|
+
* @module
|
|
158
|
+
*/
|
|
159
|
+
import { Breadcrumbs, style } from '@tempoxyz/ds'
|
|
160
|
+
|
|
161
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
162
|
+
export function Demo() {
|
|
163
|
+
return (
|
|
164
|
+
<div {...styles.page()}>
|
|
165
|
+
<Breadcrumbs>
|
|
166
|
+
<Breadcrumbs.Item href="#">Search</Breadcrumbs.Item>
|
|
167
|
+
<Breadcrumbs.Item href="#">Wallets</Breadcrumbs.Item>
|
|
168
|
+
<Breadcrumbs.Item current>0x8f3a…c21d</Breadcrumbs.Item>
|
|
169
|
+
</Breadcrumbs>
|
|
170
|
+
<span {...styles.title()}>0x8f3a…c21d</span>
|
|
171
|
+
</div>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
namespace styles {
|
|
176
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
177
|
+
|
|
178
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h2' })
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
#### Place the Trail Above the Title
|
|
183
|
+
|
|
184
|
+
Put breadcrumbs at the start of the content column, in the same position on every page.
|
|
185
|
+
|
|
186
|
+
**Do:** Place the trail directly above the page title.
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
/**
|
|
190
|
+
* Do example for "Reserve Breadcrumbs for Deep Hierarchies" on the Breadcrumbs page.
|
|
191
|
+
* Show a trail on a page nested under a project and a section.
|
|
192
|
+
* @module
|
|
193
|
+
*/
|
|
194
|
+
import { Breadcrumbs, style } from '@tempoxyz/ds'
|
|
195
|
+
|
|
196
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
197
|
+
export function Demo() {
|
|
198
|
+
return (
|
|
199
|
+
<div {...styles.page()}>
|
|
200
|
+
<Breadcrumbs>
|
|
201
|
+
<Breadcrumbs.Item href="#">Checkout</Breadcrumbs.Item>
|
|
202
|
+
<Breadcrumbs.Item href="#">API keys</Breadcrumbs.Item>
|
|
203
|
+
<Breadcrumbs.Item current>Production</Breadcrumbs.Item>
|
|
204
|
+
</Breadcrumbs>
|
|
205
|
+
<span {...styles.title()}>Production</span>
|
|
206
|
+
</div>
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
namespace styles {
|
|
211
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
212
|
+
|
|
213
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h2' })
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Don't:** Place the trail below the title.
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
/**
|
|
221
|
+
* Don't example for "Place the Trail Above the Title" on the Breadcrumbs page.
|
|
222
|
+
* Don't place the trail below the title.
|
|
223
|
+
* @module
|
|
224
|
+
*/
|
|
225
|
+
import { Breadcrumbs, style } from '@tempoxyz/ds'
|
|
226
|
+
|
|
227
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
228
|
+
export function Demo() {
|
|
229
|
+
return (
|
|
230
|
+
<div {...styles.page()}>
|
|
231
|
+
<span {...styles.title()}>Production</span>
|
|
232
|
+
<Breadcrumbs>
|
|
233
|
+
<Breadcrumbs.Item href="#">Checkout</Breadcrumbs.Item>
|
|
234
|
+
<Breadcrumbs.Item href="#">API keys</Breadcrumbs.Item>
|
|
235
|
+
<Breadcrumbs.Item current>Production</Breadcrumbs.Item>
|
|
236
|
+
</Breadcrumbs>
|
|
237
|
+
</div>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
namespace styles {
|
|
242
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
243
|
+
|
|
244
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h2' })
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
#### Keep the Default Separator
|
|
249
|
+
|
|
250
|
+
The default right chevron reads as one step down the hierarchy. Set `separator` only if the product already uses another convention, such as `/` for documentation paths, and use one separator across the product.
|
|
251
|
+
|
|
252
|
+
**Do:** Keep the default chevron.
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
/** Do example for "Keep the Default Separator" on the Breadcrumbs page: keep the default chevron. @module */
|
|
256
|
+
import { Breadcrumbs, style } from '@tempoxyz/ds'
|
|
257
|
+
|
|
258
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
259
|
+
export function Demo() {
|
|
260
|
+
return (
|
|
261
|
+
<div {...styles.page()}>
|
|
262
|
+
<Breadcrumbs>
|
|
263
|
+
<Breadcrumbs.Item href="#">Checkout</Breadcrumbs.Item>
|
|
264
|
+
<Breadcrumbs.Item href="#">Webhooks</Breadcrumbs.Item>
|
|
265
|
+
<Breadcrumbs.Item current>Deliveries</Breadcrumbs.Item>
|
|
266
|
+
</Breadcrumbs>
|
|
267
|
+
<span {...styles.title()}>Deliveries</span>
|
|
268
|
+
</div>
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
namespace styles {
|
|
273
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
274
|
+
|
|
275
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h2' })
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Don't:** Swap in another separator, such as an arrow, without a product convention.
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
/**
|
|
283
|
+
* Don't example for "Keep the Default Separator" on the Breadcrumbs page.
|
|
284
|
+
* Don't swap in another separator, such as an arrow, without a product convention.
|
|
285
|
+
* @module
|
|
286
|
+
*/
|
|
287
|
+
import { Breadcrumbs, style } from '@tempoxyz/ds'
|
|
288
|
+
|
|
289
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
290
|
+
export function Demo() {
|
|
291
|
+
return (
|
|
292
|
+
<div {...styles.page()}>
|
|
293
|
+
<Breadcrumbs separator="→">
|
|
294
|
+
<Breadcrumbs.Item href="#">Checkout</Breadcrumbs.Item>
|
|
295
|
+
<Breadcrumbs.Item href="#">Webhooks</Breadcrumbs.Item>
|
|
296
|
+
<Breadcrumbs.Item current>Deliveries</Breadcrumbs.Item>
|
|
297
|
+
</Breadcrumbs>
|
|
298
|
+
<span {...styles.title()}>Deliveries</span>
|
|
299
|
+
</div>
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
namespace styles {
|
|
304
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
305
|
+
|
|
306
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h2' })
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Content
|
|
311
|
+
|
|
312
|
+
* **Labels:** Use each page's title, such as API keys.
|
|
313
|
+
* **Addresses and hashes:** Shorten to the first and last characters, such as 0x71C7…976F. Show the full value on the page.
|
|
314
|
+
* **Length:** The list wraps instead of truncating, so keep labels short.
|
|
315
|
+
|
|
316
|
+
### Accessibility
|
|
317
|
+
|
|
318
|
+
Renders a navigation landmark with an ordered list of links, following the [WAI-ARIA breadcrumb pattern](https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/).
|
|
319
|
+
|
|
320
|
+
#### Semantics
|
|
321
|
+
|
|
322
|
+
* **Root (nav):** A navigation landmark named "Breadcrumb".
|
|
323
|
+
* **List (ol):** Screen readers announce the number of levels.
|
|
324
|
+
* **Breadcrumbs.Item (li):** Wraps a link. The current item is plain text marked as the current page.
|
|
325
|
+
* **Separators (aria-hidden):** Hidden. Screen readers announce only the pages.
|
|
326
|
+
|
|
327
|
+
#### Keyboard
|
|
328
|
+
|
|
329
|
+
* **Move Between Links (Tab):** Moves focus to each link in order, skipping the current item.
|
|
330
|
+
* **Follow a Link (Enter):** Follows the focused link.
|
|
331
|
+
|
|
332
|
+
#### Your Responsibilities
|
|
333
|
+
|
|
334
|
+
* **Mark the Current Page (current):** Set it on the last item. It is announced as the current page and takes no focus.
|
|
335
|
+
* **Keep the Landmark Distinct (SC 2.4.1):** Keep the "Breadcrumb" name, or pass a distinct `aria-label`.
|
|
336
|
+
* **Use Real Links (render):** Pass your router's link so each item stays a real link with the same styles.
|
|
337
|
+
* **Keep the Default Gaps (20px):** Links are under the 24px minimum, which WCAG 2.2 accepts if targets are spaced apart.
|
|
338
|
+
|
|
339
|
+
### Related
|
|
340
|
+
|
|
341
|
+
[SidebarMenu](#sidebarmenu)
|
|
342
|
+
|
|
343
|
+
Use for top-level navigation.
|
|
344
|
+
|
|
345
|
+
[AppShell](layout.md#appshell)
|
|
346
|
+
|
|
347
|
+
Use for the page frame that holds the trail.
|
|
348
|
+
|
|
349
|
+
[Tabs](#tabs)
|
|
350
|
+
|
|
351
|
+
Use for switching views within a page.
|
|
352
|
+
|
|
353
|
+
[Navigation](../patterns.md#navigation)
|
|
354
|
+
|
|
355
|
+
Covers choosing between navigation components.
|
|
356
|
+
|
|
357
|
+
### Examples
|
|
358
|
+
|
|
359
|
+
#### Basic
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
import { Breadcrumbs } from '@tempoxyz/ds'
|
|
363
|
+
|
|
364
|
+
export function Demo() {
|
|
365
|
+
return (
|
|
366
|
+
<Breadcrumbs>
|
|
367
|
+
<Breadcrumbs.Item href="#">Home</Breadcrumbs.Item>
|
|
368
|
+
<Breadcrumbs.Item href="#">Payments</Breadcrumbs.Item>
|
|
369
|
+
<Breadcrumbs.Item current>Invoices</Breadcrumbs.Item>
|
|
370
|
+
</Breadcrumbs>
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Breadcrumbs/Basic.tsx)
|
|
376
|
+
|
|
377
|
+
#### Separator
|
|
378
|
+
|
|
379
|
+
Set `separator` to any node to place between items. It defaults to a right chevron.
|
|
380
|
+
|
|
381
|
+
```tsx
|
|
382
|
+
import { Breadcrumbs } from '@tempoxyz/ds'
|
|
383
|
+
|
|
384
|
+
export function Demo() {
|
|
385
|
+
return (
|
|
386
|
+
<Breadcrumbs separator="/">
|
|
387
|
+
<Breadcrumbs.Item href="#">Docs</Breadcrumbs.Item>
|
|
388
|
+
<Breadcrumbs.Item current>Guides</Breadcrumbs.Item>
|
|
389
|
+
</Breadcrumbs>
|
|
390
|
+
)
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Breadcrumbs/Separator.tsx)
|
|
395
|
+
|
|
396
|
+
## Pagination
|
|
397
|
+
|
|
398
|
+
Moves between pages of a long list.
|
|
399
|
+
|
|
400
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Pagination.tsx)
|
|
401
|
+
|
|
402
|
+
### Overview
|
|
403
|
+
|
|
404
|
+
Pagination renders a navigation landmark with links to each page of a list, plus previous and next steps.
|
|
405
|
+
|
|
406
|
+
### Anatomy
|
|
407
|
+
|
|
408
|
+
Import the component and assemble its parts.
|
|
409
|
+
|
|
410
|
+
```tsx
|
|
411
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
412
|
+
|
|
413
|
+
<Pagination>
|
|
414
|
+
<Pagination.Previous />
|
|
415
|
+
<Pagination.Page />
|
|
416
|
+
<Pagination.Ellipsis />
|
|
417
|
+
<Pagination.Next />
|
|
418
|
+
</Pagination>
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Guidelines
|
|
422
|
+
|
|
423
|
+
#### When to Use
|
|
424
|
+
|
|
425
|
+
* Split long lists that people scan, sort, and revisit, such as transaction history or webhook deliveries.
|
|
426
|
+
* Paginate tables where position matters, such as a shared link to page 3.
|
|
427
|
+
|
|
428
|
+
#### When Not to Use
|
|
429
|
+
|
|
430
|
+
* Use a `secondary` [Button](actions.md#button) labelled Load more at the end of a feed, such as wallet Activity.
|
|
431
|
+
* Use [Stepper](#stepper) for progress through a flow.
|
|
432
|
+
* Use [Tabs](#tabs) to split a list by category, such as Incoming and Outgoing.
|
|
433
|
+
* Use a [Table](data-display.md#table) or [ListGroup](data-display.md#listgroup) without pagination when the list fits on one screen.
|
|
434
|
+
|
|
435
|
+
#### Choose Pagination or Load More
|
|
436
|
+
|
|
437
|
+
* **Pagination (Tables and logs):** Each page has a URL, readers jump to any page, and the footer stays reachable.
|
|
438
|
+
* **Load More (Feeds):** New items append below the last one. The footer is reachable after each load.
|
|
439
|
+
|
|
440
|
+
Avoid infinite scroll on the web. It pushes the footer out of reach and gives keyboard users no stopping point.
|
|
441
|
+
|
|
442
|
+
#### Link Every Page
|
|
443
|
+
|
|
444
|
+
Give each `Pagination.Page` an `href` with its number. Links then survive a reload, open in a new tab, and work with Back. Pass `render` to use your router's link.
|
|
445
|
+
|
|
446
|
+
**Do:** Put the page number in the URL, such as `?page=3`.
|
|
447
|
+
|
|
448
|
+
```tsx
|
|
449
|
+
/**
|
|
450
|
+
* Do example for "Link Every Page" on the Pagination page.
|
|
451
|
+
* Put the page number in the URL, such as `?page=3`.
|
|
452
|
+
* @module
|
|
453
|
+
*/
|
|
454
|
+
import { Pagination, style } from '@tempoxyz/ds'
|
|
455
|
+
|
|
456
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
457
|
+
export function Demo() {
|
|
458
|
+
return (
|
|
459
|
+
<div {...styles.page()}>
|
|
460
|
+
<span {...styles.address()}>console.tempo.xyz/activity?page=3</span>
|
|
461
|
+
<Pagination size="small">
|
|
462
|
+
<Pagination.Previous href="#" />
|
|
463
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
464
|
+
<Pagination.Page current href="#">
|
|
465
|
+
3
|
|
466
|
+
</Pagination.Page>
|
|
467
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
468
|
+
<Pagination.Next href="#" />
|
|
469
|
+
</Pagination>
|
|
470
|
+
</div>
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
namespace styles {
|
|
475
|
+
export const address = style({
|
|
476
|
+
backgroundColor: 'container.regular',
|
|
477
|
+
borderRadius: 'full',
|
|
478
|
+
color: 'content.secondary',
|
|
479
|
+
cornerShape: 'round',
|
|
480
|
+
paddingBlock: '4',
|
|
481
|
+
paddingInline: '12',
|
|
482
|
+
typography: 'body.b3',
|
|
483
|
+
})
|
|
484
|
+
|
|
485
|
+
export const page = style({
|
|
486
|
+
alignItems: 'flex-start',
|
|
487
|
+
display: 'flex',
|
|
488
|
+
flexDirection: 'column',
|
|
489
|
+
rowGap: '16',
|
|
490
|
+
})
|
|
491
|
+
}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
**Don't:** Change pages without changing the URL.
|
|
495
|
+
|
|
496
|
+
```tsx
|
|
497
|
+
/**
|
|
498
|
+
* Don't example for "Link Every Page" on the Pagination page.
|
|
499
|
+
* Don't change pages without changing the URL.
|
|
500
|
+
* @module
|
|
501
|
+
*/
|
|
502
|
+
import { Pagination, style } from '@tempoxyz/ds'
|
|
503
|
+
|
|
504
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
505
|
+
export function Demo() {
|
|
506
|
+
return (
|
|
507
|
+
<div {...styles.page()}>
|
|
508
|
+
<span {...styles.address()}>console.tempo.xyz/activity</span>
|
|
509
|
+
<Pagination size="small">
|
|
510
|
+
<Pagination.Previous href="#" />
|
|
511
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
512
|
+
<Pagination.Page current href="#">
|
|
513
|
+
3
|
|
514
|
+
</Pagination.Page>
|
|
515
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
516
|
+
<Pagination.Next href="#" />
|
|
517
|
+
</Pagination>
|
|
518
|
+
</div>
|
|
519
|
+
)
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
namespace styles {
|
|
523
|
+
export const address = style({
|
|
524
|
+
backgroundColor: 'container.regular',
|
|
525
|
+
borderRadius: 'full',
|
|
526
|
+
color: 'content.secondary',
|
|
527
|
+
cornerShape: 'round',
|
|
528
|
+
paddingBlock: '4',
|
|
529
|
+
paddingInline: '12',
|
|
530
|
+
typography: 'body.b3',
|
|
531
|
+
})
|
|
532
|
+
|
|
533
|
+
export const page = style({
|
|
534
|
+
alignItems: 'flex-start',
|
|
535
|
+
display: 'flex',
|
|
536
|
+
flexDirection: 'column',
|
|
537
|
+
rowGap: '16',
|
|
538
|
+
})
|
|
539
|
+
}
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
#### Truncate Long Ranges
|
|
543
|
+
|
|
544
|
+
* **Always show:** The first, last, and current pages.
|
|
545
|
+
* **Skipped ranges:** Replace each with a `Pagination.Ellipsis`.
|
|
546
|
+
* **Limit:** Keep about seven page items, with the current page's neighbors when there is room.
|
|
547
|
+
|
|
548
|
+
**Do:** Keep the first and last pages around the current one.
|
|
549
|
+
|
|
550
|
+
```tsx
|
|
551
|
+
/**
|
|
552
|
+
* Do example for "Truncate Long Ranges" on the Pagination page.
|
|
553
|
+
* Keep the first and last pages around the current one.
|
|
554
|
+
* @module
|
|
555
|
+
*/
|
|
556
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
557
|
+
|
|
558
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
559
|
+
export function Demo() {
|
|
560
|
+
return (
|
|
561
|
+
<Pagination size="small">
|
|
562
|
+
<Pagination.Previous href="#" />
|
|
563
|
+
<Pagination.Page href="#">1</Pagination.Page>
|
|
564
|
+
<Pagination.Ellipsis />
|
|
565
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
566
|
+
<Pagination.Page current href="#">
|
|
567
|
+
5
|
|
568
|
+
</Pagination.Page>
|
|
569
|
+
<Pagination.Page href="#">6</Pagination.Page>
|
|
570
|
+
<Pagination.Ellipsis />
|
|
571
|
+
<Pagination.Page href="#">49</Pagination.Page>
|
|
572
|
+
<Pagination.Next href="#" />
|
|
573
|
+
</Pagination>
|
|
574
|
+
)
|
|
575
|
+
}
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
**Don't:** Show only the pages next to the current one.
|
|
579
|
+
|
|
580
|
+
```tsx
|
|
581
|
+
/**
|
|
582
|
+
* Don't example for "Truncate Long Ranges" on the Pagination page.
|
|
583
|
+
* Don't show only the pages next to the current one.
|
|
584
|
+
* @module
|
|
585
|
+
*/
|
|
586
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
587
|
+
|
|
588
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
589
|
+
export function Demo() {
|
|
590
|
+
return (
|
|
591
|
+
<Pagination size="small">
|
|
592
|
+
<Pagination.Previous href="#" />
|
|
593
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
594
|
+
<Pagination.Page current href="#">
|
|
595
|
+
5
|
|
596
|
+
</Pagination.Page>
|
|
597
|
+
<Pagination.Page href="#">6</Pagination.Page>
|
|
598
|
+
<Pagination.Next href="#" />
|
|
599
|
+
</Pagination>
|
|
600
|
+
)
|
|
601
|
+
}
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
#### Keep Previous and Next in Place
|
|
605
|
+
|
|
606
|
+
Render `Pagination.Previous` and `Pagination.Next` on every page. Set `disabled` at either end instead of removing them, so the page links do not shift.
|
|
607
|
+
|
|
608
|
+
**Do:** Disable Previous on the first page.
|
|
609
|
+
|
|
610
|
+
```tsx
|
|
611
|
+
/**
|
|
612
|
+
* Do example for "Keep Previous and Next in Place" on the Pagination page.
|
|
613
|
+
* Disable Previous on the first page.
|
|
614
|
+
* @module
|
|
615
|
+
*/
|
|
616
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
617
|
+
|
|
618
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
619
|
+
export function Demo() {
|
|
620
|
+
return (
|
|
621
|
+
<Pagination size="small">
|
|
622
|
+
<Pagination.Previous disabled />
|
|
623
|
+
<Pagination.Page current href="#">
|
|
624
|
+
1
|
|
625
|
+
</Pagination.Page>
|
|
626
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
627
|
+
<Pagination.Page href="#">3</Pagination.Page>
|
|
628
|
+
<Pagination.Next href="#" />
|
|
629
|
+
</Pagination>
|
|
630
|
+
)
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
**Don't:** Remove Previous, which moves every page link when it returns.
|
|
635
|
+
|
|
636
|
+
```tsx
|
|
637
|
+
/**
|
|
638
|
+
* Don't example for "Keep Previous and Next in Place" on the Pagination page.
|
|
639
|
+
* Don't remove Previous, which moves every page link when it returns.
|
|
640
|
+
* @module
|
|
641
|
+
*/
|
|
642
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
643
|
+
|
|
644
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
645
|
+
export function Demo() {
|
|
646
|
+
return (
|
|
647
|
+
<Pagination size="small">
|
|
648
|
+
<Pagination.Page current href="#">
|
|
649
|
+
1
|
|
650
|
+
</Pagination.Page>
|
|
651
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
652
|
+
<Pagination.Page href="#">3</Pagination.Page>
|
|
653
|
+
<Pagination.Next href="#" />
|
|
654
|
+
</Pagination>
|
|
655
|
+
)
|
|
656
|
+
}
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
#### Show the Range You're Viewing
|
|
660
|
+
|
|
661
|
+
Place a count beside the control, directly below its list.
|
|
662
|
+
|
|
663
|
+
**Do:** Show the rows on screen and the total, such as Showing 51–75 of 1,204 transactions.
|
|
664
|
+
|
|
665
|
+
```tsx
|
|
666
|
+
/**
|
|
667
|
+
* Do example for "Show the Range You're Viewing" on the Pagination page.
|
|
668
|
+
* Show the rows on screen and the total, such as Showing 51–75 of 1,204 transactions.
|
|
669
|
+
* @module
|
|
670
|
+
*/
|
|
671
|
+
import { Pagination, style } from '@tempoxyz/ds'
|
|
672
|
+
|
|
673
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
674
|
+
export function Demo() {
|
|
675
|
+
return (
|
|
676
|
+
<div {...styles.row()}>
|
|
677
|
+
<span {...styles.count()}>Showing 51–75 of 1,204 transactions</span>
|
|
678
|
+
<Pagination size="small">
|
|
679
|
+
<Pagination.Previous href="#" />
|
|
680
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
681
|
+
<Pagination.Page current href="#">
|
|
682
|
+
3
|
|
683
|
+
</Pagination.Page>
|
|
684
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
685
|
+
<Pagination.Next href="#" />
|
|
686
|
+
</Pagination>
|
|
687
|
+
</div>
|
|
688
|
+
)
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
namespace styles {
|
|
692
|
+
export const count = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
693
|
+
|
|
694
|
+
export const row = style({
|
|
695
|
+
alignItems: 'center',
|
|
696
|
+
display: 'flex',
|
|
697
|
+
flexWrap: 'wrap',
|
|
698
|
+
gap: '12',
|
|
699
|
+
justifyContent: 'space-between',
|
|
700
|
+
width: '100% !custom',
|
|
701
|
+
})
|
|
702
|
+
}
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
**Don't:** Show page numbers without the count.
|
|
706
|
+
|
|
707
|
+
```tsx
|
|
708
|
+
/**
|
|
709
|
+
* Don't example for "Show the Range You're Viewing" on the Pagination page.
|
|
710
|
+
* Don't show page numbers without the count.
|
|
711
|
+
* @module
|
|
712
|
+
*/
|
|
713
|
+
import { Pagination, style } from '@tempoxyz/ds'
|
|
714
|
+
|
|
715
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
716
|
+
export function Demo() {
|
|
717
|
+
return (
|
|
718
|
+
<div {...styles.row()}>
|
|
719
|
+
<Pagination size="small">
|
|
720
|
+
<Pagination.Previous href="#" />
|
|
721
|
+
<Pagination.Page href="#">2</Pagination.Page>
|
|
722
|
+
<Pagination.Page current href="#">
|
|
723
|
+
3
|
|
724
|
+
</Pagination.Page>
|
|
725
|
+
<Pagination.Page href="#">4</Pagination.Page>
|
|
726
|
+
<Pagination.Next href="#" />
|
|
727
|
+
</Pagination>
|
|
728
|
+
</div>
|
|
729
|
+
)
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
namespace styles {
|
|
733
|
+
export const row = style({
|
|
734
|
+
alignItems: 'center',
|
|
735
|
+
display: 'flex',
|
|
736
|
+
flexWrap: 'wrap',
|
|
737
|
+
gap: '12',
|
|
738
|
+
justifyContent: 'space-between',
|
|
739
|
+
width: '100% !custom',
|
|
740
|
+
})
|
|
741
|
+
}
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
#### Match Size to the List
|
|
745
|
+
|
|
746
|
+
* **Small (32px):** Under dense tables, like Tempo Performance runs.
|
|
747
|
+
* **Medium (40px):** The default.
|
|
748
|
+
* **Large (56px):** Touch-first layouts.
|
|
749
|
+
|
|
750
|
+
### Content
|
|
751
|
+
|
|
752
|
+
* **Steps:** Keep the default Previous and Next. If children replace them, keep both descriptive, such as Newer and Older.
|
|
753
|
+
* **Count:** Name the rows of the list, such as transactions or deliveries.
|
|
754
|
+
* **Numbers:** Use numerals, and group the digits of large totals, such as 1,204.
|
|
755
|
+
|
|
756
|
+
### Accessibility
|
|
757
|
+
|
|
758
|
+
The current page and disabled steps carry ARIA states.
|
|
759
|
+
|
|
760
|
+
#### Semantics
|
|
761
|
+
|
|
762
|
+
* **Root (navigation):** A landmark named "Pagination" that wraps a list of pages.
|
|
763
|
+
* **Parts (li):** Each part is a list item. Pages and steps render links by default.
|
|
764
|
+
* **Current Page (aria-current):** Set by `current`. Screen readers announce the page as current.
|
|
765
|
+
* **Disabled Steps (aria-disabled):** Renders as text and leaves the tab order. With `render`, it keeps your element.
|
|
766
|
+
* **Pagination.Ellipsis:** Plain text that takes no focus. The chevron icons are hidden from assistive technology.
|
|
767
|
+
|
|
768
|
+
#### Keyboard
|
|
769
|
+
|
|
770
|
+
* **Move Between Links (Tab):** Moves through the links in order. Skips ellipses and disabled steps without `render`.
|
|
771
|
+
* **Follow a Link (Enter):** Follows the focused link.
|
|
772
|
+
|
|
773
|
+
#### Your Responsibilities
|
|
774
|
+
|
|
775
|
+
* **Mark One Current Page (current):** Set it on exactly one page.
|
|
776
|
+
* **Block Disabled Custom Links (render):** For a custom disabled step, block navigation and remove it from the tab order yourself.
|
|
777
|
+
* **Name Each Pagination (aria-label):** If a page holds more than one, give each a distinct name, such as "Deliveries pagination".
|
|
778
|
+
* **Name Page Links (SC 2.4.4):** Consider an `aria-label` such as "Page 4". A bare number means little out of context.
|
|
779
|
+
* **Handle In-Place Loads:** After a client-side page change, move focus to the start of the results, such as the heading.
|
|
780
|
+
|
|
781
|
+
### Related
|
|
782
|
+
|
|
783
|
+
[Table](data-display.md#table)
|
|
784
|
+
|
|
785
|
+
Use for the rows you paginate.
|
|
786
|
+
|
|
787
|
+
[ListGroup](data-display.md#listgroup)
|
|
788
|
+
|
|
789
|
+
Use for lists of records.
|
|
790
|
+
|
|
791
|
+
[Button](actions.md#button)
|
|
792
|
+
|
|
793
|
+
Use for a Load more action.
|
|
794
|
+
|
|
795
|
+
[Tables and Lists](../patterns.md#tables-and-lists)
|
|
796
|
+
|
|
797
|
+
Covers sorting, filtering, and paging data.
|
|
798
|
+
|
|
799
|
+
### Examples
|
|
800
|
+
|
|
801
|
+
#### Basic
|
|
802
|
+
|
|
803
|
+
```tsx
|
|
804
|
+
import { Pagination } from '@tempoxyz/ds'
|
|
805
|
+
|
|
806
|
+
function Pages(props: { current: number; size?: Pagination.Props['size'] }) {
|
|
807
|
+
return (
|
|
808
|
+
<Pagination size={props.size}>
|
|
809
|
+
<Pagination.Previous disabled={props.current === 1} href="#" />
|
|
810
|
+
<Pagination.Page current={props.current === 1} href="#">
|
|
811
|
+
1
|
|
812
|
+
</Pagination.Page>
|
|
813
|
+
<Pagination.Ellipsis />
|
|
814
|
+
<Pagination.Page current={props.current === 4} href="#">
|
|
815
|
+
4
|
|
816
|
+
</Pagination.Page>
|
|
817
|
+
<Pagination.Ellipsis />
|
|
818
|
+
<Pagination.Page current={props.current === 9} href="#">
|
|
819
|
+
9
|
|
820
|
+
</Pagination.Page>
|
|
821
|
+
<Pagination.Next disabled={props.current === 9} href="#" />
|
|
822
|
+
</Pagination>
|
|
823
|
+
)
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
export function Demo() {
|
|
827
|
+
return <Pages current={4} />
|
|
828
|
+
}
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Pagination/Basic.tsx)
|
|
832
|
+
|
|
833
|
+
#### Size
|
|
834
|
+
|
|
835
|
+
Set `size` to `small`, `medium` (default), or `large`.
|
|
836
|
+
|
|
837
|
+
```tsx
|
|
838
|
+
import { Pagination, Stack } from '@tempoxyz/ds'
|
|
839
|
+
|
|
840
|
+
function Pages(props: { current: number; size?: Pagination.Props['size'] }) {
|
|
841
|
+
return (
|
|
842
|
+
<Pagination size={props.size}>
|
|
843
|
+
<Pagination.Previous disabled={props.current === 1} href="#" />
|
|
844
|
+
<Pagination.Page current={props.current === 1} href="#">
|
|
845
|
+
1
|
|
846
|
+
</Pagination.Page>
|
|
847
|
+
<Pagination.Ellipsis />
|
|
848
|
+
<Pagination.Page current={props.current === 4} href="#">
|
|
849
|
+
4
|
|
850
|
+
</Pagination.Page>
|
|
851
|
+
<Pagination.Ellipsis />
|
|
852
|
+
<Pagination.Page current={props.current === 9} href="#">
|
|
853
|
+
9
|
|
854
|
+
</Pagination.Page>
|
|
855
|
+
<Pagination.Next disabled={props.current === 9} href="#" />
|
|
856
|
+
</Pagination>
|
|
857
|
+
)
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
export function Demo() {
|
|
861
|
+
return (
|
|
862
|
+
<Stack gap="16">
|
|
863
|
+
<Pages current={4} size="small" />
|
|
864
|
+
<Pages current={4} size="medium" />
|
|
865
|
+
<Pages current={4} size="large" />
|
|
866
|
+
</Stack>
|
|
867
|
+
)
|
|
868
|
+
}
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Pagination/Size.tsx)
|
|
872
|
+
|
|
873
|
+
#### Current
|
|
874
|
+
|
|
875
|
+
Set `current` on exactly one `Pagination.Page`. `Pagination.Previous` and `Pagination.Next` take `disabled` at either end.
|
|
876
|
+
|
|
877
|
+
```tsx
|
|
878
|
+
import { Pagination, Stack } from '@tempoxyz/ds'
|
|
879
|
+
|
|
880
|
+
function Pages(props: { current: number; size?: Pagination.Props['size'] }) {
|
|
881
|
+
return (
|
|
882
|
+
<Pagination size={props.size}>
|
|
883
|
+
<Pagination.Previous disabled={props.current === 1} href="#" />
|
|
884
|
+
<Pagination.Page current={props.current === 1} href="#">
|
|
885
|
+
1
|
|
886
|
+
</Pagination.Page>
|
|
887
|
+
<Pagination.Ellipsis />
|
|
888
|
+
<Pagination.Page current={props.current === 4} href="#">
|
|
889
|
+
4
|
|
890
|
+
</Pagination.Page>
|
|
891
|
+
<Pagination.Ellipsis />
|
|
892
|
+
<Pagination.Page current={props.current === 9} href="#">
|
|
893
|
+
9
|
|
894
|
+
</Pagination.Page>
|
|
895
|
+
<Pagination.Next disabled={props.current === 9} href="#" />
|
|
896
|
+
</Pagination>
|
|
897
|
+
)
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
export function Demo() {
|
|
901
|
+
return (
|
|
902
|
+
<Stack gap="16">
|
|
903
|
+
<Pages current={1} />
|
|
904
|
+
<Pages current={4} />
|
|
905
|
+
<Pages current={9} />
|
|
906
|
+
</Stack>
|
|
907
|
+
)
|
|
908
|
+
}
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Pagination/Current.tsx)
|
|
912
|
+
|
|
913
|
+
## SidebarMenu
|
|
914
|
+
|
|
915
|
+
Vertical navigation for sidebars and drawers.
|
|
916
|
+
|
|
917
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/SidebarMenu.tsx)
|
|
918
|
+
|
|
919
|
+
Figma: [Buttons/Floating Action Button](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5265-2305) (`SidebarMenu.Item`), [Navigation/Account Row](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-3036) (`SidebarMenu.AccountRow`), [Navigation/Nav Item](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-2694) (`SidebarMenu.Item`), [Navigation/Sidebar Promo](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5629-2524) (`SidebarMenu.Promo`), [Navigation/Tab Bar Item](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5265-2279) (`SidebarMenu.Item`), [Navigation/Wallet Sidebar](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-2727) (`SidebarMenu.Root`)
|
|
920
|
+
|
|
921
|
+
### Overview
|
|
922
|
+
|
|
923
|
+
SidebarMenu renders vertical navigation of icon and label rows, for sidebars and drawers. Items are links, not menu items.
|
|
924
|
+
|
|
925
|
+
### Anatomy
|
|
926
|
+
|
|
927
|
+
Import the component and assemble its parts.
|
|
928
|
+
|
|
929
|
+
```tsx
|
|
930
|
+
import { SidebarMenu } from '@tempoxyz/ds'
|
|
931
|
+
|
|
932
|
+
<SidebarMenu.Root>
|
|
933
|
+
<SidebarMenu.Group>
|
|
934
|
+
<SidebarMenu.GroupLabel />
|
|
935
|
+
<SidebarMenu.Item />
|
|
936
|
+
<SidebarMenu.Submenu>
|
|
937
|
+
<SidebarMenu.SubmenuTrigger />
|
|
938
|
+
<SidebarMenu.SubmenuPanel>
|
|
939
|
+
<SidebarMenu.Item />
|
|
940
|
+
</SidebarMenu.SubmenuPanel>
|
|
941
|
+
</SidebarMenu.Submenu>
|
|
942
|
+
</SidebarMenu.Group>
|
|
943
|
+
</SidebarMenu.Root>
|
|
944
|
+
<SidebarMenu.AccountRow>
|
|
945
|
+
<SidebarMenu.Logo />
|
|
946
|
+
</SidebarMenu.AccountRow>
|
|
947
|
+
<SidebarMenu.Account>
|
|
948
|
+
<SidebarMenu.AccountRow />
|
|
949
|
+
</SidebarMenu.Account>
|
|
950
|
+
<SidebarMenu.Mark />
|
|
951
|
+
<SidebarMenu.Promo />
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
### Guidelines
|
|
955
|
+
|
|
956
|
+
#### When to Use
|
|
957
|
+
|
|
958
|
+
* Navigate a product with five or more destinations, such as Home, API keys, Webhooks, Team, and Settings.
|
|
959
|
+
* Navigate inside `AppShell.Sidebar` ([AppShell](layout.md#appshell)), which moves the menu into a drawer below 1024px.
|
|
960
|
+
|
|
961
|
+
#### When Not to Use
|
|
962
|
+
|
|
963
|
+
* Use [Menu](overlays.md#menu) for a list of actions, such as Rename key or Revoke key.
|
|
964
|
+
* Use [Tabs](#tabs) to switch views inside one page.
|
|
965
|
+
* Use [Breadcrumbs](#breadcrumbs) to show where a deeply nested page sits.
|
|
966
|
+
* Use [ListGroup](data-display.md#listgroup) for a settings page that lists its subpages in the content.
|
|
967
|
+
|
|
968
|
+
#### Group Related Destinations
|
|
969
|
+
|
|
970
|
+
Wrap related items in a `SidebarMenu.Group` with a `SidebarMenu.GroupLabel`, such as Payments or Developers. Adjacent groups render with space between them.
|
|
971
|
+
|
|
972
|
+
If the first group holds the main pages, such as Home, it can skip its label. Give it an `aria-label` instead.
|
|
973
|
+
|
|
974
|
+
**Do:** Group items under short labels.
|
|
975
|
+
|
|
976
|
+
```tsx
|
|
977
|
+
/** Do example for "Group Related Destinations" on the SidebarMenu page: group items under short labels. @module */
|
|
978
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
979
|
+
import { Bank, Globe, Grid, Key, Wallet } from '@tempoxyz/ds/icons'
|
|
980
|
+
|
|
981
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
982
|
+
export function Demo() {
|
|
983
|
+
return (
|
|
984
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.column()}>
|
|
985
|
+
<SidebarMenu.Group aria-label="Project">
|
|
986
|
+
<SidebarMenu.Item active href="#">
|
|
987
|
+
<Grid />
|
|
988
|
+
Home
|
|
989
|
+
</SidebarMenu.Item>
|
|
990
|
+
</SidebarMenu.Group>
|
|
991
|
+
<SidebarMenu.Group>
|
|
992
|
+
<SidebarMenu.GroupLabel>Payments</SidebarMenu.GroupLabel>
|
|
993
|
+
<SidebarMenu.Item href="#">
|
|
994
|
+
<Wallet />
|
|
995
|
+
Wallets
|
|
996
|
+
</SidebarMenu.Item>
|
|
997
|
+
<SidebarMenu.Item href="#">
|
|
998
|
+
<Bank />
|
|
999
|
+
Payouts
|
|
1000
|
+
</SidebarMenu.Item>
|
|
1001
|
+
</SidebarMenu.Group>
|
|
1002
|
+
<SidebarMenu.Group>
|
|
1003
|
+
<SidebarMenu.GroupLabel>Developers</SidebarMenu.GroupLabel>
|
|
1004
|
+
<SidebarMenu.Item href="#">
|
|
1005
|
+
<Key />
|
|
1006
|
+
API keys
|
|
1007
|
+
</SidebarMenu.Item>
|
|
1008
|
+
<SidebarMenu.Item href="#">
|
|
1009
|
+
<Globe />
|
|
1010
|
+
Webhooks
|
|
1011
|
+
</SidebarMenu.Item>
|
|
1012
|
+
</SidebarMenu.Group>
|
|
1013
|
+
</SidebarMenu.Root>
|
|
1014
|
+
)
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
namespace styles {
|
|
1018
|
+
export const column = style({ width: '15rem !custom' })
|
|
1019
|
+
}
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
**Don't:** List unrelated destinations in one flat column.
|
|
1023
|
+
|
|
1024
|
+
```tsx
|
|
1025
|
+
/**
|
|
1026
|
+
* Don't example for "Group Related Destinations" on the SidebarMenu page.
|
|
1027
|
+
* Don't list unrelated destinations in one flat column.
|
|
1028
|
+
* @module
|
|
1029
|
+
*/
|
|
1030
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1031
|
+
import { Bank, Bell, Globe, Grid, Key, Lock, Users, Wallet } from '@tempoxyz/ds/icons'
|
|
1032
|
+
|
|
1033
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1034
|
+
export function Demo() {
|
|
1035
|
+
return (
|
|
1036
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.column()}>
|
|
1037
|
+
<SidebarMenu.Item active href="#">
|
|
1038
|
+
<Grid />
|
|
1039
|
+
Home
|
|
1040
|
+
</SidebarMenu.Item>
|
|
1041
|
+
<SidebarMenu.Item href="#">
|
|
1042
|
+
<Wallet />
|
|
1043
|
+
Wallets
|
|
1044
|
+
</SidebarMenu.Item>
|
|
1045
|
+
<SidebarMenu.Item href="#">
|
|
1046
|
+
<Key />
|
|
1047
|
+
API keys
|
|
1048
|
+
</SidebarMenu.Item>
|
|
1049
|
+
<SidebarMenu.Item href="#">
|
|
1050
|
+
<Users />
|
|
1051
|
+
Team
|
|
1052
|
+
</SidebarMenu.Item>
|
|
1053
|
+
<SidebarMenu.Item href="#">
|
|
1054
|
+
<Bank />
|
|
1055
|
+
Payouts
|
|
1056
|
+
</SidebarMenu.Item>
|
|
1057
|
+
<SidebarMenu.Item href="#">
|
|
1058
|
+
<Bell />
|
|
1059
|
+
Notifications
|
|
1060
|
+
</SidebarMenu.Item>
|
|
1061
|
+
<SidebarMenu.Item href="#">
|
|
1062
|
+
<Globe />
|
|
1063
|
+
Webhooks
|
|
1064
|
+
</SidebarMenu.Item>
|
|
1065
|
+
<SidebarMenu.Item href="#">
|
|
1066
|
+
<Lock />
|
|
1067
|
+
Security
|
|
1068
|
+
</SidebarMenu.Item>
|
|
1069
|
+
</SidebarMenu.Root>
|
|
1070
|
+
)
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
namespace styles {
|
|
1074
|
+
export const column = style({ width: '15rem !custom' })
|
|
1075
|
+
}
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
#### Keep Item Counts Low
|
|
1079
|
+
|
|
1080
|
+
* **Per group:** Three to seven items, in at most four or five groups.
|
|
1081
|
+
* **Single items:** Avoid groups of one, except an unlabelled first group.
|
|
1082
|
+
* **Long menus:** If a menu has 15 or more items, set `size="small"` for 32px rows and 16px icons.
|
|
1083
|
+
* **Overflow:** Move rare pages onto a hub page built from [ListGroup](data-display.md#listgroup), such as Settings.
|
|
1084
|
+
|
|
1085
|
+
**Do:** Put several related items in each group.
|
|
1086
|
+
|
|
1087
|
+
```tsx
|
|
1088
|
+
/**
|
|
1089
|
+
* Do example for "Keep Item Counts Low" on the SidebarMenu page.
|
|
1090
|
+
* Put several related items in each group.
|
|
1091
|
+
* @module
|
|
1092
|
+
*/
|
|
1093
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1094
|
+
import { Bank, Globe, Key, Wallet } from '@tempoxyz/ds/icons'
|
|
1095
|
+
|
|
1096
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1097
|
+
export function Demo() {
|
|
1098
|
+
return (
|
|
1099
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.column()}>
|
|
1100
|
+
<SidebarMenu.Group>
|
|
1101
|
+
<SidebarMenu.GroupLabel>Payments</SidebarMenu.GroupLabel>
|
|
1102
|
+
<SidebarMenu.Item href="#">
|
|
1103
|
+
<Wallet />
|
|
1104
|
+
Wallets
|
|
1105
|
+
</SidebarMenu.Item>
|
|
1106
|
+
<SidebarMenu.Item href="#">
|
|
1107
|
+
<Bank />
|
|
1108
|
+
Payouts
|
|
1109
|
+
</SidebarMenu.Item>
|
|
1110
|
+
</SidebarMenu.Group>
|
|
1111
|
+
<SidebarMenu.Group>
|
|
1112
|
+
<SidebarMenu.GroupLabel>Developers</SidebarMenu.GroupLabel>
|
|
1113
|
+
<SidebarMenu.Item href="#">
|
|
1114
|
+
<Key />
|
|
1115
|
+
API keys
|
|
1116
|
+
</SidebarMenu.Item>
|
|
1117
|
+
<SidebarMenu.Item href="#">
|
|
1118
|
+
<Globe />
|
|
1119
|
+
Webhooks
|
|
1120
|
+
</SidebarMenu.Item>
|
|
1121
|
+
</SidebarMenu.Group>
|
|
1122
|
+
</SidebarMenu.Root>
|
|
1123
|
+
)
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
namespace styles {
|
|
1127
|
+
export const column = style({ width: '15rem !custom' })
|
|
1128
|
+
}
|
|
1129
|
+
```
|
|
1130
|
+
|
|
1131
|
+
**Don't:** Give each item a group of its own.
|
|
1132
|
+
|
|
1133
|
+
```tsx
|
|
1134
|
+
/**
|
|
1135
|
+
* Don't example for "Keep Item Counts Low" on the SidebarMenu page.
|
|
1136
|
+
* Don't give each item a group of its own.
|
|
1137
|
+
* @module
|
|
1138
|
+
*/
|
|
1139
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1140
|
+
import { Bank, Globe, Key, Wallet } from '@tempoxyz/ds/icons'
|
|
1141
|
+
|
|
1142
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1143
|
+
export function Demo() {
|
|
1144
|
+
return (
|
|
1145
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.column()}>
|
|
1146
|
+
<SidebarMenu.Group>
|
|
1147
|
+
<SidebarMenu.GroupLabel>Treasury</SidebarMenu.GroupLabel>
|
|
1148
|
+
<SidebarMenu.Item href="#">
|
|
1149
|
+
<Wallet />
|
|
1150
|
+
Wallets
|
|
1151
|
+
</SidebarMenu.Item>
|
|
1152
|
+
</SidebarMenu.Group>
|
|
1153
|
+
<SidebarMenu.Group>
|
|
1154
|
+
<SidebarMenu.GroupLabel>Payments</SidebarMenu.GroupLabel>
|
|
1155
|
+
<SidebarMenu.Item href="#">
|
|
1156
|
+
<Bank />
|
|
1157
|
+
Payouts
|
|
1158
|
+
</SidebarMenu.Item>
|
|
1159
|
+
</SidebarMenu.Group>
|
|
1160
|
+
<SidebarMenu.Group>
|
|
1161
|
+
<SidebarMenu.GroupLabel>Access</SidebarMenu.GroupLabel>
|
|
1162
|
+
<SidebarMenu.Item href="#">
|
|
1163
|
+
<Key />
|
|
1164
|
+
API keys
|
|
1165
|
+
</SidebarMenu.Item>
|
|
1166
|
+
</SidebarMenu.Group>
|
|
1167
|
+
<SidebarMenu.Group>
|
|
1168
|
+
<SidebarMenu.GroupLabel>Integrations</SidebarMenu.GroupLabel>
|
|
1169
|
+
<SidebarMenu.Item href="#">
|
|
1170
|
+
<Globe />
|
|
1171
|
+
Webhooks
|
|
1172
|
+
</SidebarMenu.Item>
|
|
1173
|
+
</SidebarMenu.Group>
|
|
1174
|
+
</SidebarMenu.Root>
|
|
1175
|
+
)
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
namespace styles {
|
|
1179
|
+
export const column = style({ width: '15rem !custom' })
|
|
1180
|
+
}
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
#### Nest One Level at Most
|
|
1184
|
+
|
|
1185
|
+
A `SidebarMenu.Submenu` collapses related pages under a trigger. Open the submenu that holds the current page with `defaultOpen` or a controlled `open`. The trigger only expands and collapses, so give its pages their own items.
|
|
1186
|
+
|
|
1187
|
+
**Do:** Nest one level, such as Incoming and Outgoing under Transactions, without icons.
|
|
1188
|
+
|
|
1189
|
+
```tsx
|
|
1190
|
+
/**
|
|
1191
|
+
* Do example for "Nest One Level at Most" on the SidebarMenu page.
|
|
1192
|
+
* Nest one level, such as Incoming and Outgoing under Transactions, without icons.
|
|
1193
|
+
* @module
|
|
1194
|
+
*/
|
|
1195
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1196
|
+
import { Grid, Receipt } from '@tempoxyz/ds/icons'
|
|
1197
|
+
|
|
1198
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1199
|
+
export function Demo() {
|
|
1200
|
+
return (
|
|
1201
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.column()}>
|
|
1202
|
+
<SidebarMenu.Item href="#">
|
|
1203
|
+
<Grid />
|
|
1204
|
+
Home
|
|
1205
|
+
</SidebarMenu.Item>
|
|
1206
|
+
<SidebarMenu.Submenu defaultOpen>
|
|
1207
|
+
<SidebarMenu.SubmenuTrigger>
|
|
1208
|
+
<Receipt />
|
|
1209
|
+
Transactions
|
|
1210
|
+
</SidebarMenu.SubmenuTrigger>
|
|
1211
|
+
<SidebarMenu.SubmenuPanel>
|
|
1212
|
+
<SidebarMenu.Item active href="#">
|
|
1213
|
+
Incoming
|
|
1214
|
+
</SidebarMenu.Item>
|
|
1215
|
+
<SidebarMenu.Item href="#">Outgoing</SidebarMenu.Item>
|
|
1216
|
+
</SidebarMenu.SubmenuPanel>
|
|
1217
|
+
</SidebarMenu.Submenu>
|
|
1218
|
+
</SidebarMenu.Root>
|
|
1219
|
+
)
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
namespace styles {
|
|
1223
|
+
export const column = style({ width: '15rem !custom' })
|
|
1224
|
+
}
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
**Don't:** Nest a submenu inside another submenu.
|
|
1228
|
+
|
|
1229
|
+
```tsx
|
|
1230
|
+
/**
|
|
1231
|
+
* Don't example for "Nest One Level at Most" on the SidebarMenu page.
|
|
1232
|
+
* Don't nest a submenu inside another submenu.
|
|
1233
|
+
* @module
|
|
1234
|
+
*/
|
|
1235
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1236
|
+
import { Grid, Receipt } from '@tempoxyz/ds/icons'
|
|
1237
|
+
|
|
1238
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1239
|
+
export function Demo() {
|
|
1240
|
+
return (
|
|
1241
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.column()}>
|
|
1242
|
+
<SidebarMenu.Item href="#">
|
|
1243
|
+
<Grid />
|
|
1244
|
+
Home
|
|
1245
|
+
</SidebarMenu.Item>
|
|
1246
|
+
<SidebarMenu.Submenu defaultOpen>
|
|
1247
|
+
<SidebarMenu.SubmenuTrigger>
|
|
1248
|
+
<Receipt />
|
|
1249
|
+
Transactions
|
|
1250
|
+
</SidebarMenu.SubmenuTrigger>
|
|
1251
|
+
<SidebarMenu.SubmenuPanel>
|
|
1252
|
+
<SidebarMenu.Submenu defaultOpen>
|
|
1253
|
+
<SidebarMenu.SubmenuTrigger>Incoming</SidebarMenu.SubmenuTrigger>
|
|
1254
|
+
<SidebarMenu.SubmenuPanel>
|
|
1255
|
+
<SidebarMenu.Item active href="#">
|
|
1256
|
+
Pending
|
|
1257
|
+
</SidebarMenu.Item>
|
|
1258
|
+
<SidebarMenu.Item href="#">Settled</SidebarMenu.Item>
|
|
1259
|
+
</SidebarMenu.SubmenuPanel>
|
|
1260
|
+
</SidebarMenu.Submenu>
|
|
1261
|
+
<SidebarMenu.Item href="#">Outgoing</SidebarMenu.Item>
|
|
1262
|
+
</SidebarMenu.SubmenuPanel>
|
|
1263
|
+
</SidebarMenu.Submenu>
|
|
1264
|
+
</SidebarMenu.Root>
|
|
1265
|
+
)
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
namespace styles {
|
|
1269
|
+
export const column = style({ width: '15rem !custom' })
|
|
1270
|
+
}
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
#### Keep Labels on One Line
|
|
1274
|
+
|
|
1275
|
+
Items do not wrap. Give every top-level item an icon, or none of them. Mark a link that leaves the product, such as API docs, with a trailing `ExternalLink` icon.
|
|
1276
|
+
|
|
1277
|
+
**Do:** Shorten each label to the page's name.
|
|
1278
|
+
|
|
1279
|
+
```tsx
|
|
1280
|
+
/**
|
|
1281
|
+
* Do example for "Keep Labels on One Line" on the SidebarMenu page.
|
|
1282
|
+
* Shorten each label to the page's name.
|
|
1283
|
+
* @module
|
|
1284
|
+
*/
|
|
1285
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1286
|
+
import { Globe, Grid, Key } from '@tempoxyz/ds/icons'
|
|
1287
|
+
|
|
1288
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1289
|
+
export function Demo() {
|
|
1290
|
+
return (
|
|
1291
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.column()}>
|
|
1292
|
+
<SidebarMenu.Item href="#">
|
|
1293
|
+
<Grid />
|
|
1294
|
+
Home
|
|
1295
|
+
</SidebarMenu.Item>
|
|
1296
|
+
<SidebarMenu.Item active href="#">
|
|
1297
|
+
<Key />
|
|
1298
|
+
API keys
|
|
1299
|
+
</SidebarMenu.Item>
|
|
1300
|
+
<SidebarMenu.Item href="#">
|
|
1301
|
+
<Globe />
|
|
1302
|
+
Webhooks
|
|
1303
|
+
</SidebarMenu.Item>
|
|
1304
|
+
</SidebarMenu.Root>
|
|
1305
|
+
)
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
namespace styles {
|
|
1309
|
+
export const column = style({ width: '15rem !custom' })
|
|
1310
|
+
}
|
|
1311
|
+
```
|
|
1312
|
+
|
|
1313
|
+
**Don't:** Write labels longer than the sidebar is wide.
|
|
1314
|
+
|
|
1315
|
+
```tsx
|
|
1316
|
+
/**
|
|
1317
|
+
* Don't example for "Keep Labels on One Line" on the SidebarMenu page.
|
|
1318
|
+
* Don't write labels longer than the sidebar is wide.
|
|
1319
|
+
* @module
|
|
1320
|
+
*/
|
|
1321
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1322
|
+
import { Globe, Grid, Key } from '@tempoxyz/ds/icons'
|
|
1323
|
+
|
|
1324
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1325
|
+
export function Demo() {
|
|
1326
|
+
return (
|
|
1327
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.column()}>
|
|
1328
|
+
<SidebarMenu.Item href="#">
|
|
1329
|
+
<Grid />
|
|
1330
|
+
Home
|
|
1331
|
+
</SidebarMenu.Item>
|
|
1332
|
+
<SidebarMenu.Item active href="#">
|
|
1333
|
+
<Key />
|
|
1334
|
+
Manage your API keys and secrets
|
|
1335
|
+
</SidebarMenu.Item>
|
|
1336
|
+
<SidebarMenu.Item href="#">
|
|
1337
|
+
<Globe />
|
|
1338
|
+
Webhooks
|
|
1339
|
+
</SidebarMenu.Item>
|
|
1340
|
+
</SidebarMenu.Root>
|
|
1341
|
+
)
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
namespace styles {
|
|
1345
|
+
export const column = style({ width: '15rem !custom' })
|
|
1346
|
+
}
|
|
1347
|
+
```
|
|
1348
|
+
|
|
1349
|
+
#### Put Workspace and Account Controls at the Edges
|
|
1350
|
+
|
|
1351
|
+
In an [AppShell](layout.md#appshell), put the project switcher in `AppShell.SidebarHeader` and the account menu in a `SidebarMenu.Account` at the end of `AppShell.SidebarFooter`. Both open a [Menu](overlays.md#menu): trigger the account menu with a `SidebarMenu.AccountRow`, and render the switcher with `render={<button type="button" />}`.
|
|
1352
|
+
|
|
1353
|
+
**Do:** Pin the project switcher to the top and the account to the bottom.
|
|
1354
|
+
|
|
1355
|
+
```tsx
|
|
1356
|
+
/**
|
|
1357
|
+
* Do example for "Put Workspace and Account Controls at the Edges" on the SidebarMenu page.
|
|
1358
|
+
* Pin the project switcher to the top and the account to the bottom.
|
|
1359
|
+
* @module
|
|
1360
|
+
*/
|
|
1361
|
+
import { Avatar, SidebarMenu, style } from '@tempoxyz/ds'
|
|
1362
|
+
import { ChevronDown, Globe, Grid, Key, Store } from '@tempoxyz/ds/icons'
|
|
1363
|
+
|
|
1364
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1365
|
+
export function Demo() {
|
|
1366
|
+
return (
|
|
1367
|
+
<div {...styles.sidebar()}>
|
|
1368
|
+
<SidebarMenu.Root aria-label="Project" size="small">
|
|
1369
|
+
<SidebarMenu.Item render={<button type="button" />}>
|
|
1370
|
+
<Store />
|
|
1371
|
+
Checkout
|
|
1372
|
+
<ChevronDown {...styles.chevron()} />
|
|
1373
|
+
</SidebarMenu.Item>
|
|
1374
|
+
</SidebarMenu.Root>
|
|
1375
|
+
<SidebarMenu.Root aria-label="Console" size="small" {...styles.body()}>
|
|
1376
|
+
<SidebarMenu.Item active href="#">
|
|
1377
|
+
<Grid />
|
|
1378
|
+
Home
|
|
1379
|
+
</SidebarMenu.Item>
|
|
1380
|
+
<SidebarMenu.Item href="#">
|
|
1381
|
+
<Key />
|
|
1382
|
+
API keys
|
|
1383
|
+
</SidebarMenu.Item>
|
|
1384
|
+
<SidebarMenu.Item href="#">
|
|
1385
|
+
<Globe />
|
|
1386
|
+
Webhooks
|
|
1387
|
+
</SidebarMenu.Item>
|
|
1388
|
+
</SidebarMenu.Root>
|
|
1389
|
+
<SidebarMenu.Account>
|
|
1390
|
+
<SidebarMenu.AccountRow description="alice@tempo.xyz" label="Alice Chen">
|
|
1391
|
+
<Avatar size="32">
|
|
1392
|
+
<Avatar.Fallback>AC</Avatar.Fallback>
|
|
1393
|
+
</Avatar>
|
|
1394
|
+
</SidebarMenu.AccountRow>
|
|
1395
|
+
</SidebarMenu.Account>
|
|
1396
|
+
</div>
|
|
1397
|
+
)
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
namespace styles {
|
|
1401
|
+
export const body = style({ flex: '1 !custom' })
|
|
1402
|
+
|
|
1403
|
+
export const chevron = style({ marginInlineStart: 'auto !custom' })
|
|
1404
|
+
|
|
1405
|
+
export const sidebar = style({
|
|
1406
|
+
display: 'flex',
|
|
1407
|
+
flexDirection: 'column',
|
|
1408
|
+
height: '20rem !custom',
|
|
1409
|
+
rowGap: '12',
|
|
1410
|
+
width: '15rem !custom',
|
|
1411
|
+
})
|
|
1412
|
+
}
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
**Don't:** List the switcher and the account among the pages.
|
|
1416
|
+
|
|
1417
|
+
```tsx
|
|
1418
|
+
/**
|
|
1419
|
+
* Don't example for "Put Workspace and Account Controls at the Edges" on the SidebarMenu page.
|
|
1420
|
+
* Don't list the switcher and the account among the pages.
|
|
1421
|
+
* @module
|
|
1422
|
+
*/
|
|
1423
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1424
|
+
import { ChevronDown, Globe, Grid, Key, Store, UserCircle } from '@tempoxyz/ds/icons'
|
|
1425
|
+
|
|
1426
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1427
|
+
export function Demo() {
|
|
1428
|
+
return (
|
|
1429
|
+
<div {...styles.sidebar()}>
|
|
1430
|
+
<SidebarMenu.Root aria-label="Console" size="small">
|
|
1431
|
+
<SidebarMenu.Item active href="#">
|
|
1432
|
+
<Grid />
|
|
1433
|
+
Home
|
|
1434
|
+
</SidebarMenu.Item>
|
|
1435
|
+
<SidebarMenu.Item href="#">
|
|
1436
|
+
<Key />
|
|
1437
|
+
API keys
|
|
1438
|
+
</SidebarMenu.Item>
|
|
1439
|
+
<SidebarMenu.Item href="#">
|
|
1440
|
+
<Globe />
|
|
1441
|
+
Webhooks
|
|
1442
|
+
</SidebarMenu.Item>
|
|
1443
|
+
</SidebarMenu.Root>
|
|
1444
|
+
<SidebarMenu.Root aria-label="Project" size="small">
|
|
1445
|
+
<SidebarMenu.Item render={<button type="button" />}>
|
|
1446
|
+
<Store />
|
|
1447
|
+
Checkout
|
|
1448
|
+
<ChevronDown {...styles.chevron()} />
|
|
1449
|
+
</SidebarMenu.Item>
|
|
1450
|
+
</SidebarMenu.Root>
|
|
1451
|
+
<SidebarMenu.Root aria-label="Account" size="small">
|
|
1452
|
+
<SidebarMenu.Item render={<button type="button" />}>
|
|
1453
|
+
<UserCircle />
|
|
1454
|
+
Alice Chen
|
|
1455
|
+
</SidebarMenu.Item>
|
|
1456
|
+
</SidebarMenu.Root>
|
|
1457
|
+
</div>
|
|
1458
|
+
)
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
namespace styles {
|
|
1462
|
+
export const chevron = style({ marginInlineStart: 'auto !custom' })
|
|
1463
|
+
|
|
1464
|
+
export const sidebar = style({
|
|
1465
|
+
display: 'flex',
|
|
1466
|
+
flexDirection: 'column',
|
|
1467
|
+
height: '20rem !custom',
|
|
1468
|
+
rowGap: '12',
|
|
1469
|
+
width: '15rem !custom',
|
|
1470
|
+
})
|
|
1471
|
+
}
|
|
1472
|
+
```
|
|
1473
|
+
|
|
1474
|
+
### Content
|
|
1475
|
+
|
|
1476
|
+
* **Items:** Match the page's `AppShell.Title`, such as API keys. Use one or two nouns, without verbs such as Manage.
|
|
1477
|
+
* **Group labels:** Short nouns, such as Payments, not repeated in the items below.
|
|
1478
|
+
* **Account row:** The person's name over their email or wallet address, such as Piril Akay over <piril@tempo.xyz>.
|
|
1479
|
+
* **Logo row:** The product or wallet name over its address, such as Tempo Wallet over 0xc721…s9dk.
|
|
1480
|
+
|
|
1481
|
+
### Accessibility
|
|
1482
|
+
|
|
1483
|
+
SidebarMenu renders a navigation landmark of links, with disclosure submenus and no menu roles. It follows the [WAI-ARIA Authoring Practices disclosure navigation example](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/).
|
|
1484
|
+
|
|
1485
|
+
#### Semantics
|
|
1486
|
+
|
|
1487
|
+
* **SidebarMenu.Root (nav):** A landmark named "Main" unless you pass `aria-label`.
|
|
1488
|
+
* **SidebarMenu.Item (aria-current):** Each item is a link. The active item is marked as the current page.
|
|
1489
|
+
* **SidebarMenu.Group (group):** Named by its group label.
|
|
1490
|
+
* **SidebarMenu.SubmenuTrigger (aria-expanded):** A button that reports whether its submenu is open. Enter and Space toggle it.
|
|
1491
|
+
* **SidebarMenu.SubmenuPanel:** Collapsed links leave the tab order. Under reduced motion, it fades instead of growing.
|
|
1492
|
+
* **SidebarMenu.AccountRow (button):** A button named by its two lines. As a menu trigger, it reports whether the menu is open.
|
|
1493
|
+
* **SidebarMenu.Account (div):** A plain frame. Its divider is decorative, so it announces no separator before the row.
|
|
1494
|
+
* **SidebarMenu.Logo (aria-hidden):** Hidden with the rest of the row's media. The row's label names the product or wallet.
|
|
1495
|
+
|
|
1496
|
+
#### Keyboard
|
|
1497
|
+
|
|
1498
|
+
* **Move Through Items (Tab):** Moves focus through items and submenu triggers.
|
|
1499
|
+
* **Follow or Toggle (Enter):** Follows a focused link or toggles a submenu.
|
|
1500
|
+
* **Toggle a Submenu (Space):** Toggles the focused submenu.
|
|
1501
|
+
|
|
1502
|
+
Arrow keys do not move focus. Links in a landmark use the Tab order.
|
|
1503
|
+
|
|
1504
|
+
#### Focus
|
|
1505
|
+
|
|
1506
|
+
Focus stays on a submenu trigger when it toggles. After it opens, the next Tab moves to its first link.
|
|
1507
|
+
|
|
1508
|
+
#### Your Responsibilities
|
|
1509
|
+
|
|
1510
|
+
* **Name Each Landmark (SC 2.4.1):** If a page has several navigation landmarks, give each a distinct `aria-label`.
|
|
1511
|
+
* **Mark One Active Item (active):** Mark only the current page. When it is nested, keep its submenu open.
|
|
1512
|
+
* **Name Unlabelled Groups (aria-label):** Name a group that has no visible label.
|
|
1513
|
+
* **Keep a Consistent Order (SC 3.2.3):** Keep the item order the same on every page.
|
|
1514
|
+
* **Name Pages in Text (aria-hidden):** Icons are hidden from assistive technology. The text label must name the page.
|
|
1515
|
+
|
|
1516
|
+
### Related
|
|
1517
|
+
|
|
1518
|
+
[AppShell](layout.md#appshell)
|
|
1519
|
+
|
|
1520
|
+
Use for the frame that holds the sidebar.
|
|
1521
|
+
|
|
1522
|
+
[Menu](overlays.md#menu)
|
|
1523
|
+
|
|
1524
|
+
Use for lists of actions.
|
|
1525
|
+
|
|
1526
|
+
[Tabs](#tabs)
|
|
1527
|
+
|
|
1528
|
+
Use for views within one page.
|
|
1529
|
+
|
|
1530
|
+
[Navigation](../patterns.md#navigation)
|
|
1531
|
+
|
|
1532
|
+
Covers choosing between navigation components.
|
|
1533
|
+
|
|
1534
|
+
### Examples
|
|
1535
|
+
|
|
1536
|
+
#### Basic
|
|
1537
|
+
|
|
1538
|
+
```tsx
|
|
1539
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1540
|
+
import { Key, Settings, Users } from '@tempoxyz/ds/icons'
|
|
1541
|
+
|
|
1542
|
+
export function Demo() {
|
|
1543
|
+
return (
|
|
1544
|
+
<SidebarMenu.Root aria-label="Console" {...styles.column()}>
|
|
1545
|
+
<SidebarMenu.Group>
|
|
1546
|
+
<SidebarMenu.GroupLabel>Project</SidebarMenu.GroupLabel>
|
|
1547
|
+
<SidebarMenu.Item href="#">
|
|
1548
|
+
<Key />
|
|
1549
|
+
API Keys
|
|
1550
|
+
</SidebarMenu.Item>
|
|
1551
|
+
</SidebarMenu.Group>
|
|
1552
|
+
<SidebarMenu.Group>
|
|
1553
|
+
<SidebarMenu.GroupLabel>Organization</SidebarMenu.GroupLabel>
|
|
1554
|
+
<SidebarMenu.Item active href="#">
|
|
1555
|
+
<Users />
|
|
1556
|
+
Team
|
|
1557
|
+
</SidebarMenu.Item>
|
|
1558
|
+
<SidebarMenu.Item render={<button type="button" />}>
|
|
1559
|
+
<Settings />
|
|
1560
|
+
Settings
|
|
1561
|
+
</SidebarMenu.Item>
|
|
1562
|
+
</SidebarMenu.Group>
|
|
1563
|
+
</SidebarMenu.Root>
|
|
1564
|
+
)
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
namespace styles {
|
|
1568
|
+
export const column = style({ width: '15rem !custom' })
|
|
1569
|
+
}
|
|
1570
|
+
```
|
|
1571
|
+
|
|
1572
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SidebarMenu/Basic.tsx)
|
|
1573
|
+
|
|
1574
|
+
#### Size
|
|
1575
|
+
|
|
1576
|
+
Set `size` on `SidebarMenu.Root` to `small`, `medium` (default), or `large`.
|
|
1577
|
+
|
|
1578
|
+
```tsx
|
|
1579
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1580
|
+
import { Coins, CreditCard, Home, ShieldCheck, Trend } from '@tempoxyz/ds/icons'
|
|
1581
|
+
|
|
1582
|
+
export function Demo() {
|
|
1583
|
+
return (
|
|
1584
|
+
<div {...styles.row()}>
|
|
1585
|
+
{(['small', 'medium', 'large'] as const).map((size) => (
|
|
1586
|
+
<SidebarMenu.Root aria-label={`Wallet ${size}`} key={size} size={size} {...styles.column()}>
|
|
1587
|
+
<SidebarMenu.Item active href="#">
|
|
1588
|
+
<Home />
|
|
1589
|
+
Home
|
|
1590
|
+
</SidebarMenu.Item>
|
|
1591
|
+
<SidebarMenu.Item href="#">
|
|
1592
|
+
<Coins />
|
|
1593
|
+
Balances
|
|
1594
|
+
</SidebarMenu.Item>
|
|
1595
|
+
<SidebarMenu.Item href="#">
|
|
1596
|
+
<Trend />
|
|
1597
|
+
Activity
|
|
1598
|
+
</SidebarMenu.Item>
|
|
1599
|
+
<SidebarMenu.Item href="#">
|
|
1600
|
+
<CreditCard />
|
|
1601
|
+
Credits
|
|
1602
|
+
</SidebarMenu.Item>
|
|
1603
|
+
<SidebarMenu.Item href="#">
|
|
1604
|
+
<ShieldCheck />
|
|
1605
|
+
Authorized Apps
|
|
1606
|
+
</SidebarMenu.Item>
|
|
1607
|
+
</SidebarMenu.Root>
|
|
1608
|
+
))}
|
|
1609
|
+
</div>
|
|
1610
|
+
)
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
namespace styles {
|
|
1614
|
+
export const column = style({ width: '15rem !custom' })
|
|
1615
|
+
|
|
1616
|
+
export const row = style({ display: 'flex', flexWrap: 'wrap', gap: '32' })
|
|
1617
|
+
}
|
|
1618
|
+
```
|
|
1619
|
+
|
|
1620
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SidebarMenu/Size.tsx)
|
|
1621
|
+
|
|
1622
|
+
#### Submenu
|
|
1623
|
+
|
|
1624
|
+
Nest items in a `SidebarMenu.Submenu`. Set `defaultOpen` to expand it on first render.
|
|
1625
|
+
|
|
1626
|
+
```tsx
|
|
1627
|
+
import { SidebarMenu, style } from '@tempoxyz/ds'
|
|
1628
|
+
import {
|
|
1629
|
+
Bank,
|
|
1630
|
+
Bell,
|
|
1631
|
+
ChartBar,
|
|
1632
|
+
Document,
|
|
1633
|
+
GasFee,
|
|
1634
|
+
Globe,
|
|
1635
|
+
Grid,
|
|
1636
|
+
Key,
|
|
1637
|
+
Link,
|
|
1638
|
+
Lock,
|
|
1639
|
+
Mail,
|
|
1640
|
+
Receipt,
|
|
1641
|
+
Users,
|
|
1642
|
+
Wallet,
|
|
1643
|
+
} from '@tempoxyz/ds/icons'
|
|
1644
|
+
|
|
1645
|
+
export function Demo() {
|
|
1646
|
+
return (
|
|
1647
|
+
<SidebarMenu.Root aria-label="Dashboard" size="small" {...styles.column()}>
|
|
1648
|
+
<SidebarMenu.Item active href="#">
|
|
1649
|
+
<Grid />
|
|
1650
|
+
Overview
|
|
1651
|
+
</SidebarMenu.Item>
|
|
1652
|
+
<SidebarMenu.Item href="#">
|
|
1653
|
+
<ChartBar />
|
|
1654
|
+
Analytics
|
|
1655
|
+
</SidebarMenu.Item>
|
|
1656
|
+
<SidebarMenu.Submenu defaultOpen>
|
|
1657
|
+
<SidebarMenu.SubmenuTrigger>
|
|
1658
|
+
<Receipt />
|
|
1659
|
+
Transactions
|
|
1660
|
+
</SidebarMenu.SubmenuTrigger>
|
|
1661
|
+
<SidebarMenu.SubmenuPanel>
|
|
1662
|
+
<SidebarMenu.Item href="#">Incoming</SidebarMenu.Item>
|
|
1663
|
+
<SidebarMenu.Item href="#">Outgoing</SidebarMenu.Item>
|
|
1664
|
+
<SidebarMenu.Item href="#">Refunds</SidebarMenu.Item>
|
|
1665
|
+
</SidebarMenu.SubmenuPanel>
|
|
1666
|
+
</SidebarMenu.Submenu>
|
|
1667
|
+
<SidebarMenu.Group>
|
|
1668
|
+
<SidebarMenu.GroupLabel>Payments</SidebarMenu.GroupLabel>
|
|
1669
|
+
<SidebarMenu.Item href="#">
|
|
1670
|
+
<Wallet />
|
|
1671
|
+
Wallets
|
|
1672
|
+
</SidebarMenu.Item>
|
|
1673
|
+
<SidebarMenu.Item href="#">
|
|
1674
|
+
<Bank />
|
|
1675
|
+
Payouts
|
|
1676
|
+
</SidebarMenu.Item>
|
|
1677
|
+
<SidebarMenu.Item href="#">
|
|
1678
|
+
<GasFee />
|
|
1679
|
+
Fee payer
|
|
1680
|
+
</SidebarMenu.Item>
|
|
1681
|
+
<SidebarMenu.Item href="#">
|
|
1682
|
+
<Link />
|
|
1683
|
+
Payment links
|
|
1684
|
+
</SidebarMenu.Item>
|
|
1685
|
+
</SidebarMenu.Group>
|
|
1686
|
+
<SidebarMenu.Group>
|
|
1687
|
+
<SidebarMenu.GroupLabel>Developers</SidebarMenu.GroupLabel>
|
|
1688
|
+
<SidebarMenu.Item href="#">
|
|
1689
|
+
<Key />
|
|
1690
|
+
API keys
|
|
1691
|
+
</SidebarMenu.Item>
|
|
1692
|
+
<SidebarMenu.Item href="#">
|
|
1693
|
+
<Globe />
|
|
1694
|
+
Webhooks
|
|
1695
|
+
</SidebarMenu.Item>
|
|
1696
|
+
<SidebarMenu.Item href="#">
|
|
1697
|
+
<Document />
|
|
1698
|
+
Docs
|
|
1699
|
+
</SidebarMenu.Item>
|
|
1700
|
+
</SidebarMenu.Group>
|
|
1701
|
+
<SidebarMenu.Group>
|
|
1702
|
+
<SidebarMenu.GroupLabel>Settings</SidebarMenu.GroupLabel>
|
|
1703
|
+
<SidebarMenu.Item href="#">
|
|
1704
|
+
<Users />
|
|
1705
|
+
Team
|
|
1706
|
+
</SidebarMenu.Item>
|
|
1707
|
+
<SidebarMenu.Item href="#">
|
|
1708
|
+
<Lock />
|
|
1709
|
+
Security
|
|
1710
|
+
</SidebarMenu.Item>
|
|
1711
|
+
<SidebarMenu.Item href="#">
|
|
1712
|
+
<Bell />
|
|
1713
|
+
Notifications
|
|
1714
|
+
</SidebarMenu.Item>
|
|
1715
|
+
<SidebarMenu.Item href="#">
|
|
1716
|
+
<Mail />
|
|
1717
|
+
Emails
|
|
1718
|
+
</SidebarMenu.Item>
|
|
1719
|
+
</SidebarMenu.Group>
|
|
1720
|
+
</SidebarMenu.Root>
|
|
1721
|
+
)
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
namespace styles {
|
|
1725
|
+
export const column = style({ width: '15rem !custom' })
|
|
1726
|
+
}
|
|
1727
|
+
```
|
|
1728
|
+
|
|
1729
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SidebarMenu/Submenu.tsx)
|
|
1730
|
+
|
|
1731
|
+
#### Account Row
|
|
1732
|
+
|
|
1733
|
+
Render a `SidebarMenu.AccountRow` in a `SidebarMenu.Account`, which draws the divider above it at the bottom of the sidebar. Pass the row to `Menu.Trigger` through `render` to open the account menu. The row ends in a chevron only while it opens a menu.
|
|
1734
|
+
|
|
1735
|
+
```tsx
|
|
1736
|
+
/** Shows the account row at the bottom of a sidebar, under its divider, opening the account menu. @module */
|
|
1737
|
+
import { Avatar, Menu, SidebarMenu, style } from '@tempoxyz/ds'
|
|
1738
|
+
import { Copy, Help, LogOut, User } from '@tempoxyz/ds/icons'
|
|
1739
|
+
|
|
1740
|
+
/** Renders the help link, then the account row as the trigger of the account menu. */
|
|
1741
|
+
export function Demo() {
|
|
1742
|
+
return (
|
|
1743
|
+
<div {...styles.column()}>
|
|
1744
|
+
<SidebarMenu.Root aria-label="Support">
|
|
1745
|
+
<SidebarMenu.Item href="#">
|
|
1746
|
+
<Help />
|
|
1747
|
+
Help
|
|
1748
|
+
</SidebarMenu.Item>
|
|
1749
|
+
</SidebarMenu.Root>
|
|
1750
|
+
<SidebarMenu.Account>
|
|
1751
|
+
<Menu.Root>
|
|
1752
|
+
<Menu.Trigger
|
|
1753
|
+
render={<SidebarMenu.AccountRow description="piril@tempo.xyz" label="Piril Akay" />}
|
|
1754
|
+
>
|
|
1755
|
+
<Avatar size="32">
|
|
1756
|
+
<Avatar.Fallback>PA</Avatar.Fallback>
|
|
1757
|
+
</Avatar>
|
|
1758
|
+
</Menu.Trigger>
|
|
1759
|
+
<Menu.Popup side="top">
|
|
1760
|
+
<Menu.Item>
|
|
1761
|
+
<User />
|
|
1762
|
+
Account details
|
|
1763
|
+
</Menu.Item>
|
|
1764
|
+
<Menu.Item>
|
|
1765
|
+
<Copy />
|
|
1766
|
+
Copy address
|
|
1767
|
+
</Menu.Item>
|
|
1768
|
+
<Menu.Separator />
|
|
1769
|
+
<Menu.Item intent="negative">
|
|
1770
|
+
<LogOut />
|
|
1771
|
+
Sign out
|
|
1772
|
+
</Menu.Item>
|
|
1773
|
+
</Menu.Popup>
|
|
1774
|
+
</Menu.Root>
|
|
1775
|
+
</SidebarMenu.Account>
|
|
1776
|
+
</div>
|
|
1777
|
+
)
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
namespace styles {
|
|
1781
|
+
export const column = style({
|
|
1782
|
+
display: 'flex',
|
|
1783
|
+
flexDirection: 'column',
|
|
1784
|
+
rowGap: '8',
|
|
1785
|
+
width: '15rem !custom',
|
|
1786
|
+
})
|
|
1787
|
+
}
|
|
1788
|
+
```
|
|
1789
|
+
|
|
1790
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SidebarMenu/AccountRow.tsx)
|
|
1791
|
+
|
|
1792
|
+
#### Logo
|
|
1793
|
+
|
|
1794
|
+
Pass a `SidebarMenu.Logo` to an account row that names a product or wallet, such as the wallet switcher at the top of the sidebar.
|
|
1795
|
+
|
|
1796
|
+
```tsx
|
|
1797
|
+
/** Shows the wallet switcher at the top of a sidebar, with the Tempo mark in a logo tile. @module */
|
|
1798
|
+
import { Menu, SidebarMenu, style, TempoLogo } from '@tempoxyz/ds'
|
|
1799
|
+
import { Plus, Wallet } from '@tempoxyz/ds/icons'
|
|
1800
|
+
|
|
1801
|
+
/** Renders the wallet row, with the logo tile as its media, as the trigger of the wallet menu. */
|
|
1802
|
+
export function Demo() {
|
|
1803
|
+
return (
|
|
1804
|
+
<div {...styles.column()}>
|
|
1805
|
+
<Menu.Root>
|
|
1806
|
+
<Menu.Trigger
|
|
1807
|
+
render={<SidebarMenu.AccountRow description="0xc721…s9dk" label="Tempo Wallet" />}
|
|
1808
|
+
>
|
|
1809
|
+
<SidebarMenu.Logo>
|
|
1810
|
+
<TempoLogo type="mark" />
|
|
1811
|
+
</SidebarMenu.Logo>
|
|
1812
|
+
</Menu.Trigger>
|
|
1813
|
+
<Menu.Popup>
|
|
1814
|
+
<Menu.Item>
|
|
1815
|
+
<Wallet />
|
|
1816
|
+
Savings
|
|
1817
|
+
</Menu.Item>
|
|
1818
|
+
<Menu.Separator />
|
|
1819
|
+
<Menu.Item>
|
|
1820
|
+
<Plus />
|
|
1821
|
+
New wallet
|
|
1822
|
+
</Menu.Item>
|
|
1823
|
+
</Menu.Popup>
|
|
1824
|
+
</Menu.Root>
|
|
1825
|
+
</div>
|
|
1826
|
+
)
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
namespace styles {
|
|
1830
|
+
export const column = style({ width: '15rem !custom' })
|
|
1831
|
+
}
|
|
1832
|
+
```
|
|
1833
|
+
|
|
1834
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SidebarMenu/Logo.tsx)
|
|
1835
|
+
|
|
1836
|
+
## Stepper
|
|
1837
|
+
|
|
1838
|
+
Shows progress through a fixed sequence of steps.
|
|
1839
|
+
|
|
1840
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Stepper.tsx)
|
|
1841
|
+
|
|
1842
|
+
Figma: [Controls/Stepper](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-1489) (`Stepper.Root`)
|
|
1843
|
+
|
|
1844
|
+
### Overview
|
|
1845
|
+
|
|
1846
|
+
A stepper renders the steps as a row of 24px segments, 4px apart. Pass `aria-label` to name the flow, such as Account setup.
|
|
1847
|
+
|
|
1848
|
+
### Anatomy
|
|
1849
|
+
|
|
1850
|
+
Import the component and assemble its parts.
|
|
1851
|
+
|
|
1852
|
+
```tsx
|
|
1853
|
+
import { Stepper } from '@tempoxyz/ds'
|
|
1854
|
+
|
|
1855
|
+
<Stepper.Root />
|
|
1856
|
+
```
|
|
1857
|
+
|
|
1858
|
+
### Guidelines
|
|
1859
|
+
|
|
1860
|
+
#### When to Use
|
|
1861
|
+
|
|
1862
|
+
* Show a multi-step flow with a fixed number of steps, such as onboarding (Create passkey, Back up, Add funds) or a send flow (Recipient, Amount, Review).
|
|
1863
|
+
* Split one long setup form into short screens, such as business verification before API key access.
|
|
1864
|
+
|
|
1865
|
+
#### When Not to Use
|
|
1866
|
+
|
|
1867
|
+
* Use [Progress](feedback-and-status.md#progress-1) for measurable work, such as a file upload or a sync to the latest block.
|
|
1868
|
+
* Use [Tabs](#tabs) for sections in any order. A stepper is not interactive, and its segments don't link to steps.
|
|
1869
|
+
* Use [Breadcrumbs](#breadcrumbs) to show where a page sits in the hierarchy.
|
|
1870
|
+
* Use one form, laid out with [Field](forms-and-inputs.md#field-1) and [Fieldset](forms-and-inputs.md#fieldset), when the task fits on one screen.
|
|
1871
|
+
|
|
1872
|
+
#### Keep the Step Count Fixed
|
|
1873
|
+
|
|
1874
|
+
Set `count` once for the whole flow, and aim for three to five steps. Merge short steps before you add segments. If an answer skips a step, keep its segment and move past it.
|
|
1875
|
+
|
|
1876
|
+
**Do:** Keep the same total on every step.
|
|
1877
|
+
|
|
1878
|
+
```tsx
|
|
1879
|
+
/** Do example for "Keep the Step Count Fixed" on the Stepper page: keep the same total on every step. @module */
|
|
1880
|
+
import { Stepper, style } from '@tempoxyz/ds'
|
|
1881
|
+
|
|
1882
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1883
|
+
export function Demo() {
|
|
1884
|
+
return (
|
|
1885
|
+
<div {...styles.flow()}>
|
|
1886
|
+
<div {...styles.screen()}>
|
|
1887
|
+
<Stepper.Root aria-label="Account setup" count={4} value={1} />
|
|
1888
|
+
<span {...styles.step()}>Step 1 of 4</span>
|
|
1889
|
+
</div>
|
|
1890
|
+
<div {...styles.screen()}>
|
|
1891
|
+
<Stepper.Root aria-label="Account setup" count={4} value={2} />
|
|
1892
|
+
<span {...styles.step()}>Step 2 of 4</span>
|
|
1893
|
+
</div>
|
|
1894
|
+
</div>
|
|
1895
|
+
)
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
namespace styles {
|
|
1899
|
+
export const flow = style({
|
|
1900
|
+
display: 'flex',
|
|
1901
|
+
flexDirection: 'column',
|
|
1902
|
+
rowGap: '24',
|
|
1903
|
+
width: '100% !custom',
|
|
1904
|
+
})
|
|
1905
|
+
|
|
1906
|
+
export const screen = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
1907
|
+
|
|
1908
|
+
export const step = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
1909
|
+
}
|
|
1910
|
+
```
|
|
1911
|
+
|
|
1912
|
+
**Don't:** Change the total partway, which makes the progress look wrong.
|
|
1913
|
+
|
|
1914
|
+
```tsx
|
|
1915
|
+
/**
|
|
1916
|
+
* Don't example for "Keep the Step Count Fixed" on the Stepper page.
|
|
1917
|
+
* Don't change the total partway, which makes the progress look wrong.
|
|
1918
|
+
* @module
|
|
1919
|
+
*/
|
|
1920
|
+
import { Stepper, style } from '@tempoxyz/ds'
|
|
1921
|
+
|
|
1922
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1923
|
+
export function Demo() {
|
|
1924
|
+
return (
|
|
1925
|
+
<div {...styles.flow()}>
|
|
1926
|
+
<div {...styles.screen()}>
|
|
1927
|
+
<Stepper.Root aria-label="Account setup" count={3} value={1} />
|
|
1928
|
+
<span {...styles.step()}>Step 1 of 3</span>
|
|
1929
|
+
</div>
|
|
1930
|
+
<div {...styles.screen()}>
|
|
1931
|
+
<Stepper.Root aria-label="Account setup" count={5} value={2} />
|
|
1932
|
+
<span {...styles.step()}>Step 2 of 5</span>
|
|
1933
|
+
</div>
|
|
1934
|
+
</div>
|
|
1935
|
+
)
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
namespace styles {
|
|
1939
|
+
export const flow = style({
|
|
1940
|
+
display: 'flex',
|
|
1941
|
+
flexDirection: 'column',
|
|
1942
|
+
rowGap: '24',
|
|
1943
|
+
width: '100% !custom',
|
|
1944
|
+
})
|
|
1945
|
+
|
|
1946
|
+
export const screen = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
1947
|
+
|
|
1948
|
+
export const step = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
1949
|
+
}
|
|
1950
|
+
```
|
|
1951
|
+
|
|
1952
|
+
#### Label the Current Step in Text
|
|
1953
|
+
|
|
1954
|
+
The segments carry no text. Place a visible step number and a heading above the stepper, such as Step 2 of 3 above Enter amount.
|
|
1955
|
+
|
|
1956
|
+
**Do:** Pair the stepper with the step number and the step's title.
|
|
1957
|
+
|
|
1958
|
+
```tsx
|
|
1959
|
+
/**
|
|
1960
|
+
* Do example for "Label the Current Step in Text" on the Stepper page.
|
|
1961
|
+
* Pair the stepper with the step number and the step's title.
|
|
1962
|
+
* @module
|
|
1963
|
+
*/
|
|
1964
|
+
import { Stepper, style } from '@tempoxyz/ds'
|
|
1965
|
+
|
|
1966
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1967
|
+
export function Demo() {
|
|
1968
|
+
return (
|
|
1969
|
+
<div {...styles.flow()}>
|
|
1970
|
+
<Stepper.Root aria-label="Send payment" count={3} value={2} />
|
|
1971
|
+
<span {...styles.step()}>Step 2 of 3</span>
|
|
1972
|
+
<span {...styles.title()}>Enter amount</span>
|
|
1973
|
+
</div>
|
|
1974
|
+
)
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
namespace styles {
|
|
1978
|
+
export const flow = style({
|
|
1979
|
+
display: 'flex',
|
|
1980
|
+
flexDirection: 'column',
|
|
1981
|
+
rowGap: '8',
|
|
1982
|
+
width: '100% !custom',
|
|
1983
|
+
})
|
|
1984
|
+
|
|
1985
|
+
export const step = style({
|
|
1986
|
+
color: 'content.secondary',
|
|
1987
|
+
marginBlockStart: '8',
|
|
1988
|
+
typography: 'body.b3',
|
|
1989
|
+
})
|
|
1990
|
+
|
|
1991
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
1992
|
+
}
|
|
1993
|
+
```
|
|
1994
|
+
|
|
1995
|
+
**Don't:** Show the segments without any text.
|
|
1996
|
+
|
|
1997
|
+
```tsx
|
|
1998
|
+
/**
|
|
1999
|
+
* Don't example for "Label the Current Step in Text" on the Stepper page.
|
|
2000
|
+
* Don't show the segments without any text.
|
|
2001
|
+
* @module
|
|
2002
|
+
*/
|
|
2003
|
+
import { Stepper, style } from '@tempoxyz/ds'
|
|
2004
|
+
|
|
2005
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2006
|
+
export function Demo() {
|
|
2007
|
+
return (
|
|
2008
|
+
<div {...styles.flow()}>
|
|
2009
|
+
<Stepper.Root count={3} value={2} />
|
|
2010
|
+
</div>
|
|
2011
|
+
)
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
namespace styles {
|
|
2015
|
+
export const flow = style({ width: '100% !custom' })
|
|
2016
|
+
}
|
|
2017
|
+
```
|
|
2018
|
+
|
|
2019
|
+
#### Let People Go Back
|
|
2020
|
+
|
|
2021
|
+
Give every step after the first a Back button before the primary action, and keep the values already entered. Make the last step a review with a specific primary action, such as Confirm payment, and set `value` to `count` there.
|
|
2022
|
+
|
|
2023
|
+
**Do:** Offer Back before the primary action.
|
|
2024
|
+
|
|
2025
|
+
```tsx
|
|
2026
|
+
/** Do example for "Let People Go Back" on the Stepper page: offer Back before the primary action. @module */
|
|
2027
|
+
import { Button, Stepper, style } from '@tempoxyz/ds'
|
|
2028
|
+
|
|
2029
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2030
|
+
export function Demo() {
|
|
2031
|
+
return (
|
|
2032
|
+
<div {...styles.flow()}>
|
|
2033
|
+
<Stepper.Root aria-label="Send payment" count={3} value={2} />
|
|
2034
|
+
<span {...styles.step()}>Step 2 of 3</span>
|
|
2035
|
+
<span {...styles.title()}>Enter amount</span>
|
|
2036
|
+
<div {...styles.actions()}>
|
|
2037
|
+
<Button variant="secondary">Back</Button>
|
|
2038
|
+
<Button>Continue</Button>
|
|
2039
|
+
</div>
|
|
2040
|
+
</div>
|
|
2041
|
+
)
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
namespace styles {
|
|
2045
|
+
export const actions = style({
|
|
2046
|
+
columnGap: '8',
|
|
2047
|
+
display: 'flex',
|
|
2048
|
+
justifyContent: 'flex-end',
|
|
2049
|
+
marginBlockStart: '16',
|
|
2050
|
+
})
|
|
2051
|
+
|
|
2052
|
+
export const flow = style({
|
|
2053
|
+
display: 'flex',
|
|
2054
|
+
flexDirection: 'column',
|
|
2055
|
+
rowGap: '8',
|
|
2056
|
+
width: '100% !custom',
|
|
2057
|
+
})
|
|
2058
|
+
|
|
2059
|
+
export const step = style({
|
|
2060
|
+
color: 'content.secondary',
|
|
2061
|
+
marginBlockStart: '8',
|
|
2062
|
+
typography: 'body.b3',
|
|
2063
|
+
})
|
|
2064
|
+
|
|
2065
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
2066
|
+
}
|
|
2067
|
+
```
|
|
2068
|
+
|
|
2069
|
+
**Don't:** Leave a step with only a way forward.
|
|
2070
|
+
|
|
2071
|
+
```tsx
|
|
2072
|
+
/**
|
|
2073
|
+
* Don't example for "Let People Go Back" on the Stepper page.
|
|
2074
|
+
* Don't leave a step with only a way forward.
|
|
2075
|
+
* @module
|
|
2076
|
+
*/
|
|
2077
|
+
import { Button, Stepper, style } from '@tempoxyz/ds'
|
|
2078
|
+
|
|
2079
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2080
|
+
export function Demo() {
|
|
2081
|
+
return (
|
|
2082
|
+
<div {...styles.flow()}>
|
|
2083
|
+
<Stepper.Root aria-label="Send payment" count={3} value={2} />
|
|
2084
|
+
<span {...styles.step()}>Step 2 of 3</span>
|
|
2085
|
+
<span {...styles.title()}>Enter amount</span>
|
|
2086
|
+
<div {...styles.actions()}>
|
|
2087
|
+
<Button>Continue</Button>
|
|
2088
|
+
</div>
|
|
2089
|
+
</div>
|
|
2090
|
+
)
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
namespace styles {
|
|
2094
|
+
export const actions = style({
|
|
2095
|
+
columnGap: '8',
|
|
2096
|
+
display: 'flex',
|
|
2097
|
+
justifyContent: 'flex-end',
|
|
2098
|
+
marginBlockStart: '16',
|
|
2099
|
+
})
|
|
2100
|
+
|
|
2101
|
+
export const flow = style({
|
|
2102
|
+
display: 'flex',
|
|
2103
|
+
flexDirection: 'column',
|
|
2104
|
+
rowGap: '8',
|
|
2105
|
+
width: '100% !custom',
|
|
2106
|
+
})
|
|
2107
|
+
|
|
2108
|
+
export const step = style({
|
|
2109
|
+
color: 'content.secondary',
|
|
2110
|
+
marginBlockStart: '8',
|
|
2111
|
+
typography: 'body.b3',
|
|
2112
|
+
})
|
|
2113
|
+
|
|
2114
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
2115
|
+
}
|
|
2116
|
+
```
|
|
2117
|
+
|
|
2118
|
+
#### Keep It in One Place
|
|
2119
|
+
|
|
2120
|
+
Place the stepper in the same spot on every step. In a [Dialog](overlays.md#dialog) or a [Frame](layout.md#frame), center it in the header, with the Back button on the left from the second step.
|
|
2121
|
+
|
|
2122
|
+
**Do:** Place the stepper at the top, above the step's heading.
|
|
2123
|
+
|
|
2124
|
+
```tsx
|
|
2125
|
+
/**
|
|
2126
|
+
* Do example for "Label the Current Step in Text" on the Stepper page.
|
|
2127
|
+
* Pair the stepper with the step number and the step's title.
|
|
2128
|
+
* @module
|
|
2129
|
+
*/
|
|
2130
|
+
import { Stepper, style } from '@tempoxyz/ds'
|
|
2131
|
+
|
|
2132
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2133
|
+
export function Demo() {
|
|
2134
|
+
return (
|
|
2135
|
+
<div {...styles.flow()}>
|
|
2136
|
+
<Stepper.Root aria-label="Send payment" count={3} value={2} />
|
|
2137
|
+
<span {...styles.step()}>Step 2 of 3</span>
|
|
2138
|
+
<span {...styles.title()}>Enter amount</span>
|
|
2139
|
+
</div>
|
|
2140
|
+
)
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
namespace styles {
|
|
2144
|
+
export const flow = style({
|
|
2145
|
+
display: 'flex',
|
|
2146
|
+
flexDirection: 'column',
|
|
2147
|
+
rowGap: '8',
|
|
2148
|
+
width: '100% !custom',
|
|
2149
|
+
})
|
|
2150
|
+
|
|
2151
|
+
export const step = style({
|
|
2152
|
+
color: 'content.secondary',
|
|
2153
|
+
marginBlockStart: '8',
|
|
2154
|
+
typography: 'body.b3',
|
|
2155
|
+
})
|
|
2156
|
+
|
|
2157
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
2158
|
+
}
|
|
2159
|
+
```
|
|
2160
|
+
|
|
2161
|
+
**Don't:** Place the stepper below the step's content.
|
|
2162
|
+
|
|
2163
|
+
```tsx
|
|
2164
|
+
/**
|
|
2165
|
+
* Don't example for "Keep It in One Place" on the Stepper page.
|
|
2166
|
+
* Don't place the stepper below the step's content.
|
|
2167
|
+
* @module
|
|
2168
|
+
*/
|
|
2169
|
+
import { Stepper, style } from '@tempoxyz/ds'
|
|
2170
|
+
|
|
2171
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2172
|
+
export function Demo() {
|
|
2173
|
+
return (
|
|
2174
|
+
<div {...styles.flow()}>
|
|
2175
|
+
<span {...styles.step()}>Step 2 of 3</span>
|
|
2176
|
+
<span {...styles.title()}>Enter amount</span>
|
|
2177
|
+
<Stepper.Root aria-label="Send payment" count={3} value={2} {...styles.stepper()} />
|
|
2178
|
+
</div>
|
|
2179
|
+
)
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
namespace styles {
|
|
2183
|
+
export const flow = style({
|
|
2184
|
+
display: 'flex',
|
|
2185
|
+
flexDirection: 'column',
|
|
2186
|
+
rowGap: '8',
|
|
2187
|
+
width: '100% !custom',
|
|
2188
|
+
})
|
|
2189
|
+
|
|
2190
|
+
export const step = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
2191
|
+
|
|
2192
|
+
export const stepper = style({ marginBlockStart: '16' })
|
|
2193
|
+
|
|
2194
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
2195
|
+
}
|
|
2196
|
+
```
|
|
2197
|
+
|
|
2198
|
+
### Content
|
|
2199
|
+
|
|
2200
|
+
* Write step titles as short tasks or nouns, such as Recipient, Amount, and Review.
|
|
2201
|
+
* Match the visible step text to the announced value, Step 2 of 3.
|
|
2202
|
+
* Before the first step, list what people need, such as an ID or a funded wallet.
|
|
2203
|
+
|
|
2204
|
+
### Accessibility
|
|
2205
|
+
|
|
2206
|
+
A stepper renders a `progressbar` whose value is the current step. The segments are visual only.
|
|
2207
|
+
|
|
2208
|
+
#### Semantics
|
|
2209
|
+
|
|
2210
|
+
* **Root (progressbar):** Its value is the current step, 1 to `count`.
|
|
2211
|
+
* **Value Text (aria-valuetext):** Reads as "Step 2 of 4".
|
|
2212
|
+
* **Name (aria-label):** Named "Progress" by default.
|
|
2213
|
+
* **No Focus Stop (not focusable):** Tab moves past it to the next control.
|
|
2214
|
+
|
|
2215
|
+
#### Your Responsibilities
|
|
2216
|
+
|
|
2217
|
+
* **Name the Flow (aria-label):** Name the flow, such as "Account setup". Don't repeat the step text, which is already read.
|
|
2218
|
+
* **Label Each Step (SC 1.3.1):** Name the current step in visible text, so progress doesn't rely on color alone.
|
|
2219
|
+
* **Move Focus on Advance:** When the step changes, move focus to the new step's heading, so screen readers announce the new step.
|
|
2220
|
+
|
|
2221
|
+
### Related
|
|
2222
|
+
|
|
2223
|
+
[Progress](feedback-and-status.md#progress-1)
|
|
2224
|
+
|
|
2225
|
+
Use for measurable work.
|
|
2226
|
+
|
|
2227
|
+
[Dialog](overlays.md#dialog)
|
|
2228
|
+
|
|
2229
|
+
Use for flows that open over the page.
|
|
2230
|
+
|
|
2231
|
+
[Forms](../patterns.md#forms)
|
|
2232
|
+
|
|
2233
|
+
Covers laying out each step.
|
|
2234
|
+
|
|
2235
|
+
[Payments](../patterns.md#payments)
|
|
2236
|
+
|
|
2237
|
+
Covers send and review flows.
|
|
2238
|
+
|
|
2239
|
+
### Examples
|
|
2240
|
+
|
|
2241
|
+
#### Basic
|
|
2242
|
+
|
|
2243
|
+
```tsx
|
|
2244
|
+
import { Stepper, style } from '@tempoxyz/ds'
|
|
2245
|
+
|
|
2246
|
+
export const fill = true
|
|
2247
|
+
export function Demo() {
|
|
2248
|
+
return <Stepper.Root aria-label="Account setup" count={3} value={1} {...styles.stepper()} />
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
namespace styles {
|
|
2252
|
+
export const stepper = style({ maxWidth: '24rem !custom' })
|
|
2253
|
+
}
|
|
2254
|
+
```
|
|
2255
|
+
|
|
2256
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Stepper/Basic.tsx)
|
|
2257
|
+
|
|
2258
|
+
#### Value
|
|
2259
|
+
|
|
2260
|
+
Set `count` to the number of steps and `value` to the current step, from `1` to `count`.
|
|
2261
|
+
|
|
2262
|
+
```tsx
|
|
2263
|
+
import { Stepper, style } from '@tempoxyz/ds'
|
|
2264
|
+
|
|
2265
|
+
export const fill = true
|
|
2266
|
+
export function Demo() {
|
|
2267
|
+
return (
|
|
2268
|
+
<div {...styles.stack()}>
|
|
2269
|
+
{[1, 2, 3].map((value) => (
|
|
2270
|
+
<Stepper.Root aria-label="Account setup" count={3} key={value} value={value} />
|
|
2271
|
+
))}
|
|
2272
|
+
</div>
|
|
2273
|
+
)
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
namespace styles {
|
|
2277
|
+
export const stack = style({
|
|
2278
|
+
display: 'flex',
|
|
2279
|
+
flexDirection: 'column',
|
|
2280
|
+
gap: '16',
|
|
2281
|
+
maxWidth: '24rem !custom',
|
|
2282
|
+
})
|
|
2283
|
+
}
|
|
2284
|
+
```
|
|
2285
|
+
|
|
2286
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Stepper/Value.tsx)
|
|
2287
|
+
|
|
2288
|
+
## Tabs
|
|
2289
|
+
|
|
2290
|
+
Switches between related views.
|
|
2291
|
+
|
|
2292
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Tabs.tsx)
|
|
2293
|
+
|
|
2294
|
+
Figma: [Controls/Tab](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-3285) (`Tabs.Tab`), [Tab](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=1186-3208) (`Tabs.Tab`)
|
|
2295
|
+
|
|
2296
|
+
### Overview
|
|
2297
|
+
|
|
2298
|
+
Tabs render an underlined or pill tab list over a set of panels. Use them for related content, and use links for page navigation.
|
|
2299
|
+
|
|
2300
|
+
### Anatomy
|
|
2301
|
+
|
|
2302
|
+
Import the component and assemble its parts.
|
|
2303
|
+
|
|
2304
|
+
```tsx
|
|
2305
|
+
import { Tabs } from '@tempoxyz/ds'
|
|
2306
|
+
|
|
2307
|
+
<Tabs.Root>
|
|
2308
|
+
<Tabs.List>
|
|
2309
|
+
<Tabs.Tab />
|
|
2310
|
+
<Tabs.Indicator />
|
|
2311
|
+
</Tabs.List>
|
|
2312
|
+
<Tabs.Panel />
|
|
2313
|
+
</Tabs.Root>
|
|
2314
|
+
```
|
|
2315
|
+
|
|
2316
|
+
### Guidelines
|
|
2317
|
+
|
|
2318
|
+
#### When to Use
|
|
2319
|
+
|
|
2320
|
+
* Switch between views of one subject at the same level, such as a webhook's Overview, Deliveries, and Settings.
|
|
2321
|
+
* Split a dense page into parts used one at a time, such as Balances and Activity on a wallet's home screen.
|
|
2322
|
+
|
|
2323
|
+
#### When Not to Use
|
|
2324
|
+
|
|
2325
|
+
* Use [ChoiceGroup](forms-and-inputs.md#choicegroup) to pick a value that changes the current view, such as a chart's 1D, 1W, or 1M range.
|
|
2326
|
+
* Use [SidebarMenu](#sidebarmenu) or links to move between pages with their own URLs.
|
|
2327
|
+
* Use [Stepper](#stepper) for steps completed in order.
|
|
2328
|
+
* Use [Accordion](data-display.md#accordion) to open several sections at once, or to compare them.
|
|
2329
|
+
|
|
2330
|
+
#### Keep Tabs Few and Short
|
|
2331
|
+
|
|
2332
|
+
Use two to five tabs with one-word or two-word labels. Overflowing tabs scroll sideways, and tabs past the edge are easy to miss.
|
|
2333
|
+
|
|
2334
|
+
* **Never applies:** Hide the tab.
|
|
2335
|
+
* **Temporarily unavailable:** Disable the tab, such as Deliveries before a webhook's first event, and state why in the open panel.
|
|
2336
|
+
|
|
2337
|
+
**Do:** Use a few short, parallel labels.
|
|
2338
|
+
|
|
2339
|
+
```tsx
|
|
2340
|
+
/** Do example for "Keep Tabs Few and Short" on the Tabs page: use a few short, parallel labels. @module */
|
|
2341
|
+
import { Tabs } from '@tempoxyz/ds'
|
|
2342
|
+
|
|
2343
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2344
|
+
export function Demo() {
|
|
2345
|
+
return (
|
|
2346
|
+
<Tabs.Root defaultValue="overview">
|
|
2347
|
+
<Tabs.List aria-label="Webhook">
|
|
2348
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
2349
|
+
<Tabs.Tab value="deliveries">Deliveries</Tabs.Tab>
|
|
2350
|
+
<Tabs.Tab value="settings">Settings</Tabs.Tab>
|
|
2351
|
+
<Tabs.Indicator />
|
|
2352
|
+
</Tabs.List>
|
|
2353
|
+
</Tabs.Root>
|
|
2354
|
+
)
|
|
2355
|
+
}
|
|
2356
|
+
```
|
|
2357
|
+
|
|
2358
|
+
**Don't:** Add so many tabs that the row scrolls.
|
|
2359
|
+
|
|
2360
|
+
```tsx
|
|
2361
|
+
/**
|
|
2362
|
+
* Don't example for "Keep Tabs Few and Short" on the Tabs page.
|
|
2363
|
+
* Don't add so many tabs that the row scrolls.
|
|
2364
|
+
* @module
|
|
2365
|
+
*/
|
|
2366
|
+
import { style, Tabs } from '@tempoxyz/ds'
|
|
2367
|
+
|
|
2368
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2369
|
+
export function Demo() {
|
|
2370
|
+
return (
|
|
2371
|
+
<Tabs.Root defaultValue="overview" {...styles.root()}>
|
|
2372
|
+
<Tabs.List aria-label="Webhook">
|
|
2373
|
+
<Tabs.Tab value="overview">Endpoint overview</Tabs.Tab>
|
|
2374
|
+
<Tabs.Tab value="deliveries">Recent deliveries</Tabs.Tab>
|
|
2375
|
+
<Tabs.Tab value="failed">Failed attempts</Tabs.Tab>
|
|
2376
|
+
<Tabs.Tab value="secrets">Signing secrets</Tabs.Tab>
|
|
2377
|
+
<Tabs.Tab value="settings">Settings</Tabs.Tab>
|
|
2378
|
+
<Tabs.Indicator />
|
|
2379
|
+
</Tabs.List>
|
|
2380
|
+
</Tabs.Root>
|
|
2381
|
+
)
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
namespace styles {
|
|
2385
|
+
export const root = style({ maxWidth: '100% !custom' })
|
|
2386
|
+
}
|
|
2387
|
+
```
|
|
2388
|
+
|
|
2389
|
+
#### Place One Indicator in Every Underline List
|
|
2390
|
+
|
|
2391
|
+
Put a `Tabs.Indicator` after the tabs in each underline `Tabs.List`. It slides a bar under the active tab.
|
|
2392
|
+
|
|
2393
|
+
**Do:** End every list with a `Tabs.Indicator`.
|
|
2394
|
+
|
|
2395
|
+
```tsx
|
|
2396
|
+
/** Do example for "Keep Tabs Few and Short" on the Tabs page: use a few short, parallel labels. @module */
|
|
2397
|
+
import { Tabs } from '@tempoxyz/ds'
|
|
2398
|
+
|
|
2399
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2400
|
+
export function Demo() {
|
|
2401
|
+
return (
|
|
2402
|
+
<Tabs.Root defaultValue="overview">
|
|
2403
|
+
<Tabs.List aria-label="Webhook">
|
|
2404
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
2405
|
+
<Tabs.Tab value="deliveries">Deliveries</Tabs.Tab>
|
|
2406
|
+
<Tabs.Tab value="settings">Settings</Tabs.Tab>
|
|
2407
|
+
<Tabs.Indicator />
|
|
2408
|
+
</Tabs.List>
|
|
2409
|
+
</Tabs.Root>
|
|
2410
|
+
)
|
|
2411
|
+
}
|
|
2412
|
+
```
|
|
2413
|
+
|
|
2414
|
+
**Don't:** Leave out the indicator, so only the label marks the active tab.
|
|
2415
|
+
|
|
2416
|
+
```tsx
|
|
2417
|
+
/**
|
|
2418
|
+
* Don't example for "Place One Indicator in Every List" on the Tabs page.
|
|
2419
|
+
* Don't leave out the indicator, so only the label marks the active tab.
|
|
2420
|
+
* @module
|
|
2421
|
+
*/
|
|
2422
|
+
import { Tabs } from '@tempoxyz/ds'
|
|
2423
|
+
|
|
2424
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2425
|
+
export function Demo() {
|
|
2426
|
+
return (
|
|
2427
|
+
<Tabs.Root defaultValue="overview">
|
|
2428
|
+
<Tabs.List aria-label="Webhook">
|
|
2429
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
2430
|
+
<Tabs.Tab value="deliveries">Deliveries</Tabs.Tab>
|
|
2431
|
+
<Tabs.Tab value="settings">Settings</Tabs.Tab>
|
|
2432
|
+
</Tabs.List>
|
|
2433
|
+
</Tabs.Root>
|
|
2434
|
+
)
|
|
2435
|
+
}
|
|
2436
|
+
```
|
|
2437
|
+
|
|
2438
|
+
#### Keep Panels Independent
|
|
2439
|
+
|
|
2440
|
+
Make each panel complete on its own. A Save button in one panel can't show errors in another, so use a [Stepper](#stepper) flow or one longer form.
|
|
2441
|
+
|
|
2442
|
+
**Do:** Keep the fields of one form together.
|
|
2443
|
+
|
|
2444
|
+
```tsx
|
|
2445
|
+
/** Do example for "Keep Panels Independent" on the Tabs page: keep the fields of one form together. @module */
|
|
2446
|
+
import { Button, Field, Stack, style, TextInput } from '@tempoxyz/ds'
|
|
2447
|
+
|
|
2448
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2449
|
+
export function Demo() {
|
|
2450
|
+
return (
|
|
2451
|
+
<Stack gap="16" {...styles.fill()}>
|
|
2452
|
+
<Field.Root>
|
|
2453
|
+
<Field.Label>Key name</Field.Label>
|
|
2454
|
+
<TextInput.Group>
|
|
2455
|
+
<TextInput.Control defaultValue="Checkout server" />
|
|
2456
|
+
</TextInput.Group>
|
|
2457
|
+
</Field.Root>
|
|
2458
|
+
<Field.Root>
|
|
2459
|
+
<Field.Label>Daily limit</Field.Label>
|
|
2460
|
+
<TextInput.Group>
|
|
2461
|
+
<TextInput.Control defaultValue="5,000.00 USDC" />
|
|
2462
|
+
</TextInput.Group>
|
|
2463
|
+
</Field.Root>
|
|
2464
|
+
<div {...styles.actions()}>
|
|
2465
|
+
<Button size="small">Save key</Button>
|
|
2466
|
+
</div>
|
|
2467
|
+
</Stack>
|
|
2468
|
+
)
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
namespace styles {
|
|
2472
|
+
export const actions = style({ columnGap: '8', display: 'flex', justifyContent: 'flex-end' })
|
|
2473
|
+
|
|
2474
|
+
export const fill = style({ width: '100% !custom' })
|
|
2475
|
+
}
|
|
2476
|
+
```
|
|
2477
|
+
|
|
2478
|
+
**Don't:** Split a form across tabs.
|
|
2479
|
+
|
|
2480
|
+
```tsx
|
|
2481
|
+
/** Don't example for "Keep Panels Independent" on the Tabs page. Don't split a form across tabs. @module */
|
|
2482
|
+
import { Button, Field, Stack, style, Tabs, TextInput } from '@tempoxyz/ds'
|
|
2483
|
+
|
|
2484
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2485
|
+
export function Demo() {
|
|
2486
|
+
return (
|
|
2487
|
+
<Tabs.Root defaultValue="details" {...styles.fill()}>
|
|
2488
|
+
<Tabs.List aria-label="Key" size="small">
|
|
2489
|
+
<Tabs.Tab value="details">Details</Tabs.Tab>
|
|
2490
|
+
<Tabs.Tab value="limits">Limits</Tabs.Tab>
|
|
2491
|
+
<Tabs.Indicator />
|
|
2492
|
+
</Tabs.List>
|
|
2493
|
+
<Tabs.Panel value="details">
|
|
2494
|
+
<Stack gap="16" {...styles.panel()}>
|
|
2495
|
+
<Field.Root>
|
|
2496
|
+
<Field.Label>Key name</Field.Label>
|
|
2497
|
+
<TextInput.Group>
|
|
2498
|
+
<TextInput.Control defaultValue="Checkout server" />
|
|
2499
|
+
</TextInput.Group>
|
|
2500
|
+
</Field.Root>
|
|
2501
|
+
<div {...styles.actions()}>
|
|
2502
|
+
<Button size="small">Save key</Button>
|
|
2503
|
+
</div>
|
|
2504
|
+
</Stack>
|
|
2505
|
+
</Tabs.Panel>
|
|
2506
|
+
</Tabs.Root>
|
|
2507
|
+
)
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
namespace styles {
|
|
2511
|
+
export const actions = style({ columnGap: '8', display: 'flex', justifyContent: 'flex-end' })
|
|
2512
|
+
|
|
2513
|
+
export const fill = style({ width: '100% !custom' })
|
|
2514
|
+
|
|
2515
|
+
export const panel = style({ marginBlockStart: '16' })
|
|
2516
|
+
}
|
|
2517
|
+
```
|
|
2518
|
+
|
|
2519
|
+
#### Keep the Selected Tab on Reload
|
|
2520
|
+
|
|
2521
|
+
If a tab marks a significant view, store it in the URL. Control `Tabs.Root` with `value` and `onValueChange`.
|
|
2522
|
+
|
|
2523
|
+
**Do:** Store the tab in the URL, such as `?tab=deliveries`, so a reload or a shared link opens it.
|
|
2524
|
+
|
|
2525
|
+
```tsx
|
|
2526
|
+
/**
|
|
2527
|
+
* Do example for "Keep the Selected Tab on Reload" on the Tabs page.
|
|
2528
|
+
* Store the tab in the URL, such as `?tab=deliveries`, so a reload or a shared link opens it.
|
|
2529
|
+
* @module
|
|
2530
|
+
*/
|
|
2531
|
+
import { style, Tabs } from '@tempoxyz/ds'
|
|
2532
|
+
|
|
2533
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2534
|
+
export function Demo() {
|
|
2535
|
+
return (
|
|
2536
|
+
<div {...styles.page()}>
|
|
2537
|
+
<span {...styles.address()}>console.tempo.xyz/webhooks/wh_8f3a?tab=deliveries</span>
|
|
2538
|
+
<Tabs.Root defaultValue="deliveries">
|
|
2539
|
+
<Tabs.List aria-label="Webhook" size="small">
|
|
2540
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
2541
|
+
<Tabs.Tab value="deliveries">Deliveries</Tabs.Tab>
|
|
2542
|
+
<Tabs.Tab value="settings">Settings</Tabs.Tab>
|
|
2543
|
+
<Tabs.Indicator />
|
|
2544
|
+
</Tabs.List>
|
|
2545
|
+
</Tabs.Root>
|
|
2546
|
+
</div>
|
|
2547
|
+
)
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
namespace styles {
|
|
2551
|
+
export const address = style({
|
|
2552
|
+
backgroundColor: 'container.regular',
|
|
2553
|
+
borderRadius: 'full',
|
|
2554
|
+
color: 'content.secondary',
|
|
2555
|
+
cornerShape: 'round',
|
|
2556
|
+
paddingBlock: '4',
|
|
2557
|
+
paddingInline: '12',
|
|
2558
|
+
typography: 'body.b3',
|
|
2559
|
+
})
|
|
2560
|
+
|
|
2561
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '16' })
|
|
2562
|
+
}
|
|
2563
|
+
```
|
|
2564
|
+
|
|
2565
|
+
**Don't:** Reset a reloaded or shared page to the first tab.
|
|
2566
|
+
|
|
2567
|
+
```tsx
|
|
2568
|
+
/**
|
|
2569
|
+
* Don't example for "Keep the Selected Tab on Reload" on the Tabs page.
|
|
2570
|
+
* Don't reset a reloaded or shared page to the first tab.
|
|
2571
|
+
* @module
|
|
2572
|
+
*/
|
|
2573
|
+
import { style, Tabs } from '@tempoxyz/ds'
|
|
2574
|
+
|
|
2575
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2576
|
+
export function Demo() {
|
|
2577
|
+
return (
|
|
2578
|
+
<div {...styles.page()}>
|
|
2579
|
+
<span {...styles.address()}>console.tempo.xyz/webhooks/wh_8f3a</span>
|
|
2580
|
+
<Tabs.Root defaultValue="overview">
|
|
2581
|
+
<Tabs.List aria-label="Webhook" size="small">
|
|
2582
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
2583
|
+
<Tabs.Tab value="deliveries">Deliveries</Tabs.Tab>
|
|
2584
|
+
<Tabs.Tab value="settings">Settings</Tabs.Tab>
|
|
2585
|
+
<Tabs.Indicator />
|
|
2586
|
+
</Tabs.List>
|
|
2587
|
+
</Tabs.Root>
|
|
2588
|
+
</div>
|
|
2589
|
+
)
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
namespace styles {
|
|
2593
|
+
export const address = style({
|
|
2594
|
+
backgroundColor: 'container.regular',
|
|
2595
|
+
borderRadius: 'full',
|
|
2596
|
+
color: 'content.secondary',
|
|
2597
|
+
cornerShape: 'round',
|
|
2598
|
+
paddingBlock: '4',
|
|
2599
|
+
paddingInline: '12',
|
|
2600
|
+
typography: 'body.b3',
|
|
2601
|
+
})
|
|
2602
|
+
|
|
2603
|
+
export const page = style({ display: 'flex', flexDirection: 'column', rowGap: '16' })
|
|
2604
|
+
}
|
|
2605
|
+
```
|
|
2606
|
+
|
|
2607
|
+
#### Expand Tabs in Narrow Containers
|
|
2608
|
+
|
|
2609
|
+
Set `expand` in a narrow container, such as a [Surface](layout.md#surface) or a phone-width column. Leave it off across a wide page, where stretched tabs drift apart.
|
|
2610
|
+
|
|
2611
|
+
**Do:** Stretch the tabs across a narrow card with `expand`.
|
|
2612
|
+
|
|
2613
|
+
```tsx
|
|
2614
|
+
/**
|
|
2615
|
+
* Do example for "Expand Tabs in Narrow Containers" on the Tabs page.
|
|
2616
|
+
* Stretch the tabs across a narrow card with `expand`.
|
|
2617
|
+
* @module
|
|
2618
|
+
*/
|
|
2619
|
+
import { style, Surface, Tabs } from '@tempoxyz/ds'
|
|
2620
|
+
|
|
2621
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2622
|
+
export function Demo() {
|
|
2623
|
+
return (
|
|
2624
|
+
<Surface size="small" {...styles.card()}>
|
|
2625
|
+
<Tabs.Root defaultValue="balances">
|
|
2626
|
+
<Tabs.List aria-label="Wallet" expand size="small">
|
|
2627
|
+
<Tabs.Tab value="balances">Balances</Tabs.Tab>
|
|
2628
|
+
<Tabs.Tab value="activity">Activity</Tabs.Tab>
|
|
2629
|
+
<Tabs.Indicator />
|
|
2630
|
+
</Tabs.List>
|
|
2631
|
+
</Tabs.Root>
|
|
2632
|
+
</Surface>
|
|
2633
|
+
)
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
namespace styles {
|
|
2637
|
+
export const card = style({ width: '16rem !custom' })
|
|
2638
|
+
}
|
|
2639
|
+
```
|
|
2640
|
+
|
|
2641
|
+
**Don't:** Leave a gap at the end of the row in a narrow card.
|
|
2642
|
+
|
|
2643
|
+
```tsx
|
|
2644
|
+
/**
|
|
2645
|
+
* Don't example for "Expand Tabs in Narrow Containers" on the Tabs page.
|
|
2646
|
+
* Don't leave a gap at the end of the row in a narrow card.
|
|
2647
|
+
* @module
|
|
2648
|
+
*/
|
|
2649
|
+
import { style, Surface, Tabs } from '@tempoxyz/ds'
|
|
2650
|
+
|
|
2651
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2652
|
+
export function Demo() {
|
|
2653
|
+
return (
|
|
2654
|
+
<Surface size="small" {...styles.card()}>
|
|
2655
|
+
<Tabs.Root defaultValue="balances">
|
|
2656
|
+
<Tabs.List aria-label="Wallet" size="small">
|
|
2657
|
+
<Tabs.Tab value="balances">Balances</Tabs.Tab>
|
|
2658
|
+
<Tabs.Tab value="activity">Activity</Tabs.Tab>
|
|
2659
|
+
<Tabs.Indicator />
|
|
2660
|
+
</Tabs.List>
|
|
2661
|
+
</Tabs.Root>
|
|
2662
|
+
</Surface>
|
|
2663
|
+
)
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
namespace styles {
|
|
2667
|
+
export const card = style({ width: '16rem !custom' })
|
|
2668
|
+
}
|
|
2669
|
+
```
|
|
2670
|
+
|
|
2671
|
+
### Content
|
|
2672
|
+
|
|
2673
|
+
* Use nouns that name the panel's content, such as Overview, Activity, or Settings.
|
|
2674
|
+
* Keep labels parallel in form and length, such as Send, Receive, and Swap.
|
|
2675
|
+
* Add an icon only if every tab in the list has one.
|
|
2676
|
+
* Don't repeat the page title in each label, such as Webhook overview and Webhook settings.
|
|
2677
|
+
|
|
2678
|
+
### Accessibility
|
|
2679
|
+
|
|
2680
|
+
Tabs follow the [WAI-ARIA tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/), with manual activation by default.
|
|
2681
|
+
|
|
2682
|
+
#### Semantics
|
|
2683
|
+
|
|
2684
|
+
* **Tabs.List (tablist):** Holds the tabs, and needs its own name.
|
|
2685
|
+
* **Tabs.Tab (tab):** A button. The active tab is selected and points at its panel.
|
|
2686
|
+
* **Tabs.Panel (tabpanel):** Named by its tab. Hidden panels unmount unless you set `keepMounted`, which find in page requires.
|
|
2687
|
+
* **Disabled Tabs (aria-disabled):** Reachable with the arrow keys, but can't be activated or shown first.
|
|
2688
|
+
* **Tabs.Indicator:** Decorative, and ignores pointer events. Under reduced motion, it moves without sliding.
|
|
2689
|
+
|
|
2690
|
+
#### Keyboard
|
|
2691
|
+
|
|
2692
|
+
* **Move into the List (Tab):** Moves focus to the active tab, then to the open panel.
|
|
2693
|
+
* **Move to the Next Tab (Right Arrow):** Moves focus to the next tab, and wraps at the end.
|
|
2694
|
+
* **Move to the Previous Tab (Left Arrow):** Moves focus to the previous tab, and wraps at the start.
|
|
2695
|
+
* **Move to the First Tab (Home):** Moves focus to the first tab.
|
|
2696
|
+
* **Move to the Last Tab (End):** Moves focus to the last tab.
|
|
2697
|
+
* **Activate the Tab (Enter or Space):** Activates the focused tab and shows its panel.
|
|
2698
|
+
|
|
2699
|
+
Set `activateOnFocus` on `Tabs.List` to activate a tab on focus. Use it only if panels render without delay.
|
|
2700
|
+
|
|
2701
|
+
#### Focus
|
|
2702
|
+
|
|
2703
|
+
* **One Tab Stop:** Only the active tab is in the Tab order. Arrow keys move between tabs.
|
|
2704
|
+
* **Focusable Panel:** The open panel is focusable, so Tab moves into it even if it holds no controls.
|
|
2705
|
+
|
|
2706
|
+
#### Your Responsibilities
|
|
2707
|
+
|
|
2708
|
+
* **Name the List (SC 4.1.2):** Name the tab list, such as "Sections".
|
|
2709
|
+
|
|
2710
|
+
### Related
|
|
2711
|
+
|
|
2712
|
+
[ChoiceGroup](forms-and-inputs.md#choicegroup)
|
|
2713
|
+
|
|
2714
|
+
Use for one value that changes a view.
|
|
2715
|
+
|
|
2716
|
+
[SidebarMenu](#sidebarmenu)
|
|
2717
|
+
|
|
2718
|
+
Use for navigating between pages.
|
|
2719
|
+
|
|
2720
|
+
[Accordion](data-display.md#accordion)
|
|
2721
|
+
|
|
2722
|
+
Use for sections you open together.
|
|
2723
|
+
|
|
2724
|
+
[Snippet](data-display.md#snippet)
|
|
2725
|
+
|
|
2726
|
+
Use for a command with a tab per tool.
|
|
2727
|
+
|
|
2728
|
+
[Navigation](../patterns.md#navigation)
|
|
2729
|
+
|
|
2730
|
+
Covers choosing between navigation components.
|
|
2731
|
+
|
|
2732
|
+
### Examples
|
|
2733
|
+
|
|
2734
|
+
#### Basic
|
|
2735
|
+
|
|
2736
|
+
```tsx
|
|
2737
|
+
import { Tabs } from '@tempoxyz/ds'
|
|
2738
|
+
|
|
2739
|
+
export function Demo() {
|
|
2740
|
+
return (
|
|
2741
|
+
<Tabs.Root defaultValue="overview">
|
|
2742
|
+
<Tabs.List aria-label="Sections">
|
|
2743
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
2744
|
+
<Tabs.Tab value="activity">Activity</Tabs.Tab>
|
|
2745
|
+
<Tabs.Tab value="settings">Settings</Tabs.Tab>
|
|
2746
|
+
<Tabs.Indicator />
|
|
2747
|
+
</Tabs.List>
|
|
2748
|
+
<Tabs.Panel value="overview">Overview content</Tabs.Panel>
|
|
2749
|
+
<Tabs.Panel value="activity">Activity content</Tabs.Panel>
|
|
2750
|
+
<Tabs.Panel value="settings">Settings content</Tabs.Panel>
|
|
2751
|
+
</Tabs.Root>
|
|
2752
|
+
)
|
|
2753
|
+
}
|
|
2754
|
+
```
|
|
2755
|
+
|
|
2756
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Tabs/Basic.tsx)
|
|
2757
|
+
|
|
2758
|
+
#### Size
|
|
2759
|
+
|
|
2760
|
+
Set `size` on `Tabs.List` to `small`, `medium` (default), or `large`, for 32px, 40px, or 56px tabs.
|
|
2761
|
+
|
|
2762
|
+
```tsx
|
|
2763
|
+
import { Stack, Tabs } from '@tempoxyz/ds'
|
|
2764
|
+
import { Plus } from '@tempoxyz/ds/icons'
|
|
2765
|
+
|
|
2766
|
+
export function Demo() {
|
|
2767
|
+
return (
|
|
2768
|
+
<Stack align="start" gap="24">
|
|
2769
|
+
{(['small', 'medium', 'large'] as const).map((size) => (
|
|
2770
|
+
<Tabs.Root defaultValue="overview" key={size}>
|
|
2771
|
+
<Tabs.List aria-label={`Sections ${size}`} size={size}>
|
|
2772
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
2773
|
+
<Tabs.Tab value="activity">
|
|
2774
|
+
<Plus />
|
|
2775
|
+
Activity
|
|
2776
|
+
</Tabs.Tab>
|
|
2777
|
+
<Tabs.Tab disabled value="settings">
|
|
2778
|
+
Settings
|
|
2779
|
+
</Tabs.Tab>
|
|
2780
|
+
<Tabs.Indicator />
|
|
2781
|
+
</Tabs.List>
|
|
2782
|
+
<Tabs.Panel value="overview">Overview content</Tabs.Panel>
|
|
2783
|
+
<Tabs.Panel value="activity">Activity content</Tabs.Panel>
|
|
2784
|
+
</Tabs.Root>
|
|
2785
|
+
))}
|
|
2786
|
+
</Stack>
|
|
2787
|
+
)
|
|
2788
|
+
}
|
|
2789
|
+
```
|
|
2790
|
+
|
|
2791
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Tabs/Size.tsx)
|
|
2792
|
+
|
|
2793
|
+
#### Disabled
|
|
2794
|
+
|
|
2795
|
+
Set `disabled` on a `Tabs.Tab` to skip it during selection.
|
|
2796
|
+
|
|
2797
|
+
```tsx
|
|
2798
|
+
import { Tabs } from '@tempoxyz/ds'
|
|
2799
|
+
|
|
2800
|
+
export function Demo() {
|
|
2801
|
+
return (
|
|
2802
|
+
<Tabs.Root defaultValue="overview">
|
|
2803
|
+
<Tabs.List aria-label="Sections">
|
|
2804
|
+
<Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
2805
|
+
<Tabs.Tab value="activity">Activity</Tabs.Tab>
|
|
2806
|
+
<Tabs.Tab disabled value="settings">
|
|
2807
|
+
Settings
|
|
2808
|
+
</Tabs.Tab>
|
|
2809
|
+
<Tabs.Indicator />
|
|
2810
|
+
</Tabs.List>
|
|
2811
|
+
<Tabs.Panel value="overview">Overview content</Tabs.Panel>
|
|
2812
|
+
<Tabs.Panel value="activity">Activity content</Tabs.Panel>
|
|
2813
|
+
</Tabs.Root>
|
|
2814
|
+
)
|
|
2815
|
+
}
|
|
2816
|
+
```
|
|
2817
|
+
|
|
2818
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Tabs/Disabled.tsx)
|
|
2819
|
+
|
|
2820
|
+
#### Expand
|
|
2821
|
+
|
|
2822
|
+
Set `expand` on `Tabs.List` to stretch the tabs across the available width.
|
|
2823
|
+
|
|
2824
|
+
```tsx
|
|
2825
|
+
import { Tabs } from '@tempoxyz/ds'
|
|
2826
|
+
|
|
2827
|
+
export function Demo() {
|
|
2828
|
+
return (
|
|
2829
|
+
<Tabs.Root defaultValue="activity" style={{ width: '20rem' }}>
|
|
2830
|
+
<Tabs.List aria-label="Account" expand>
|
|
2831
|
+
<Tabs.Tab value="activity">Activity</Tabs.Tab>
|
|
2832
|
+
<Tabs.Tab value="assets">Assets</Tabs.Tab>
|
|
2833
|
+
<Tabs.Tab value="keys">Keys</Tabs.Tab>
|
|
2834
|
+
<Tabs.Indicator />
|
|
2835
|
+
</Tabs.List>
|
|
2836
|
+
</Tabs.Root>
|
|
2837
|
+
)
|
|
2838
|
+
}
|
|
2839
|
+
```
|
|
2840
|
+
|
|
2841
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Tabs/Expand.tsx)
|
|
2842
|
+
|
|
2843
|
+
#### Pill
|
|
2844
|
+
|
|
2845
|
+
Set `variant="pill"` on `Tabs.List` for filled tabs. The fill marks the active tab, so a pill list takes no `Tabs.Indicator`. Pill tabs are 32px, 40px, or 48px tall.
|
|
2846
|
+
|
|
2847
|
+
```tsx
|
|
2848
|
+
import { Stack, Tabs } from '@tempoxyz/ds'
|
|
2849
|
+
|
|
2850
|
+
export function Demo() {
|
|
2851
|
+
return (
|
|
2852
|
+
<Stack align="start" gap="24">
|
|
2853
|
+
{(['small', 'medium', 'large'] as const).map((size) => (
|
|
2854
|
+
<Tabs.Root defaultValue="all" key={size}>
|
|
2855
|
+
<Tabs.List aria-label={`Transfers ${size}`} size={size} variant="pill">
|
|
2856
|
+
<Tabs.Tab value="all">All</Tabs.Tab>
|
|
2857
|
+
<Tabs.Tab value="payments">Payments</Tabs.Tab>
|
|
2858
|
+
<Tabs.Tab value="payouts">Payouts</Tabs.Tab>
|
|
2859
|
+
</Tabs.List>
|
|
2860
|
+
</Tabs.Root>
|
|
2861
|
+
))}
|
|
2862
|
+
</Stack>
|
|
2863
|
+
)
|
|
2864
|
+
}
|
|
2865
|
+
```
|
|
2866
|
+
|
|
2867
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Tabs/Pill.tsx)
|
|
2868
|
+
|
|
2869
|
+
#### Appearance
|
|
2870
|
+
|
|
2871
|
+
Set `appearance` on a pill `Tabs.List` to `base` (default) on the page, `inverse` on an inverse surface, or `overlay` over an image or video.
|
|
2872
|
+
|
|
2873
|
+
```tsx
|
|
2874
|
+
import { Stack, Tabs, variants } from '@tempoxyz/ds'
|
|
2875
|
+
|
|
2876
|
+
export function Demo() {
|
|
2877
|
+
return (
|
|
2878
|
+
<Stack gap="16">
|
|
2879
|
+
{(['base', 'inverse', 'overlay'] as const).map((appearance) => (
|
|
2880
|
+
<div key={appearance} {...styles.surface({ appearance })}>
|
|
2881
|
+
<Tabs.Root defaultValue="all">
|
|
2882
|
+
<Tabs.List
|
|
2883
|
+
appearance={appearance}
|
|
2884
|
+
aria-label={`Transfers ${appearance}`}
|
|
2885
|
+
variant="pill"
|
|
2886
|
+
>
|
|
2887
|
+
<Tabs.Tab value="all">All</Tabs.Tab>
|
|
2888
|
+
<Tabs.Tab value="payments">Payments</Tabs.Tab>
|
|
2889
|
+
<Tabs.Tab value="payouts">Payouts</Tabs.Tab>
|
|
2890
|
+
</Tabs.List>
|
|
2891
|
+
</Tabs.Root>
|
|
2892
|
+
</div>
|
|
2893
|
+
))}
|
|
2894
|
+
</Stack>
|
|
2895
|
+
)
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
namespace styles {
|
|
2899
|
+
export const surface = variants({
|
|
2900
|
+
base: { borderRadius: 'sm', padding: '16' },
|
|
2901
|
+
variants: {
|
|
2902
|
+
appearance: {
|
|
2903
|
+
base: { backgroundColor: 'background.primary' },
|
|
2904
|
+
inverse: { backgroundColor: 'inverse.background.primary' },
|
|
2905
|
+
overlay: {
|
|
2906
|
+
backgroundImage: 'linear-gradient(135deg, #4471ed, #7e59e4) !custom',
|
|
2907
|
+
},
|
|
2908
|
+
},
|
|
2909
|
+
},
|
|
2910
|
+
})
|
|
2911
|
+
}
|
|
2912
|
+
```
|
|
2913
|
+
|
|
2914
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Tabs/Appearance.tsx)
|