@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,3339 @@
|
|
|
1
|
+
# Layout
|
|
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
|
+
Primitives that size, space, and arrange content. They carry no meaning, so pair them with semantic elements where structure matters.
|
|
8
|
+
|
|
9
|
+
- [AppShell](#appshell): Places a sticky sidebar beside the main content column.
|
|
10
|
+
- [Container](#container): Centers content at a maximum width.
|
|
11
|
+
- [Frame](#frame): Lays out a header, body, and footer in a column.
|
|
12
|
+
- [Grid](#grid): Lays out children on a responsive grid.
|
|
13
|
+
- [Inline](#inline): Lays out children in a horizontal row.
|
|
14
|
+
- [Inset](#inset): Pads content with spacing tokens.
|
|
15
|
+
- [Separator](#separator): Draws a rule between groups of content.
|
|
16
|
+
- [Stack](#stack): Lays out children in a vertical column.
|
|
17
|
+
- [Surface](#surface): A card container for grouping related content.
|
|
18
|
+
|
|
19
|
+
## AppShell
|
|
20
|
+
|
|
21
|
+
Places a sticky sidebar beside the main content column.
|
|
22
|
+
|
|
23
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/AppShell.tsx)
|
|
24
|
+
|
|
25
|
+
Figma: [Layout/App Shell](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-5593) (`AppShell.Root`), [Layout/Page Header](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-5633) (`AppShell.Header`), [Navigation/Tab Bar](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5265-2292) (`AppShell.Root`)
|
|
26
|
+
|
|
27
|
+
### Overview
|
|
28
|
+
|
|
29
|
+
The outer frame of an application. Below 1024px, the sidebar moves into a drawer, which a menu button in a bottom bar opens. With `collapse`, the sidebar collapses to its icons until 768px instead. The bottom bar also repeats the items you choose.
|
|
30
|
+
|
|
31
|
+
### Anatomy
|
|
32
|
+
|
|
33
|
+
Import the component and assemble its parts.
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { AppShell } from '@tempoxyz/ds'
|
|
37
|
+
|
|
38
|
+
<AppShell.Root>
|
|
39
|
+
<AppShell.Sidebar>
|
|
40
|
+
<AppShell.SidebarHeader />
|
|
41
|
+
<AppShell.SidebarBody />
|
|
42
|
+
<AppShell.SidebarFooter />
|
|
43
|
+
</AppShell.Sidebar>
|
|
44
|
+
<AppShell.Main>
|
|
45
|
+
<AppShell.Header>
|
|
46
|
+
<AppShell.Title />
|
|
47
|
+
</AppShell.Header>
|
|
48
|
+
</AppShell.Main>
|
|
49
|
+
<AppShell.Trigger />
|
|
50
|
+
</AppShell.Root>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Guidelines
|
|
54
|
+
|
|
55
|
+
#### When to Use
|
|
56
|
+
|
|
57
|
+
* Frame a product with persistent navigation, such as Tempo Console or the web wallet. Render it once, in the root layout.
|
|
58
|
+
* Pair a [SidebarMenu](navigation.md#sidebarmenu) with a content column of tables, cards, or settings.
|
|
59
|
+
|
|
60
|
+
#### When Not to Use
|
|
61
|
+
|
|
62
|
+
* Use [Container](#container) for pages without persistent navigation, such as sign-in, onboarding, or a public receipt.
|
|
63
|
+
* Use [Dialog](overlays.md#dialog), or a full-screen flow in a [Container](#container), for focused tasks such as Send payment.
|
|
64
|
+
* Use [Drawer](overlays.md#drawer) for a details or filter panel that opens on demand. The shell's drawer holds only primary navigation.
|
|
65
|
+
* Use [Frame](#frame) for a header, body, and footer inside a card or popup.
|
|
66
|
+
|
|
67
|
+
#### Plan for Each Layout
|
|
68
|
+
|
|
69
|
+
The shell switches layouts at 768px and 1024px (the `'768'` and `'1024'` breakpoints). Design and test each.
|
|
70
|
+
|
|
71
|
+
* **Below 768px (Bottom bar):** The sidebar becomes a drawer from the right edge, and a bottom bar holds the chosen items and the menu button.
|
|
72
|
+
* **768px to 1023px (collapse):** The drawer and bottom bar by default. With `collapse`, a 64px column of icons that keep their labels as names.
|
|
73
|
+
* **1024px and Up (28px padding):** The sidebar sticks beside the content with its own scroll, and the bottom bar hides.
|
|
74
|
+
|
|
75
|
+
The drawer is `min(18rem, 85vw)` wide. Server rendering emits the inline sidebar, and CSS hides it below 1024px, or collapses it until 768px with `collapse`.
|
|
76
|
+
|
|
77
|
+
#### Always Render the Trigger
|
|
78
|
+
|
|
79
|
+
Render `AppShell.Trigger` once inside `AppShell.Root`. It adds the menu button to the end of the bottom bar, so the header keeps its full width for the title and actions.
|
|
80
|
+
|
|
81
|
+
**Do:** Render the trigger once in the shell.
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
/**
|
|
85
|
+
* Do example for "Always Render the Trigger" on the AppShell page.
|
|
86
|
+
* Render the trigger once in the shell.
|
|
87
|
+
* @module
|
|
88
|
+
*/
|
|
89
|
+
import { Button, style, Surface } from '@tempoxyz/ds'
|
|
90
|
+
import { Menu } from '@tempoxyz/ds/icons'
|
|
91
|
+
|
|
92
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
93
|
+
export function Demo() {
|
|
94
|
+
return (
|
|
95
|
+
<Surface size="small" {...styles.frame()}>
|
|
96
|
+
<span {...styles.title()}>Balances</span>
|
|
97
|
+
<div {...styles.bar()}>
|
|
98
|
+
<Button aria-label="Open menu" shape="icon" size="small">
|
|
99
|
+
<Menu />
|
|
100
|
+
</Button>
|
|
101
|
+
</div>
|
|
102
|
+
</Surface>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
namespace styles {
|
|
107
|
+
export const bar = style({ display: 'flex', justifyContent: 'flex-end' })
|
|
108
|
+
|
|
109
|
+
export const frame = style({
|
|
110
|
+
display: 'flex',
|
|
111
|
+
flexDirection: 'column',
|
|
112
|
+
gap: '24',
|
|
113
|
+
width: '18rem !custom',
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Don't:** Leave it out. Below 1024px, or 768px with `collapse`, it is the only way to reach every
|
|
121
|
+
destination.
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
/**
|
|
125
|
+
* Don't example for "Always Render the Trigger" on the AppShell page.
|
|
126
|
+
* Don't leave it out. Below 1024px, it is the only way to reach navigation.
|
|
127
|
+
* @module
|
|
128
|
+
*/
|
|
129
|
+
import { style, Surface } from '@tempoxyz/ds'
|
|
130
|
+
|
|
131
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
132
|
+
export function Demo() {
|
|
133
|
+
return (
|
|
134
|
+
<Surface size="small" {...styles.frame()}>
|
|
135
|
+
<span {...styles.title()}>Balances</span>
|
|
136
|
+
<div {...styles.bar()} />
|
|
137
|
+
</Surface>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
namespace styles {
|
|
142
|
+
// Matches the height of the bottom bar in the Do example, so only the missing button differs.
|
|
143
|
+
export const bar = style({ minHeight: '32' })
|
|
144
|
+
|
|
145
|
+
export const frame = style({
|
|
146
|
+
display: 'flex',
|
|
147
|
+
flexDirection: 'column',
|
|
148
|
+
gap: '24',
|
|
149
|
+
width: '18rem !custom',
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### Choose an Alignment
|
|
157
|
+
|
|
158
|
+
* **Centered (center):** The default. Centers the sidebar beside a content column up to 1024px wide.
|
|
159
|
+
* **Start (start):** Pins the sidebar left, and the content fills the row. Use it for wide data views.
|
|
160
|
+
|
|
161
|
+
#### Structure the Sidebar
|
|
162
|
+
|
|
163
|
+
* **AppShell.SidebarHeader:** Holds the product or project switcher at the top of the sidebar.
|
|
164
|
+
* **AppShell.SidebarBody:** Holds the sidebar menu. It scrolls on its own and fades the edge with more content.
|
|
165
|
+
* **AppShell.SidebarFooter:** Holds the account row and other controls, pinned to the bottom edge.
|
|
166
|
+
|
|
167
|
+
Keep the header and footer short so the menu keeps most of the height. Set `--sidebar-width` to change the width of the wide sidebar.
|
|
168
|
+
|
|
169
|
+
#### Choose the Bottom Bar Items
|
|
170
|
+
|
|
171
|
+
Wherever the drawer replaces the sidebar, a bottom bar repeats the [SidebarMenu](navigation.md#sidebarmenu) items that set `tabBar`, in sidebar order, and ends with the menu button. Keep the rest in the drawer.
|
|
172
|
+
|
|
173
|
+
* **Tab (tabBar="tab"):** Shows the icon in the tab bar pill. Choose up to three top destinations.
|
|
174
|
+
* **Action (tabBar="action"):** Shows the icon in a floating button beside the pill. Choose one main action.
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
<SidebarMenu.Item active href="/" tabBar="tab">
|
|
178
|
+
<Home />
|
|
179
|
+
Home
|
|
180
|
+
</SidebarMenu.Item>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Use One Title per Page
|
|
184
|
+
|
|
185
|
+
`AppShell.Title` renders the page's `h1` in the header bar across the top of the content column. Keep one primary action in the header.
|
|
186
|
+
|
|
187
|
+
**Do:** Put the title first, then page actions, such as a `small` [Button](actions.md#button).
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
/**
|
|
191
|
+
* Do example for "Use One Title per Page" on the AppShell page.
|
|
192
|
+
* Put the title first, then page actions, such as a `small` Button.
|
|
193
|
+
* @module
|
|
194
|
+
*/
|
|
195
|
+
import { Button, style, Surface } from '@tempoxyz/ds'
|
|
196
|
+
|
|
197
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
198
|
+
export function Demo() {
|
|
199
|
+
return (
|
|
200
|
+
<Surface size="small" {...styles.frame()}>
|
|
201
|
+
<div {...styles.header()}>
|
|
202
|
+
<span {...styles.title()}>API keys</span>
|
|
203
|
+
<Button size="small">New key</Button>
|
|
204
|
+
</div>
|
|
205
|
+
</Surface>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
namespace styles {
|
|
210
|
+
export const frame = style({ width: '18rem !custom' })
|
|
211
|
+
|
|
212
|
+
export const header = style({ alignItems: 'center', display: 'flex', gap: '12' })
|
|
213
|
+
|
|
214
|
+
export const title = style({
|
|
215
|
+
color: 'content.primary',
|
|
216
|
+
flex: '1 !custom',
|
|
217
|
+
typography: 'heading.h3',
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Don't:** Place actions before the title.
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
/** Don't example for "Use One Title per Page" on the AppShell page. Don't place actions before the title. @module */
|
|
226
|
+
import { Button, style, Surface } from '@tempoxyz/ds'
|
|
227
|
+
|
|
228
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
229
|
+
export function Demo() {
|
|
230
|
+
return (
|
|
231
|
+
<Surface size="small" {...styles.frame()}>
|
|
232
|
+
<div {...styles.header()}>
|
|
233
|
+
<Button size="small">New key</Button>
|
|
234
|
+
<span {...styles.title()}>API keys</span>
|
|
235
|
+
</div>
|
|
236
|
+
</Surface>
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
namespace styles {
|
|
241
|
+
export const frame = style({ width: '18rem !custom' })
|
|
242
|
+
|
|
243
|
+
export const header = style({ alignItems: 'center', display: 'flex', gap: '12' })
|
|
244
|
+
|
|
245
|
+
export const title = style({
|
|
246
|
+
color: 'content.primary',
|
|
247
|
+
flex: '1 !custom',
|
|
248
|
+
typography: 'heading.h3',
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### Close the Drawer After Navigating
|
|
254
|
+
|
|
255
|
+
With a client-side router, the drawer stays open when the route changes. Control `AppShell.Root` with `open` and `onOpenChange`, and set `open` to `false` when the location changes.
|
|
256
|
+
|
|
257
|
+
**Do:** Close the drawer, so the new page shows.
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
/**
|
|
261
|
+
* Do example for "Close the Drawer After Navigating" on the AppShell page.
|
|
262
|
+
* Close the drawer, so the new page shows.
|
|
263
|
+
* @module
|
|
264
|
+
*/
|
|
265
|
+
import { Button, style } from '@tempoxyz/ds'
|
|
266
|
+
import { Menu } from '@tempoxyz/ds/icons'
|
|
267
|
+
|
|
268
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
269
|
+
export function Demo() {
|
|
270
|
+
return (
|
|
271
|
+
<div {...styles.screen()}>
|
|
272
|
+
<div {...styles.header()}>
|
|
273
|
+
<span {...styles.title()}>API keys</span>
|
|
274
|
+
<Button aria-label="Open menu" shape="icon" size="small" variant="secondary">
|
|
275
|
+
<Menu />
|
|
276
|
+
</Button>
|
|
277
|
+
</div>
|
|
278
|
+
<span {...styles.meta()}>2 active keys</span>
|
|
279
|
+
</div>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
namespace styles {
|
|
284
|
+
export const header = style({
|
|
285
|
+
alignItems: 'center',
|
|
286
|
+
display: 'flex',
|
|
287
|
+
gap: '12',
|
|
288
|
+
justifyContent: 'space-between',
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
export const meta = style({ color: 'content.secondary', typography: 'body.b2' })
|
|
292
|
+
|
|
293
|
+
export const screen = style({
|
|
294
|
+
display: 'flex',
|
|
295
|
+
flexDirection: 'column',
|
|
296
|
+
height: '9rem !custom',
|
|
297
|
+
position: 'relative',
|
|
298
|
+
rowGap: '8',
|
|
299
|
+
width: '18rem !custom',
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Don't:** Leave the drawer over the new page.
|
|
307
|
+
|
|
308
|
+
```tsx
|
|
309
|
+
/**
|
|
310
|
+
* Don't example for "Close the Drawer After Navigating" on the AppShell page.
|
|
311
|
+
* Don't leave the drawer over the new page.
|
|
312
|
+
* @module
|
|
313
|
+
*/
|
|
314
|
+
import { Button, SidebarMenu, style, Surface } from '@tempoxyz/ds'
|
|
315
|
+
import { Home, Key, Menu } from '@tempoxyz/ds/icons'
|
|
316
|
+
|
|
317
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
318
|
+
export function Demo() {
|
|
319
|
+
return (
|
|
320
|
+
<div {...styles.screen()}>
|
|
321
|
+
<div {...styles.header()}>
|
|
322
|
+
<span {...styles.title()}>API keys</span>
|
|
323
|
+
<Button aria-label="Open menu" shape="icon" size="small" variant="secondary">
|
|
324
|
+
<Menu />
|
|
325
|
+
</Button>
|
|
326
|
+
</div>
|
|
327
|
+
<span {...styles.meta()}>2 active keys</span>
|
|
328
|
+
<Surface size="small" {...styles.drawer()}>
|
|
329
|
+
<SidebarMenu.Root aria-label="Primary" size="small">
|
|
330
|
+
<SidebarMenu.Item href="#">
|
|
331
|
+
<Home />
|
|
332
|
+
Home
|
|
333
|
+
</SidebarMenu.Item>
|
|
334
|
+
<SidebarMenu.Item active href="#">
|
|
335
|
+
<Key />
|
|
336
|
+
API keys
|
|
337
|
+
</SidebarMenu.Item>
|
|
338
|
+
</SidebarMenu.Root>
|
|
339
|
+
</Surface>
|
|
340
|
+
</div>
|
|
341
|
+
)
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
namespace styles {
|
|
345
|
+
export const drawer = style({
|
|
346
|
+
insetBlock: '0 !custom',
|
|
347
|
+
insetInlineEnd: '0 !custom',
|
|
348
|
+
position: 'absolute',
|
|
349
|
+
width: '11rem !custom',
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
export const header = style({
|
|
353
|
+
alignItems: 'center',
|
|
354
|
+
display: 'flex',
|
|
355
|
+
gap: '12',
|
|
356
|
+
justifyContent: 'space-between',
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
export const meta = style({ color: 'content.secondary', typography: 'body.b2' })
|
|
360
|
+
|
|
361
|
+
export const screen = style({
|
|
362
|
+
display: 'flex',
|
|
363
|
+
flexDirection: 'column',
|
|
364
|
+
height: '9rem !custom',
|
|
365
|
+
position: 'relative',
|
|
366
|
+
rowGap: '8',
|
|
367
|
+
width: '18rem !custom',
|
|
368
|
+
})
|
|
369
|
+
|
|
370
|
+
export const title = style({ color: 'content.primary', typography: 'heading.h3' })
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Content
|
|
375
|
+
|
|
376
|
+
* Match `AppShell.Title` to the label of the active [SidebarMenu](navigation.md#sidebarmenu) item, such as API keys.
|
|
377
|
+
* Keep titles short enough to share the header row with its actions at 360px.
|
|
378
|
+
|
|
379
|
+
### Accessibility
|
|
380
|
+
|
|
381
|
+
Provides the page landmarks and the `h1`. Below 1024px, the sidebar drawer follows the [WAI-ARIA Dialog (Modal) pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/).
|
|
382
|
+
|
|
383
|
+
#### Semantics
|
|
384
|
+
|
|
385
|
+
* **AppShell.Main (main):** The page's main landmark.
|
|
386
|
+
* **AppShell.Header (header):** Holds the menu trigger and the page title.
|
|
387
|
+
* **AppShell.Title (h1):** The page's top-level heading.
|
|
388
|
+
* **Wide AppShell.Sidebar (complementary):** From 1024px, a landmark named by `aria-label`.
|
|
389
|
+
* **Narrow AppShell.Sidebar (dialog):** Below 1024px, a dialog with the same name.
|
|
390
|
+
* **AppShell.Trigger (button):** Named "Open menu" or "Close menu" by state.
|
|
391
|
+
|
|
392
|
+
#### Keyboard
|
|
393
|
+
|
|
394
|
+
* **Move Through the Shell (Tab):** Moves to the trigger, or cycles the open drawer.
|
|
395
|
+
* **Open the Drawer (Enter or Space):** Opens the drawer from the trigger.
|
|
396
|
+
* **Close the Drawer (Escape):** Closes the drawer.
|
|
397
|
+
|
|
398
|
+
#### Focus
|
|
399
|
+
|
|
400
|
+
* **Opening (Tab or Shift+Tab):** The drawer is modal. Opening it moves focus inside and traps it.
|
|
401
|
+
* **While Open (aria-hidden):** Hides the rest of the page, including the trigger, from assistive technology.
|
|
402
|
+
* **Closing:** Escape, the backdrop, or a swipe right closes the drawer and returns focus to the trigger.
|
|
403
|
+
|
|
404
|
+
#### Motion and Size
|
|
405
|
+
|
|
406
|
+
* **Reduced Motion (prefers-reduced-motion):** The drawer fades, and the trigger switches instantly.
|
|
407
|
+
* **Minimum Width (360px):** The shell never shrinks below this width.
|
|
408
|
+
|
|
409
|
+
#### Your Responsibilities
|
|
410
|
+
|
|
411
|
+
* **Name the Sidebar (aria-label):** Name the sidebar, such as "Primary". The name labels the landmark and the drawer.
|
|
412
|
+
* **Use One Title (h1):** Use one page title. Start the headings of the content at `h2`.
|
|
413
|
+
* **Add a Skip Link (SC 2.4.1):** If the sidebar holds many links, add a [skip link](https://www.w3.org/WAI/WCAG22/Understanding/bypass-blocks.html). The shell adds none.
|
|
414
|
+
|
|
415
|
+
### Related
|
|
416
|
+
|
|
417
|
+
[SidebarMenu](navigation.md#sidebarmenu)
|
|
418
|
+
|
|
419
|
+
Use for the navigation inside the sidebar.
|
|
420
|
+
|
|
421
|
+
[Container](#container)
|
|
422
|
+
|
|
423
|
+
Use for pages without a sidebar.
|
|
424
|
+
|
|
425
|
+
[Drawer](overlays.md#drawer)
|
|
426
|
+
|
|
427
|
+
Use for panels that open on demand.
|
|
428
|
+
|
|
429
|
+
[Responsive Layout](../patterns.md#responsive-layout)
|
|
430
|
+
|
|
431
|
+
Covers adapting pages across breakpoints.
|
|
432
|
+
|
|
433
|
+
[Navigation](../patterns.md#navigation)
|
|
434
|
+
|
|
435
|
+
Covers choosing between navigation components.
|
|
436
|
+
|
|
437
|
+
### Examples
|
|
438
|
+
|
|
439
|
+
#### Basic
|
|
440
|
+
|
|
441
|
+
```tsx
|
|
442
|
+
/** Composes the Tempo Wallet shell: the account row, the wallet pages, the theme item and a page header. @module */
|
|
443
|
+
import { AppShell, Avatar, Hex, Kbd, Menu, SidebarMenu, StatusChip, style, Surface } from '@tempoxyz/ds'
|
|
444
|
+
import { Clock, DarkMode, Home, Link, LogOut, Plus, Wallet } from '@tempoxyz/ds/icons'
|
|
445
|
+
|
|
446
|
+
export const fill = true
|
|
447
|
+
const address = '0x7a3f2c19b0e4d85a6f1c3e9b2d7a40c58e6f91c2'
|
|
448
|
+
|
|
449
|
+
const balances = ['pathUSD', 'USDC.e', 'AlphaUSD']
|
|
450
|
+
|
|
451
|
+
export function Demo() {
|
|
452
|
+
return (
|
|
453
|
+
<div {...styles.frame()}>
|
|
454
|
+
<AppShell.Root
|
|
455
|
+
align="start"
|
|
456
|
+
collapse
|
|
457
|
+
style={{ height: '100%', minHeight: 0, overflowY: 'auto' }}
|
|
458
|
+
>
|
|
459
|
+
<AppShell.Sidebar aria-label="Wallet" style={{ height: '100%' }}>
|
|
460
|
+
<AppShell.SidebarHeader>
|
|
461
|
+
<Menu.Root>
|
|
462
|
+
<Menu.Trigger
|
|
463
|
+
render={<SidebarMenu.AccountRow description="Tempo Wallet" label="Piril Akay" />}
|
|
464
|
+
>
|
|
465
|
+
<Avatar size="32">
|
|
466
|
+
<Avatar.Fallback>PA</Avatar.Fallback>
|
|
467
|
+
</Avatar>
|
|
468
|
+
</Menu.Trigger>
|
|
469
|
+
<Menu.Popup>
|
|
470
|
+
<Menu.Item>
|
|
471
|
+
<Plus />
|
|
472
|
+
Add account
|
|
473
|
+
</Menu.Item>
|
|
474
|
+
<Menu.Separator />
|
|
475
|
+
<Menu.Item intent="negative">
|
|
476
|
+
<LogOut />
|
|
477
|
+
Sign out
|
|
478
|
+
</Menu.Item>
|
|
479
|
+
</Menu.Popup>
|
|
480
|
+
</Menu.Root>
|
|
481
|
+
</AppShell.SidebarHeader>
|
|
482
|
+
<AppShell.SidebarBody>
|
|
483
|
+
<SidebarMenu.Root>
|
|
484
|
+
<SidebarMenu.Group aria-label="Wallet">
|
|
485
|
+
<SidebarMenu.Item active href="#" tabBar="tab">
|
|
486
|
+
<Home />
|
|
487
|
+
Home
|
|
488
|
+
</SidebarMenu.Item>
|
|
489
|
+
<SidebarMenu.Item href="#" tabBar="tab">
|
|
490
|
+
<Clock />
|
|
491
|
+
Activity
|
|
492
|
+
</SidebarMenu.Item>
|
|
493
|
+
<SidebarMenu.Item href="#" tabBar="tab">
|
|
494
|
+
<Wallet />
|
|
495
|
+
Assets
|
|
496
|
+
</SidebarMenu.Item>
|
|
497
|
+
<SidebarMenu.Item href="#">
|
|
498
|
+
<Link />
|
|
499
|
+
Connections
|
|
500
|
+
</SidebarMenu.Item>
|
|
501
|
+
</SidebarMenu.Group>
|
|
502
|
+
</SidebarMenu.Root>
|
|
503
|
+
</AppShell.SidebarBody>
|
|
504
|
+
<AppShell.SidebarFooter>
|
|
505
|
+
<SidebarMenu.Root aria-label="Preferences">
|
|
506
|
+
<SidebarMenu.Item render={<button type="button" />}>
|
|
507
|
+
<DarkMode />
|
|
508
|
+
<span {...styles.grow()}>Dark mode</span>
|
|
509
|
+
<Kbd alt size="small">
|
|
510
|
+
M
|
|
511
|
+
</Kbd>
|
|
512
|
+
</SidebarMenu.Item>
|
|
513
|
+
</SidebarMenu.Root>
|
|
514
|
+
</AppShell.SidebarFooter>
|
|
515
|
+
</AppShell.Sidebar>
|
|
516
|
+
<AppShell.Main>
|
|
517
|
+
<AppShell.Header>
|
|
518
|
+
<AppShell.Title>Home</AppShell.Title>
|
|
519
|
+
<div {...styles.actions()}>
|
|
520
|
+
<StatusChip intent="positive" network>
|
|
521
|
+
Mainnet
|
|
522
|
+
</StatusChip>
|
|
523
|
+
<Hex.Root size="small" value={address} variant="filled" {...styles.address()}>
|
|
524
|
+
<Hex.Text />
|
|
525
|
+
<Hex.Copy aria-label="Copy wallet address" />
|
|
526
|
+
</Hex.Root>
|
|
527
|
+
</div>
|
|
528
|
+
<AppShell.Trigger />
|
|
529
|
+
</AppShell.Header>
|
|
530
|
+
<div {...styles.list()}>
|
|
531
|
+
{balances.map((balance) => (
|
|
532
|
+
<Surface key={balance}>
|
|
533
|
+
<p {...styles.name()}>{balance}</p>
|
|
534
|
+
<p {...styles.caption()}>Available to send</p>
|
|
535
|
+
</Surface>
|
|
536
|
+
))}
|
|
537
|
+
</div>
|
|
538
|
+
</AppShell.Main>
|
|
539
|
+
</AppShell.Root>
|
|
540
|
+
</div>
|
|
541
|
+
)
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
namespace styles {
|
|
545
|
+
// The bottom bar takes over below 768px, so the header keeps only its title.
|
|
546
|
+
export const actions = style({
|
|
547
|
+
alignItems: 'center',
|
|
548
|
+
columnGap: '8',
|
|
549
|
+
display: 'flex',
|
|
550
|
+
'@media (max-width: 767px)': { display: 'none' },
|
|
551
|
+
})
|
|
552
|
+
|
|
553
|
+
export const address = style({ maxWidth: '10rem !custom' })
|
|
554
|
+
|
|
555
|
+
export const caption = style({ color: 'content.secondary', margin: '0', typography: 'body.b3' })
|
|
556
|
+
|
|
557
|
+
// The transform makes the frame the containing block for the mobile drawer.
|
|
558
|
+
export const frame = style({
|
|
559
|
+
borderRadius: 'sm',
|
|
560
|
+
height: '32rem !custom',
|
|
561
|
+
overflow: 'hidden',
|
|
562
|
+
transform: 'translateZ(0) !custom',
|
|
563
|
+
selectors: {
|
|
564
|
+
// The maximized gallery preview shows the shell at full window height.
|
|
565
|
+
':root[data-maximized] &': { borderRadius: '0px !custom', height: '100vh !custom' },
|
|
566
|
+
},
|
|
567
|
+
})
|
|
568
|
+
|
|
569
|
+
export const grow = style({ flex: '1 !custom', minWidth: '0 !custom' })
|
|
570
|
+
|
|
571
|
+
export const list = style({ display: 'flex', flexDirection: 'column', rowGap: '12' })
|
|
572
|
+
|
|
573
|
+
export const name = style({ margin: '0', typography: 'body.b2' })
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AppShell/Basic.tsx)
|
|
578
|
+
|
|
579
|
+
## Container
|
|
580
|
+
|
|
581
|
+
Centers content at a maximum width.
|
|
582
|
+
|
|
583
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Container.tsx)
|
|
584
|
+
|
|
585
|
+
### Overview
|
|
586
|
+
|
|
587
|
+
A container centers content at a maximum width, with inline padding that grows on wider viewports. It sets width only.
|
|
588
|
+
|
|
589
|
+
### Anatomy
|
|
590
|
+
|
|
591
|
+
Import the component and assemble its parts.
|
|
592
|
+
|
|
593
|
+
```tsx
|
|
594
|
+
import { Container } from '@tempoxyz/ds'
|
|
595
|
+
|
|
596
|
+
<Container />
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### Guidelines
|
|
600
|
+
|
|
601
|
+
#### When to Use
|
|
602
|
+
|
|
603
|
+
* Center content on pages without a sidebar, such as sign-in or a receipt.
|
|
604
|
+
* Cap the width of a full-width band, such as a header, to line it up with the page.
|
|
605
|
+
|
|
606
|
+
#### When Not to Use
|
|
607
|
+
|
|
608
|
+
* Use [AppShell](#appshell) for pages with persistent navigation. `AppShell.Main` already caps and pads the content column.
|
|
609
|
+
* Use [Inset](#inset) to pad content inside a region, and [Surface](#surface) for a card.
|
|
610
|
+
* Use [Stack](#stack) or [Grid](#grid) to arrange the content inside the container.
|
|
611
|
+
|
|
612
|
+
#### Pick a Size by Content
|
|
613
|
+
|
|
614
|
+
* **Narrow (48rem):** Forms, settings, sign-in, and a send flow.
|
|
615
|
+
* **Medium (64rem):** Detail pages, such as a transaction or API key.
|
|
616
|
+
* **Wide (80rem):** The default, for dashboards and tables.
|
|
617
|
+
* **Full (none):** Edge-to-edge charts and maps.
|
|
618
|
+
|
|
619
|
+
Give body text in a `wide` container its own narrower column.
|
|
620
|
+
|
|
621
|
+
#### Keep the Gutter on Page Containers
|
|
622
|
+
|
|
623
|
+
Keep the gutter on any container that touches the viewport edge. If a parent already pads the content, set `gutter={false}`.
|
|
624
|
+
|
|
625
|
+
**Do:** Keep the gutter, so content stays off the screen edge.
|
|
626
|
+
|
|
627
|
+
```tsx
|
|
628
|
+
/**
|
|
629
|
+
* Do example for "Keep the Gutter on Page Containers" on the Container page.
|
|
630
|
+
* Keep the gutter, so content stays off the screen edge.
|
|
631
|
+
* @module
|
|
632
|
+
*/
|
|
633
|
+
import { Container, style, Surface } from '@tempoxyz/ds'
|
|
634
|
+
|
|
635
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
636
|
+
export function Demo() {
|
|
637
|
+
return (
|
|
638
|
+
<div {...styles.viewport()}>
|
|
639
|
+
<Container size="narrow" {...styles.page()}>
|
|
640
|
+
<h1 {...styles.title()}>Send payment</h1>
|
|
641
|
+
<Surface size="medium">Recipient 0x71C7…976F</Surface>
|
|
642
|
+
</Container>
|
|
643
|
+
</div>
|
|
644
|
+
)
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
namespace styles {
|
|
648
|
+
export const page = style({ display: 'flex', flexDirection: 'column', gap: '12' })
|
|
649
|
+
|
|
650
|
+
export const title = style({ margin: '0', typography: 'heading.h3' })
|
|
651
|
+
|
|
652
|
+
export const viewport = style({
|
|
653
|
+
backgroundColor: 'background.primary',
|
|
654
|
+
borderRadius: 'sm',
|
|
655
|
+
boxSizing: 'border-box',
|
|
656
|
+
paddingBlock: '24',
|
|
657
|
+
width: '100% !custom',
|
|
658
|
+
})
|
|
659
|
+
}
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
**Don't:** Remove the gutter from a container at the viewport edge.
|
|
663
|
+
|
|
664
|
+
```tsx
|
|
665
|
+
/**
|
|
666
|
+
* Don't example for "Keep the Gutter on Page Containers" on the Container page.
|
|
667
|
+
* Don't remove the gutter from a container at the viewport edge.
|
|
668
|
+
* @module
|
|
669
|
+
*/
|
|
670
|
+
import { Container, style, Surface } from '@tempoxyz/ds'
|
|
671
|
+
|
|
672
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
673
|
+
export function Demo() {
|
|
674
|
+
return (
|
|
675
|
+
<div {...styles.viewport()}>
|
|
676
|
+
<Container gutter={false} size="narrow" {...styles.page()}>
|
|
677
|
+
<h1 {...styles.title()}>Send payment</h1>
|
|
678
|
+
<Surface size="medium">Recipient 0x71C7…976F</Surface>
|
|
679
|
+
</Container>
|
|
680
|
+
</div>
|
|
681
|
+
)
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
namespace styles {
|
|
685
|
+
export const page = style({ display: 'flex', flexDirection: 'column', gap: '12' })
|
|
686
|
+
|
|
687
|
+
export const title = style({ margin: '0', typography: 'heading.h3' })
|
|
688
|
+
|
|
689
|
+
export const viewport = style({
|
|
690
|
+
backgroundColor: 'background.primary',
|
|
691
|
+
borderRadius: 'sm',
|
|
692
|
+
boxSizing: 'border-box',
|
|
693
|
+
paddingBlock: '24',
|
|
694
|
+
width: '100% !custom',
|
|
695
|
+
})
|
|
696
|
+
}
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
### Accessibility
|
|
700
|
+
|
|
701
|
+
A container has no role, name, or keyboard behavior.
|
|
702
|
+
|
|
703
|
+
#### Semantics
|
|
704
|
+
|
|
705
|
+
* **Default Element (div):** Carries no role by default.
|
|
706
|
+
* **Semantic Element (render):** Set a landmark with `render={<main />}`.
|
|
707
|
+
|
|
708
|
+
#### Your Responsibilities
|
|
709
|
+
|
|
710
|
+
* **Render Landmarks Directly (render):** Render `main` on the container, not on an extra wrapper, and don't nest a second `main` inside it.
|
|
711
|
+
* **Reflow at 320px (SC 1.4.10):** Content must [reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html) without horizontal scrolling. Check addresses and hashes.
|
|
712
|
+
|
|
713
|
+
### Related
|
|
714
|
+
|
|
715
|
+
[AppShell](#appshell)
|
|
716
|
+
|
|
717
|
+
Use for pages with a sidebar.
|
|
718
|
+
|
|
719
|
+
[Stack](#stack)
|
|
720
|
+
|
|
721
|
+
Use for spacing content inside the container.
|
|
722
|
+
|
|
723
|
+
[Layout](../foundations.md#layout)
|
|
724
|
+
|
|
725
|
+
Covers widths, spacing, and breakpoints.
|
|
726
|
+
|
|
727
|
+
[Responsive Layout](../patterns.md#responsive-layout)
|
|
728
|
+
|
|
729
|
+
Covers adapting pages across breakpoints.
|
|
730
|
+
|
|
731
|
+
### Examples
|
|
732
|
+
|
|
733
|
+
#### Basic
|
|
734
|
+
|
|
735
|
+
```tsx
|
|
736
|
+
import { Container, Inline, Inset, Stack, style } from '@tempoxyz/ds'
|
|
737
|
+
|
|
738
|
+
export const fill = true
|
|
739
|
+
export function Demo() {
|
|
740
|
+
return (
|
|
741
|
+
<Container size="narrow">
|
|
742
|
+
<Stack gap="24">
|
|
743
|
+
<Inline justify="between">
|
|
744
|
+
<span>Stack, Inline and Container</span>
|
|
745
|
+
<Inline gap="8">
|
|
746
|
+
<span {...styles.chip()}>Public</span>
|
|
747
|
+
<span {...styles.chip()}>Private</span>
|
|
748
|
+
</Inline>
|
|
749
|
+
</Inline>
|
|
750
|
+
<Inset space="24" {...styles.card()}>
|
|
751
|
+
<Stack gap="12">
|
|
752
|
+
<span>Card content</span>
|
|
753
|
+
<span>Second line</span>
|
|
754
|
+
</Stack>
|
|
755
|
+
</Inset>
|
|
756
|
+
</Stack>
|
|
757
|
+
</Container>
|
|
758
|
+
)
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
namespace styles {
|
|
762
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
763
|
+
|
|
764
|
+
export const chip = style({
|
|
765
|
+
backgroundColor: 'container.regular',
|
|
766
|
+
borderRadius: 'full',
|
|
767
|
+
cornerShape: 'round',
|
|
768
|
+
paddingBlock: '4',
|
|
769
|
+
paddingInline: '12',
|
|
770
|
+
})
|
|
771
|
+
}
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Container/Basic.tsx)
|
|
775
|
+
|
|
776
|
+
#### Size
|
|
777
|
+
|
|
778
|
+
Set `size` to `narrow`, `medium`, `wide` (default), or `full`.
|
|
779
|
+
|
|
780
|
+
```tsx
|
|
781
|
+
import { Container, Inset, Stack, style } from '@tempoxyz/ds'
|
|
782
|
+
|
|
783
|
+
export const fill = true
|
|
784
|
+
export function Demo() {
|
|
785
|
+
return (
|
|
786
|
+
<Stack gap="12">
|
|
787
|
+
{(['narrow', 'medium', 'wide', 'full'] as const).map((size) => (
|
|
788
|
+
<Container key={size} size={size}>
|
|
789
|
+
<Inset space="16" {...styles.card()}>
|
|
790
|
+
{size}
|
|
791
|
+
</Inset>
|
|
792
|
+
</Container>
|
|
793
|
+
))}
|
|
794
|
+
</Stack>
|
|
795
|
+
)
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
namespace styles {
|
|
799
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
800
|
+
}
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Container/Size.tsx)
|
|
804
|
+
|
|
805
|
+
#### Gutter
|
|
806
|
+
|
|
807
|
+
Set `gutter={false}` to remove the inline padding.
|
|
808
|
+
|
|
809
|
+
```tsx
|
|
810
|
+
import { Container, Inset, Stack, style } from '@tempoxyz/ds'
|
|
811
|
+
|
|
812
|
+
export const fill = true
|
|
813
|
+
export function Demo() {
|
|
814
|
+
return (
|
|
815
|
+
<Stack gap="12">
|
|
816
|
+
<Container size="narrow">
|
|
817
|
+
<Inset space="16" {...styles.card()}>
|
|
818
|
+
With gutter
|
|
819
|
+
</Inset>
|
|
820
|
+
</Container>
|
|
821
|
+
<Container gutter={false} size="narrow">
|
|
822
|
+
<Inset space="16" {...styles.card()}>
|
|
823
|
+
Without gutter
|
|
824
|
+
</Inset>
|
|
825
|
+
</Container>
|
|
826
|
+
</Stack>
|
|
827
|
+
)
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
namespace styles {
|
|
831
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
832
|
+
}
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Container/Gutter.tsx)
|
|
836
|
+
|
|
837
|
+
## Frame
|
|
838
|
+
|
|
839
|
+
Lays out a header, body, and footer in a column.
|
|
840
|
+
|
|
841
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Frame.tsx)
|
|
842
|
+
|
|
843
|
+
### Overview
|
|
844
|
+
|
|
845
|
+
A frame lays out a header, body, and footer in a column with no fill. Wrap it in a [Surface](#surface) for a card, or put it in a [Dialog](overlays.md#dialog) or [Drawer](overlays.md#drawer) popup.
|
|
846
|
+
|
|
847
|
+
The actions share the width of the footer equally.
|
|
848
|
+
|
|
849
|
+
### Anatomy
|
|
850
|
+
|
|
851
|
+
Import the component and assemble its parts.
|
|
852
|
+
|
|
853
|
+
```tsx
|
|
854
|
+
import { Frame } from '@tempoxyz/ds'
|
|
855
|
+
|
|
856
|
+
<Frame />
|
|
857
|
+
|
|
858
|
+
<Frame.Provider>
|
|
859
|
+
<Frame.Root>
|
|
860
|
+
<Frame.Header>
|
|
861
|
+
<Frame.Title />
|
|
862
|
+
<Frame.Description />
|
|
863
|
+
<Frame.Close />
|
|
864
|
+
</Frame.Header>
|
|
865
|
+
<Frame.Body />
|
|
866
|
+
<Frame.Footer>
|
|
867
|
+
<Frame.Actions />
|
|
868
|
+
</Frame.Footer>
|
|
869
|
+
</Frame.Root>
|
|
870
|
+
</Frame.Provider>
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
### Guidelines
|
|
874
|
+
|
|
875
|
+
#### When to Use
|
|
876
|
+
|
|
877
|
+
* Give a card, dialog, or drawer a title, content, and a row of actions.
|
|
878
|
+
* Share one dismiss handler across nested panels with `Frame.Provider`, such as the steps of a dialog.
|
|
879
|
+
|
|
880
|
+
#### When Not to Use
|
|
881
|
+
|
|
882
|
+
* Use [Surface](#surface) with `Surface.Header` and `Surface.Title` for a card with only a heading and content.
|
|
883
|
+
* Use [AppShell](#appshell) for the frame of a whole page.
|
|
884
|
+
* Use [Stack](#stack) for a plain column without a header or footer.
|
|
885
|
+
|
|
886
|
+
#### Put Actions in the Footer
|
|
887
|
+
|
|
888
|
+
Put `Frame.Actions` inside `Frame.Footer`, in the [Button](actions.md#button) order. `Frame.Body` grows to fill the frame, so the footer stays at the bottom of a tall container, such as a dialog popup. The body never scrolls, so let the container handle overflow.
|
|
889
|
+
|
|
890
|
+
**Do:** Keep the actions in `Frame.Footer`, at the bottom of the frame.
|
|
891
|
+
|
|
892
|
+
```tsx
|
|
893
|
+
/**
|
|
894
|
+
* Do example for "Put Actions in the Footer" on the Frame page.
|
|
895
|
+
* Keep the actions in `Frame.Footer`, at the bottom of the frame.
|
|
896
|
+
* @module
|
|
897
|
+
*/
|
|
898
|
+
import { Amount, Button, Frame, ListGroup, style, Surface } from '@tempoxyz/ds'
|
|
899
|
+
|
|
900
|
+
const payments = [
|
|
901
|
+
['Alice', '25.00'],
|
|
902
|
+
['Bob', '120.00'],
|
|
903
|
+
] as const
|
|
904
|
+
|
|
905
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
906
|
+
export function Demo() {
|
|
907
|
+
return (
|
|
908
|
+
<div {...styles.canvas()}>
|
|
909
|
+
<Surface size="medium" {...styles.card()}>
|
|
910
|
+
<Frame {...styles.frame()}>
|
|
911
|
+
<Frame.Header>
|
|
912
|
+
<Frame.Title>Review batch</Frame.Title>
|
|
913
|
+
</Frame.Header>
|
|
914
|
+
<Frame.Body>
|
|
915
|
+
<ListGroup>
|
|
916
|
+
{payments.map(([name, amount]) => (
|
|
917
|
+
<ListGroup.Row key={name}>
|
|
918
|
+
<ListGroup.Label>{name}</ListGroup.Label>
|
|
919
|
+
<Amount symbol="USDC" value={amount} />
|
|
920
|
+
</ListGroup.Row>
|
|
921
|
+
))}
|
|
922
|
+
</ListGroup>
|
|
923
|
+
</Frame.Body>
|
|
924
|
+
<Frame.Footer>
|
|
925
|
+
<Frame.Actions>
|
|
926
|
+
<Button size="small" variant="secondary">
|
|
927
|
+
Cancel
|
|
928
|
+
</Button>
|
|
929
|
+
<Button size="small">Send 2 payments</Button>
|
|
930
|
+
</Frame.Actions>
|
|
931
|
+
</Frame.Footer>
|
|
932
|
+
</Frame>
|
|
933
|
+
</Surface>
|
|
934
|
+
</div>
|
|
935
|
+
)
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
namespace styles {
|
|
939
|
+
export const canvas = style({
|
|
940
|
+
backgroundColor: 'background.primary',
|
|
941
|
+
borderRadius: 'sm',
|
|
942
|
+
boxSizing: 'border-box',
|
|
943
|
+
padding: '12',
|
|
944
|
+
width: '100% !custom',
|
|
945
|
+
})
|
|
946
|
+
|
|
947
|
+
export const card = style({ height: '240' })
|
|
948
|
+
|
|
949
|
+
export const frame = style({ height: '100% !custom', rowGap: '16' })
|
|
950
|
+
}
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
**Don't:** Put the actions at the end of `Frame.Body`, directly against the content.
|
|
954
|
+
|
|
955
|
+
```tsx
|
|
956
|
+
/**
|
|
957
|
+
* Don't example for "Put Actions in the Footer" on the Frame page.
|
|
958
|
+
* Don't put the actions at the end of `Frame.Body`, directly against the content.
|
|
959
|
+
* @module
|
|
960
|
+
*/
|
|
961
|
+
import { Amount, Button, Frame, ListGroup, style, Surface } from '@tempoxyz/ds'
|
|
962
|
+
|
|
963
|
+
const payments = [
|
|
964
|
+
['Alice', '25.00'],
|
|
965
|
+
['Bob', '120.00'],
|
|
966
|
+
] as const
|
|
967
|
+
|
|
968
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
969
|
+
export function Demo() {
|
|
970
|
+
return (
|
|
971
|
+
<div {...styles.canvas()}>
|
|
972
|
+
<Surface size="medium" {...styles.card()}>
|
|
973
|
+
<Frame {...styles.frame()}>
|
|
974
|
+
<Frame.Header>
|
|
975
|
+
<Frame.Title>Review batch</Frame.Title>
|
|
976
|
+
</Frame.Header>
|
|
977
|
+
<Frame.Body>
|
|
978
|
+
<ListGroup>
|
|
979
|
+
{payments.map(([name, amount]) => (
|
|
980
|
+
<ListGroup.Row key={name}>
|
|
981
|
+
<ListGroup.Label>{name}</ListGroup.Label>
|
|
982
|
+
<Amount symbol="USDC" value={amount} />
|
|
983
|
+
</ListGroup.Row>
|
|
984
|
+
))}
|
|
985
|
+
</ListGroup>
|
|
986
|
+
<Frame.Actions>
|
|
987
|
+
<Button size="small" variant="secondary">
|
|
988
|
+
Cancel
|
|
989
|
+
</Button>
|
|
990
|
+
<Button size="small">Send 2 payments</Button>
|
|
991
|
+
</Frame.Actions>
|
|
992
|
+
</Frame.Body>
|
|
993
|
+
</Frame>
|
|
994
|
+
</Surface>
|
|
995
|
+
</div>
|
|
996
|
+
)
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
namespace styles {
|
|
1000
|
+
export const canvas = style({
|
|
1001
|
+
backgroundColor: 'background.primary',
|
|
1002
|
+
borderRadius: 'sm',
|
|
1003
|
+
boxSizing: 'border-box',
|
|
1004
|
+
padding: '12',
|
|
1005
|
+
width: '100% !custom',
|
|
1006
|
+
})
|
|
1007
|
+
|
|
1008
|
+
export const card = style({ height: '240' })
|
|
1009
|
+
|
|
1010
|
+
export const frame = style({ height: '100% !custom', rowGap: '16' })
|
|
1011
|
+
}
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
#### Show Close Only When It Dismisses
|
|
1015
|
+
|
|
1016
|
+
If a nested frame can't be dismissed, such as a confirmation step, pass `onDismiss={null}` to drop the inherited handler and hide `Frame.Close`.
|
|
1017
|
+
|
|
1018
|
+
**Do:** Pass `onDismiss={null}` on a step that must finish.
|
|
1019
|
+
|
|
1020
|
+
```tsx
|
|
1021
|
+
/**
|
|
1022
|
+
* Do example for "Show Close Only When It Dismisses" on the Frame page.
|
|
1023
|
+
* Pass `onDismiss={null}` on a step that must finish.
|
|
1024
|
+
* @module
|
|
1025
|
+
*/
|
|
1026
|
+
import { Button, Frame, style, Surface } from '@tempoxyz/ds'
|
|
1027
|
+
|
|
1028
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1029
|
+
export function Demo() {
|
|
1030
|
+
return (
|
|
1031
|
+
<Frame.Provider onDismiss={() => {}}>
|
|
1032
|
+
<div {...styles.canvas()}>
|
|
1033
|
+
<Surface size="medium">
|
|
1034
|
+
<Frame onDismiss={null}>
|
|
1035
|
+
<Frame.Header>
|
|
1036
|
+
<Frame.Title>Sending payment</Frame.Title>
|
|
1037
|
+
<Frame.Description>Keep this window open until 25.00 USDC settles.</Frame.Description>
|
|
1038
|
+
<Frame.Close />
|
|
1039
|
+
</Frame.Header>
|
|
1040
|
+
<Frame.Footer>
|
|
1041
|
+
<Frame.Actions>
|
|
1042
|
+
<Button loading size="small">
|
|
1043
|
+
Send
|
|
1044
|
+
</Button>
|
|
1045
|
+
</Frame.Actions>
|
|
1046
|
+
</Frame.Footer>
|
|
1047
|
+
</Frame>
|
|
1048
|
+
</Surface>
|
|
1049
|
+
</div>
|
|
1050
|
+
</Frame.Provider>
|
|
1051
|
+
)
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
namespace styles {
|
|
1055
|
+
export const canvas = style({
|
|
1056
|
+
backgroundColor: 'background.primary',
|
|
1057
|
+
borderRadius: 'sm',
|
|
1058
|
+
boxSizing: 'border-box',
|
|
1059
|
+
padding: '12',
|
|
1060
|
+
width: '100% !custom',
|
|
1061
|
+
})
|
|
1062
|
+
}
|
|
1063
|
+
```
|
|
1064
|
+
|
|
1065
|
+
**Don't:** Leave an inherited close button on a step that can't be dismissed.
|
|
1066
|
+
|
|
1067
|
+
```tsx
|
|
1068
|
+
/**
|
|
1069
|
+
* Don't example for "Show Close Only When It Dismisses" on the Frame page.
|
|
1070
|
+
* Don't leave an inherited close button on a step that can't be dismissed.
|
|
1071
|
+
* @module
|
|
1072
|
+
*/
|
|
1073
|
+
import { Button, Frame, style, Surface } from '@tempoxyz/ds'
|
|
1074
|
+
|
|
1075
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1076
|
+
export function Demo() {
|
|
1077
|
+
return (
|
|
1078
|
+
<Frame.Provider onDismiss={() => {}}>
|
|
1079
|
+
<div {...styles.canvas()}>
|
|
1080
|
+
<Surface size="medium">
|
|
1081
|
+
<Frame>
|
|
1082
|
+
<Frame.Header>
|
|
1083
|
+
<Frame.Title>Sending payment</Frame.Title>
|
|
1084
|
+
<Frame.Description>Keep this window open until 25.00 USDC settles.</Frame.Description>
|
|
1085
|
+
<Frame.Close />
|
|
1086
|
+
</Frame.Header>
|
|
1087
|
+
<Frame.Footer>
|
|
1088
|
+
<Frame.Actions>
|
|
1089
|
+
<Button loading size="small">
|
|
1090
|
+
Send
|
|
1091
|
+
</Button>
|
|
1092
|
+
</Frame.Actions>
|
|
1093
|
+
</Frame.Footer>
|
|
1094
|
+
</Frame>
|
|
1095
|
+
</Surface>
|
|
1096
|
+
</div>
|
|
1097
|
+
</Frame.Provider>
|
|
1098
|
+
)
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
namespace styles {
|
|
1102
|
+
export const canvas = style({
|
|
1103
|
+
backgroundColor: 'background.primary',
|
|
1104
|
+
borderRadius: 'sm',
|
|
1105
|
+
boxSizing: 'border-box',
|
|
1106
|
+
padding: '12',
|
|
1107
|
+
width: '100% !custom',
|
|
1108
|
+
})
|
|
1109
|
+
}
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
#### Check the Heading Level
|
|
1113
|
+
|
|
1114
|
+
`Frame.Title` always renders an `h2`.
|
|
1115
|
+
|
|
1116
|
+
* **Dialog or Card (h2):** Use `Frame.Title` in a dialog, or in a card below the page `h1`.
|
|
1117
|
+
* **Inside an h2 Section (h3):** Render your own `h3` in the header in place of `Frame.Title`.
|
|
1118
|
+
|
|
1119
|
+
### Content
|
|
1120
|
+
|
|
1121
|
+
* **Title:** Name the task, such as Review request or Send USDC.
|
|
1122
|
+
* **Description:** In one sentence, state what happens next.
|
|
1123
|
+
* **Primary action:** Repeat the title's verb, such as Approve request.
|
|
1124
|
+
|
|
1125
|
+
### Accessibility
|
|
1126
|
+
|
|
1127
|
+
A frame adds headings and an optional close button. It doesn't move or trap focus, so other semantics and focus management come from its container.
|
|
1128
|
+
|
|
1129
|
+
#### Semantics
|
|
1130
|
+
|
|
1131
|
+
* **Frame.Title (h2):** The frame's heading, rendered at the top of its header.
|
|
1132
|
+
* **Frame.Description (p):** Supporting text below the title, which describes the frame's content.
|
|
1133
|
+
* **Frame.Close (button):** Announced as "Close", with its icon hidden. Its target exceeds the WCAG 2.2 minimum.
|
|
1134
|
+
* **No Inert Close Button:** The close button renders nothing without a dismiss handler or `onClick`.
|
|
1135
|
+
|
|
1136
|
+
#### Keyboard
|
|
1137
|
+
|
|
1138
|
+
* **Move Through the Frame (Tab):** Moves focus to the close button and the controls, in source order.
|
|
1139
|
+
* **Activate Close (Enter or Space):** Calls the close button's `onClick`, then the dismiss handler.
|
|
1140
|
+
|
|
1141
|
+
#### Your Responsibilities
|
|
1142
|
+
|
|
1143
|
+
* **Name the Close Button (aria-label):** If ambiguous, name what it closes: "Close send payment".
|
|
1144
|
+
* **Label the Dialog (aria-labelledby):** Point a dialog's `aria-labelledby` at the title.
|
|
1145
|
+
|
|
1146
|
+
### Related
|
|
1147
|
+
|
|
1148
|
+
[Surface](#surface)
|
|
1149
|
+
|
|
1150
|
+
Use for the card around a frame.
|
|
1151
|
+
|
|
1152
|
+
[Dialog](overlays.md#dialog)
|
|
1153
|
+
|
|
1154
|
+
Use for frames that open over the page.
|
|
1155
|
+
|
|
1156
|
+
[Drawer](overlays.md#drawer)
|
|
1157
|
+
|
|
1158
|
+
Use for side panels.
|
|
1159
|
+
|
|
1160
|
+
[Button](actions.md#button)
|
|
1161
|
+
|
|
1162
|
+
Use for ordering actions.
|
|
1163
|
+
|
|
1164
|
+
### Examples
|
|
1165
|
+
|
|
1166
|
+
#### Basic
|
|
1167
|
+
|
|
1168
|
+
```tsx
|
|
1169
|
+
import { Button, Frame, ListGroup, Surface } from '@tempoxyz/ds'
|
|
1170
|
+
|
|
1171
|
+
export function Demo() {
|
|
1172
|
+
return (
|
|
1173
|
+
<Surface>
|
|
1174
|
+
<Frame.Root onDismiss={() => {}}>
|
|
1175
|
+
<Frame.Header>
|
|
1176
|
+
<Frame.Title>Review request</Frame.Title>
|
|
1177
|
+
<Frame.Description>Review the details before continuing.</Frame.Description>
|
|
1178
|
+
<Frame.Close />
|
|
1179
|
+
</Frame.Header>
|
|
1180
|
+
<Frame.Body>
|
|
1181
|
+
<ListGroup>
|
|
1182
|
+
<ListGroup.Row>
|
|
1183
|
+
<ListGroup.Label>Network</ListGroup.Label>
|
|
1184
|
+
Tempo
|
|
1185
|
+
</ListGroup.Row>
|
|
1186
|
+
<ListGroup.Row>
|
|
1187
|
+
<ListGroup.Label>Amount</ListGroup.Label>
|
|
1188
|
+
$50.00
|
|
1189
|
+
</ListGroup.Row>
|
|
1190
|
+
</ListGroup>
|
|
1191
|
+
</Frame.Body>
|
|
1192
|
+
<Frame.Footer>
|
|
1193
|
+
<Frame.Actions>
|
|
1194
|
+
<Button variant="secondary">Cancel</Button>
|
|
1195
|
+
<Button>Approve</Button>
|
|
1196
|
+
</Frame.Actions>
|
|
1197
|
+
</Frame.Footer>
|
|
1198
|
+
</Frame.Root>
|
|
1199
|
+
</Surface>
|
|
1200
|
+
)
|
|
1201
|
+
}
|
|
1202
|
+
```
|
|
1203
|
+
|
|
1204
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Frame/Basic.tsx)
|
|
1205
|
+
|
|
1206
|
+
#### OnDismiss
|
|
1207
|
+
|
|
1208
|
+
Set `onDismiss` on the frame or a surrounding `Frame.Provider` to show `Frame.Close`.
|
|
1209
|
+
|
|
1210
|
+
```tsx
|
|
1211
|
+
import { Button, Frame, ListGroup, style, Surface } from '@tempoxyz/ds'
|
|
1212
|
+
|
|
1213
|
+
export function Demo() {
|
|
1214
|
+
return (
|
|
1215
|
+
<Frame.Provider onDismiss={() => {}}>
|
|
1216
|
+
<div {...styles.grid()}>
|
|
1217
|
+
<Surface>
|
|
1218
|
+
<Review />
|
|
1219
|
+
</Surface>
|
|
1220
|
+
<Review />
|
|
1221
|
+
<Surface>
|
|
1222
|
+
<Review onDismiss={null} />
|
|
1223
|
+
</Surface>
|
|
1224
|
+
</div>
|
|
1225
|
+
</Frame.Provider>
|
|
1226
|
+
)
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
function Review(props: Frame.Root.Props) {
|
|
1230
|
+
return (
|
|
1231
|
+
<Frame.Root {...props}>
|
|
1232
|
+
<Frame.Header>
|
|
1233
|
+
<Frame.Title>Review request</Frame.Title>
|
|
1234
|
+
<Frame.Description>Review the details before continuing.</Frame.Description>
|
|
1235
|
+
<Frame.Close />
|
|
1236
|
+
</Frame.Header>
|
|
1237
|
+
<Frame.Body>
|
|
1238
|
+
<ListGroup>
|
|
1239
|
+
<ListGroup.Row>
|
|
1240
|
+
<ListGroup.Label>Network</ListGroup.Label>
|
|
1241
|
+
Tempo
|
|
1242
|
+
</ListGroup.Row>
|
|
1243
|
+
<ListGroup.Row>
|
|
1244
|
+
<ListGroup.Label>Amount</ListGroup.Label>
|
|
1245
|
+
$50.00
|
|
1246
|
+
</ListGroup.Row>
|
|
1247
|
+
</ListGroup>
|
|
1248
|
+
</Frame.Body>
|
|
1249
|
+
<Frame.Footer>
|
|
1250
|
+
<Frame.Actions>
|
|
1251
|
+
<Button variant="secondary">Cancel</Button>
|
|
1252
|
+
<Button>Approve</Button>
|
|
1253
|
+
</Frame.Actions>
|
|
1254
|
+
</Frame.Footer>
|
|
1255
|
+
</Frame.Root>
|
|
1256
|
+
)
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
namespace styles {
|
|
1260
|
+
export const grid = style({
|
|
1261
|
+
backgroundColor: 'background.primary',
|
|
1262
|
+
display: 'grid',
|
|
1263
|
+
gap: '16',
|
|
1264
|
+
padding: '16',
|
|
1265
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(20rem, 1fr)) !custom',
|
|
1266
|
+
})
|
|
1267
|
+
}
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Frame/OnDismiss.tsx)
|
|
1271
|
+
|
|
1272
|
+
## Grid
|
|
1273
|
+
|
|
1274
|
+
Lays out children on a responsive grid.
|
|
1275
|
+
|
|
1276
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Grid.tsx)
|
|
1277
|
+
|
|
1278
|
+
### Overview
|
|
1279
|
+
|
|
1280
|
+
Grid places children on equal tracks, either a fixed `columns` count or as many as the width allows with `fit`.
|
|
1281
|
+
|
|
1282
|
+
### Anatomy
|
|
1283
|
+
|
|
1284
|
+
Import the component and assemble its parts.
|
|
1285
|
+
|
|
1286
|
+
```tsx
|
|
1287
|
+
import { Grid } from '@tempoxyz/ds'
|
|
1288
|
+
|
|
1289
|
+
<Grid />
|
|
1290
|
+
```
|
|
1291
|
+
|
|
1292
|
+
### Guidelines
|
|
1293
|
+
|
|
1294
|
+
#### When to Use
|
|
1295
|
+
|
|
1296
|
+
* Lay out similar items, such as metric tiles, token balance cards, or API key cards.
|
|
1297
|
+
* Build a two-dimensional page layout with a fixed structure, such as a 12-column dashboard.
|
|
1298
|
+
|
|
1299
|
+
#### When Not to Use
|
|
1300
|
+
|
|
1301
|
+
* Use [Table](data-display.md#table) for records to compare across columns, such as transactions.
|
|
1302
|
+
* Use [Stack](#stack) for one column, and [Inline](#inline) for one row.
|
|
1303
|
+
|
|
1304
|
+
#### Prefer Fit Over Fixed Columns
|
|
1305
|
+
|
|
1306
|
+
**Do:** Set `fit` so tiles drop to fewer columns as the width shrinks.
|
|
1307
|
+
|
|
1308
|
+
```tsx
|
|
1309
|
+
/**
|
|
1310
|
+
* Do example for "Prefer Fit Over Fixed Columns" on the Grid page.
|
|
1311
|
+
* Set `fit` so tiles drop to fewer columns as the width shrinks.
|
|
1312
|
+
* @module
|
|
1313
|
+
*/
|
|
1314
|
+
import { Grid, style, Surface } from '@tempoxyz/ds'
|
|
1315
|
+
|
|
1316
|
+
const metrics = [
|
|
1317
|
+
['TPS', '4,218'],
|
|
1318
|
+
['Block time', '0.5s'],
|
|
1319
|
+
['Finality', '0.6s'],
|
|
1320
|
+
] as const
|
|
1321
|
+
|
|
1322
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1323
|
+
export function Demo() {
|
|
1324
|
+
return (
|
|
1325
|
+
<Grid fit="small" gap="12" {...styles.canvas()}>
|
|
1326
|
+
{metrics.map(([label, value]) => (
|
|
1327
|
+
<Surface key={label} size="medium">
|
|
1328
|
+
<span {...styles.label()}>{label}</span>
|
|
1329
|
+
<span {...styles.value()}>{value}</span>
|
|
1330
|
+
</Surface>
|
|
1331
|
+
))}
|
|
1332
|
+
</Grid>
|
|
1333
|
+
)
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
namespace styles {
|
|
1337
|
+
export const canvas = style({
|
|
1338
|
+
backgroundColor: 'background.primary',
|
|
1339
|
+
borderRadius: 'sm',
|
|
1340
|
+
boxSizing: 'border-box',
|
|
1341
|
+
padding: '12',
|
|
1342
|
+
width: '100% !custom',
|
|
1343
|
+
})
|
|
1344
|
+
|
|
1345
|
+
export const label = style({
|
|
1346
|
+
color: 'content.secondary',
|
|
1347
|
+
display: 'block',
|
|
1348
|
+
typography: 'body.b3',
|
|
1349
|
+
})
|
|
1350
|
+
|
|
1351
|
+
export const value = style({ display: 'block', typography: 'heading.h3' })
|
|
1352
|
+
}
|
|
1353
|
+
```
|
|
1354
|
+
|
|
1355
|
+
**Don't:** Force four fixed columns into a narrow container.
|
|
1356
|
+
|
|
1357
|
+
```tsx
|
|
1358
|
+
/**
|
|
1359
|
+
* Don't example for "Prefer Fit Over Fixed Columns" on the Grid page.
|
|
1360
|
+
* Don't force four fixed columns into a narrow container.
|
|
1361
|
+
* @module
|
|
1362
|
+
*/
|
|
1363
|
+
import { Grid, style, Surface } from '@tempoxyz/ds'
|
|
1364
|
+
|
|
1365
|
+
const metrics = [
|
|
1366
|
+
['TPS', '4,218'],
|
|
1367
|
+
['Block time', '0.5s'],
|
|
1368
|
+
['Finality', '0.6s'],
|
|
1369
|
+
['Gas price', '0.1 gwei'],
|
|
1370
|
+
] as const
|
|
1371
|
+
|
|
1372
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1373
|
+
export function Demo() {
|
|
1374
|
+
return (
|
|
1375
|
+
<Grid columns="4" gap="12" {...styles.canvas()}>
|
|
1376
|
+
{metrics.map(([label, value]) => (
|
|
1377
|
+
<Surface key={label} size="medium">
|
|
1378
|
+
<span {...styles.label()}>{label}</span>
|
|
1379
|
+
<span {...styles.value()}>{value}</span>
|
|
1380
|
+
</Surface>
|
|
1381
|
+
))}
|
|
1382
|
+
</Grid>
|
|
1383
|
+
)
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
namespace styles {
|
|
1387
|
+
export const canvas = style({
|
|
1388
|
+
backgroundColor: 'background.primary',
|
|
1389
|
+
borderRadius: 'sm',
|
|
1390
|
+
boxSizing: 'border-box',
|
|
1391
|
+
padding: '12',
|
|
1392
|
+
width: '100% !custom',
|
|
1393
|
+
})
|
|
1394
|
+
|
|
1395
|
+
export const label = style({
|
|
1396
|
+
color: 'content.secondary',
|
|
1397
|
+
display: 'block',
|
|
1398
|
+
typography: 'body.b3',
|
|
1399
|
+
})
|
|
1400
|
+
|
|
1401
|
+
export const value = style({ display: 'block', typography: 'heading.h3' })
|
|
1402
|
+
}
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
#### Change Columns at Breakpoints
|
|
1406
|
+
|
|
1407
|
+
If a layout needs a set count per width, change `gridTemplateColumns` under a [breakpoint](../foundations.md#breakpoints) key. Write the narrowest layout as the base style.
|
|
1408
|
+
|
|
1409
|
+
* **Base (0 to 767px):** One column on phones, with no media key.
|
|
1410
|
+
* **Tablet ('@media 768'):** More columns from 48rem.
|
|
1411
|
+
* **Desktop ('@media 1024'):** The full count from 64rem. Use `'@media <1024'` for anything narrower.
|
|
1412
|
+
|
|
1413
|
+
#### Pick a Gap From the Scale
|
|
1414
|
+
|
|
1415
|
+
* **Cards (24):** The default, for cards.
|
|
1416
|
+
* **Dense Tiles (12 or 16):** For dense dashboard tiles.
|
|
1417
|
+
|
|
1418
|
+
### Accessibility
|
|
1419
|
+
|
|
1420
|
+
Grid has no role, name, or keyboard behavior.
|
|
1421
|
+
|
|
1422
|
+
#### Semantics
|
|
1423
|
+
|
|
1424
|
+
* **Default Element (div):** Has no role. Screen readers pass over it.
|
|
1425
|
+
* **Semantic Element (render):** If the children are items or links, render a list or nav, such as `render={<ul />}`.
|
|
1426
|
+
|
|
1427
|
+
#### Your Responsibilities
|
|
1428
|
+
|
|
1429
|
+
* **Match DOM and Visual Order (Tab):** Don't reorder children with CSS or grid placement. Reading and focus follow the DOM ([SC 1.3.2](https://www.w3.org/WAI/WCAG22/Understanding/meaningful-sequence.html), [SC 2.4.3](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html)).
|
|
1430
|
+
|
|
1431
|
+
### Related
|
|
1432
|
+
|
|
1433
|
+
[Surface](#surface)
|
|
1434
|
+
|
|
1435
|
+
Use for the cards inside a grid.
|
|
1436
|
+
|
|
1437
|
+
[Table](data-display.md#table)
|
|
1438
|
+
|
|
1439
|
+
Use for comparing records.
|
|
1440
|
+
|
|
1441
|
+
[Dashboards](../patterns.md#dashboards)
|
|
1442
|
+
|
|
1443
|
+
Covers metric tile layouts.
|
|
1444
|
+
|
|
1445
|
+
[Responsive Layout](../patterns.md#responsive-layout)
|
|
1446
|
+
|
|
1447
|
+
Covers adapting pages across breakpoints.
|
|
1448
|
+
|
|
1449
|
+
### Examples
|
|
1450
|
+
|
|
1451
|
+
#### Basic
|
|
1452
|
+
|
|
1453
|
+
```tsx
|
|
1454
|
+
import { Grid, Inset, style } from '@tempoxyz/ds'
|
|
1455
|
+
|
|
1456
|
+
export const fill = true
|
|
1457
|
+
export function Demo() {
|
|
1458
|
+
return (
|
|
1459
|
+
<Grid columns="3" gap="16">
|
|
1460
|
+
{[1, 2, 3].map((n) => (
|
|
1461
|
+
<Inset key={n} space="16" {...styles.card()}>
|
|
1462
|
+
Column {n}
|
|
1463
|
+
</Inset>
|
|
1464
|
+
))}
|
|
1465
|
+
</Grid>
|
|
1466
|
+
)
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
namespace styles {
|
|
1470
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
1471
|
+
}
|
|
1472
|
+
```
|
|
1473
|
+
|
|
1474
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Grid/Basic.tsx)
|
|
1475
|
+
|
|
1476
|
+
#### Fit
|
|
1477
|
+
|
|
1478
|
+
Set `fit` to `small`, `medium`, or `large` for tracks of at least 10rem, 14rem, or 20rem. It overrides `columns`.
|
|
1479
|
+
|
|
1480
|
+
```tsx
|
|
1481
|
+
import { Grid, Inset, style } from '@tempoxyz/ds'
|
|
1482
|
+
|
|
1483
|
+
export const fill = true
|
|
1484
|
+
export function Demo() {
|
|
1485
|
+
return (
|
|
1486
|
+
<Grid fit="medium" gap="16">
|
|
1487
|
+
{[1, 2, 3, 4].map((n) => (
|
|
1488
|
+
<Inset key={n} block="24" inline="32" {...styles.card()}>
|
|
1489
|
+
Fit {n}
|
|
1490
|
+
</Inset>
|
|
1491
|
+
))}
|
|
1492
|
+
</Grid>
|
|
1493
|
+
)
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
namespace styles {
|
|
1497
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
1498
|
+
}
|
|
1499
|
+
```
|
|
1500
|
+
|
|
1501
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Grid/Fit.tsx)
|
|
1502
|
+
|
|
1503
|
+
#### Columns
|
|
1504
|
+
|
|
1505
|
+
Set `columns` to `1`, `2`, `3`, `4`, `6`, or `12` equal tracks.
|
|
1506
|
+
|
|
1507
|
+
```tsx
|
|
1508
|
+
import { Grid, Inset, Stack, style } from '@tempoxyz/ds'
|
|
1509
|
+
|
|
1510
|
+
export const fill = true
|
|
1511
|
+
export function Demo() {
|
|
1512
|
+
return (
|
|
1513
|
+
<Stack gap="24">
|
|
1514
|
+
{(['2', '3', '4'] as const).map((columns) => (
|
|
1515
|
+
<Grid columns={columns} gap="8" key={columns}>
|
|
1516
|
+
{Array.from({ length: Number(columns) }, (_, index) => (
|
|
1517
|
+
<Inset key={index} space="16" {...styles.card()}>
|
|
1518
|
+
{columns} columns
|
|
1519
|
+
</Inset>
|
|
1520
|
+
))}
|
|
1521
|
+
</Grid>
|
|
1522
|
+
))}
|
|
1523
|
+
</Stack>
|
|
1524
|
+
)
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
namespace styles {
|
|
1528
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
1529
|
+
}
|
|
1530
|
+
```
|
|
1531
|
+
|
|
1532
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Grid/Columns.tsx)
|
|
1533
|
+
|
|
1534
|
+
#### Gap
|
|
1535
|
+
|
|
1536
|
+
Set `gap` to a spacing token. `rowGap` and `columnGap` override it on one axis.
|
|
1537
|
+
|
|
1538
|
+
```tsx
|
|
1539
|
+
import { Grid, Inset, style } from '@tempoxyz/ds'
|
|
1540
|
+
|
|
1541
|
+
export const fill = true
|
|
1542
|
+
export function Demo() {
|
|
1543
|
+
return (
|
|
1544
|
+
<Grid columnGap="8" columns="3" rowGap="32">
|
|
1545
|
+
{[1, 2, 3, 4, 5, 6].map((n) => (
|
|
1546
|
+
<Inset key={n} space="16" {...styles.card()}>
|
|
1547
|
+
Column {n}
|
|
1548
|
+
</Inset>
|
|
1549
|
+
))}
|
|
1550
|
+
</Grid>
|
|
1551
|
+
)
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
namespace styles {
|
|
1555
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
1556
|
+
}
|
|
1557
|
+
```
|
|
1558
|
+
|
|
1559
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Grid/Gap.tsx)
|
|
1560
|
+
|
|
1561
|
+
## Inline
|
|
1562
|
+
|
|
1563
|
+
Lays out children in a horizontal row.
|
|
1564
|
+
|
|
1565
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Inline.tsx)
|
|
1566
|
+
|
|
1567
|
+
### Overview
|
|
1568
|
+
|
|
1569
|
+
Inline applies a spacing token `gap` between its children and centers them vertically by default.
|
|
1570
|
+
|
|
1571
|
+
### Anatomy
|
|
1572
|
+
|
|
1573
|
+
Import the component and assemble its parts.
|
|
1574
|
+
|
|
1575
|
+
```tsx
|
|
1576
|
+
import { Inline } from '@tempoxyz/ds'
|
|
1577
|
+
|
|
1578
|
+
<Inline />
|
|
1579
|
+
```
|
|
1580
|
+
|
|
1581
|
+
### Guidelines
|
|
1582
|
+
|
|
1583
|
+
#### When to Use
|
|
1584
|
+
|
|
1585
|
+
* Place related items in a row, such as buttons, badges, or an icon beside its label.
|
|
1586
|
+
* Put a label and its value on one line, such as Network fee and 0.01 USDC.
|
|
1587
|
+
|
|
1588
|
+
#### When Not to Use
|
|
1589
|
+
|
|
1590
|
+
* Use [Stack](#stack) for a vertical column.
|
|
1591
|
+
* Use [Grid](#grid) to align items in rows and columns.
|
|
1592
|
+
* Use `Frame.Actions` of [Frame](#frame) for the actions at the bottom of a card or dialog.
|
|
1593
|
+
|
|
1594
|
+
#### Set Wrap When Content Varies
|
|
1595
|
+
|
|
1596
|
+
If a row can outgrow a 320px screen, such as badges, filters, or button groups, set `wrap`.
|
|
1597
|
+
|
|
1598
|
+
**Do:** Set `wrap` so badges reflow onto a new line.
|
|
1599
|
+
|
|
1600
|
+
```tsx
|
|
1601
|
+
/**
|
|
1602
|
+
* Do example for "Set Wrap When Content Varies" on the Inline page.
|
|
1603
|
+
* Set `wrap` so badges reflow onto a new line.
|
|
1604
|
+
* @module
|
|
1605
|
+
*/
|
|
1606
|
+
import { Badge, Inline } from '@tempoxyz/ds'
|
|
1607
|
+
|
|
1608
|
+
const labels = ['Payments', 'Payouts', 'Webhooks', 'Fee payer', 'Treasury', 'Settlement']
|
|
1609
|
+
|
|
1610
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1611
|
+
export function Demo() {
|
|
1612
|
+
return (
|
|
1613
|
+
<Inline gap="8" wrap>
|
|
1614
|
+
{labels.map((label) => (
|
|
1615
|
+
<Badge key={label}>{label}</Badge>
|
|
1616
|
+
))}
|
|
1617
|
+
</Inline>
|
|
1618
|
+
)
|
|
1619
|
+
}
|
|
1620
|
+
```
|
|
1621
|
+
|
|
1622
|
+
**Don't:** Let a row of badges run past its container.
|
|
1623
|
+
|
|
1624
|
+
```tsx
|
|
1625
|
+
/**
|
|
1626
|
+
* Don't example for "Set Wrap When Content Varies" on the Inline page.
|
|
1627
|
+
* Don't let a row of badges run past its container.
|
|
1628
|
+
* @module
|
|
1629
|
+
*/
|
|
1630
|
+
import { Badge, Inline, style } from '@tempoxyz/ds'
|
|
1631
|
+
|
|
1632
|
+
const labels = ['Payments', 'Payouts', 'Webhooks', 'Fee payer', 'Treasury', 'Settlement']
|
|
1633
|
+
|
|
1634
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1635
|
+
export function Demo() {
|
|
1636
|
+
return (
|
|
1637
|
+
<div {...styles.frame()}>
|
|
1638
|
+
<Inline gap="8">
|
|
1639
|
+
{labels.map((label) => (
|
|
1640
|
+
<Badge key={label}>{label}</Badge>
|
|
1641
|
+
))}
|
|
1642
|
+
</Inline>
|
|
1643
|
+
</div>
|
|
1644
|
+
)
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
namespace styles {
|
|
1648
|
+
export const frame = style({ width: '100% !custom' })
|
|
1649
|
+
}
|
|
1650
|
+
```
|
|
1651
|
+
|
|
1652
|
+
#### Align by Content
|
|
1653
|
+
|
|
1654
|
+
* **Center (align="center"):** The default, for icons, buttons, and badges.
|
|
1655
|
+
* **Baseline (align="baseline"):** For text in different sizes, such as an amount and its symbol.
|
|
1656
|
+
* **Between (justify="between"):** Pushes a value or action to the far end of the row.
|
|
1657
|
+
|
|
1658
|
+
#### Pick a Gap From the Scale
|
|
1659
|
+
|
|
1660
|
+
* **Tags and Icons (8):** The default, for badges and icons with labels.
|
|
1661
|
+
* **Buttons (12):** Between buttons.
|
|
1662
|
+
* **Clusters (24 or 32):** Between separate clusters in a toolbar.
|
|
1663
|
+
|
|
1664
|
+
### Accessibility
|
|
1665
|
+
|
|
1666
|
+
Inline has no role, name, or keyboard behavior.
|
|
1667
|
+
|
|
1668
|
+
#### Semantics
|
|
1669
|
+
|
|
1670
|
+
* **Default Element (div):** Has no role. Screen readers pass over it.
|
|
1671
|
+
* **Semantic Element (render):** If the row holds items or links, render a list or nav, such as `render={<ul />}`.
|
|
1672
|
+
|
|
1673
|
+
#### Your Responsibilities
|
|
1674
|
+
|
|
1675
|
+
* **Match DOM and Visual Order (Tab):** Don't reorder children with CSS or reversed directions. Reading and focus follow the DOM ([SC 1.3.2](https://www.w3.org/WAI/WCAG22/Understanding/meaningful-sequence.html), [SC 2.4.3](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html)).
|
|
1676
|
+
|
|
1677
|
+
### Related
|
|
1678
|
+
|
|
1679
|
+
[Stack](#stack)
|
|
1680
|
+
|
|
1681
|
+
Use for vertical spacing.
|
|
1682
|
+
|
|
1683
|
+
[Button](actions.md#button)
|
|
1684
|
+
|
|
1685
|
+
Use for ordering actions in a row.
|
|
1686
|
+
|
|
1687
|
+
[Badge](data-display.md#badge)
|
|
1688
|
+
|
|
1689
|
+
Use for status labels.
|
|
1690
|
+
|
|
1691
|
+
[Layout](../foundations.md#layout)
|
|
1692
|
+
|
|
1693
|
+
Covers the spacing scale.
|
|
1694
|
+
|
|
1695
|
+
### Examples
|
|
1696
|
+
|
|
1697
|
+
#### Basic
|
|
1698
|
+
|
|
1699
|
+
```tsx
|
|
1700
|
+
import { Inline, style } from '@tempoxyz/ds'
|
|
1701
|
+
|
|
1702
|
+
export function Demo() {
|
|
1703
|
+
return (
|
|
1704
|
+
<Inline gap="8">
|
|
1705
|
+
<span {...styles.chip()}>Public</span>
|
|
1706
|
+
<span {...styles.chip()}>Private</span>
|
|
1707
|
+
</Inline>
|
|
1708
|
+
)
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
namespace styles {
|
|
1712
|
+
export const chip = style({
|
|
1713
|
+
backgroundColor: 'container.regular',
|
|
1714
|
+
borderRadius: 'full',
|
|
1715
|
+
cornerShape: 'round',
|
|
1716
|
+
paddingBlock: '4',
|
|
1717
|
+
paddingInline: '12',
|
|
1718
|
+
})
|
|
1719
|
+
}
|
|
1720
|
+
```
|
|
1721
|
+
|
|
1722
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inline/Basic.tsx)
|
|
1723
|
+
|
|
1724
|
+
#### Justify
|
|
1725
|
+
|
|
1726
|
+
Set `justify` to `start` (default), `center`, `end`, or `between`.
|
|
1727
|
+
|
|
1728
|
+
```tsx
|
|
1729
|
+
import { Inline, Stack, style } from '@tempoxyz/ds'
|
|
1730
|
+
|
|
1731
|
+
export const fill = true
|
|
1732
|
+
export function Demo() {
|
|
1733
|
+
return (
|
|
1734
|
+
<Stack gap="16">
|
|
1735
|
+
{(['start', 'center', 'end', 'between'] as const).map((justify) => (
|
|
1736
|
+
<Inline justify={justify} key={justify}>
|
|
1737
|
+
<span>{justify}</span>
|
|
1738
|
+
<Inline gap="8">
|
|
1739
|
+
<span {...styles.chip()}>Public</span>
|
|
1740
|
+
<span {...styles.chip()}>Private</span>
|
|
1741
|
+
</Inline>
|
|
1742
|
+
</Inline>
|
|
1743
|
+
))}
|
|
1744
|
+
</Stack>
|
|
1745
|
+
)
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
namespace styles {
|
|
1749
|
+
export const chip = style({
|
|
1750
|
+
backgroundColor: 'container.regular',
|
|
1751
|
+
borderRadius: 'full',
|
|
1752
|
+
cornerShape: 'round',
|
|
1753
|
+
paddingBlock: '4',
|
|
1754
|
+
paddingInline: '12',
|
|
1755
|
+
})
|
|
1756
|
+
}
|
|
1757
|
+
```
|
|
1758
|
+
|
|
1759
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inline/Justify.tsx)
|
|
1760
|
+
|
|
1761
|
+
#### Wrap
|
|
1762
|
+
|
|
1763
|
+
Set `wrap` to reflow items onto new lines instead of overflowing.
|
|
1764
|
+
|
|
1765
|
+
```tsx
|
|
1766
|
+
import { Inline, style } from '@tempoxyz/ds'
|
|
1767
|
+
|
|
1768
|
+
export function Demo() {
|
|
1769
|
+
return (
|
|
1770
|
+
<Inline gap="8" wrap>
|
|
1771
|
+
{['Stablecoins', 'Payments', 'Payroll', 'Remittance', 'Treasury', 'Settlement'].map(
|
|
1772
|
+
(label) => (
|
|
1773
|
+
<span key={label} {...styles.chip()}>
|
|
1774
|
+
{label}
|
|
1775
|
+
</span>
|
|
1776
|
+
),
|
|
1777
|
+
)}
|
|
1778
|
+
</Inline>
|
|
1779
|
+
)
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
namespace styles {
|
|
1783
|
+
export const chip = style({
|
|
1784
|
+
backgroundColor: 'container.regular',
|
|
1785
|
+
borderRadius: 'full',
|
|
1786
|
+
cornerShape: 'round',
|
|
1787
|
+
paddingBlock: '4',
|
|
1788
|
+
paddingInline: '12',
|
|
1789
|
+
})
|
|
1790
|
+
}
|
|
1791
|
+
```
|
|
1792
|
+
|
|
1793
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inline/Wrap.tsx)
|
|
1794
|
+
|
|
1795
|
+
## Inset
|
|
1796
|
+
|
|
1797
|
+
Pads content with spacing tokens.
|
|
1798
|
+
|
|
1799
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Inset.tsx)
|
|
1800
|
+
|
|
1801
|
+
### Overview
|
|
1802
|
+
|
|
1803
|
+
Inset pads its content on every side or per axis, and adds no other styles.
|
|
1804
|
+
|
|
1805
|
+
### Anatomy
|
|
1806
|
+
|
|
1807
|
+
Import the component and assemble its parts.
|
|
1808
|
+
|
|
1809
|
+
```tsx
|
|
1810
|
+
import { Inset } from '@tempoxyz/ds'
|
|
1811
|
+
|
|
1812
|
+
<Inset />
|
|
1813
|
+
```
|
|
1814
|
+
|
|
1815
|
+
### Guidelines
|
|
1816
|
+
|
|
1817
|
+
#### When to Use
|
|
1818
|
+
|
|
1819
|
+
* Pad a region with no padding of its own, such as a custom panel or a band of page content.
|
|
1820
|
+
* Pad each axis differently, such as `block="16"` and `inline="24"` around a toolbar.
|
|
1821
|
+
|
|
1822
|
+
#### When Not to Use
|
|
1823
|
+
|
|
1824
|
+
* Use [Surface](#surface) for a card. Its `size` sets padding and corner radius.
|
|
1825
|
+
* Use [Container](#container) for page gutters that grow with the viewport.
|
|
1826
|
+
* Use the `gap` of [Stack](#stack), [Inline](#inline), or [Grid](#grid) for space between siblings.
|
|
1827
|
+
|
|
1828
|
+
#### Don't Double the Padding
|
|
1829
|
+
|
|
1830
|
+
[Surface](#surface), [Dialog](overlays.md#dialog), and `AppShell.Main` of [AppShell](#appshell) already pad their content.
|
|
1831
|
+
|
|
1832
|
+
**Do:** Place content directly in a Surface, so it lines up with the cards beside it.
|
|
1833
|
+
|
|
1834
|
+
```tsx
|
|
1835
|
+
/**
|
|
1836
|
+
* Do example for "Don't Double the Padding" on the Inset page.
|
|
1837
|
+
* Place content directly in a Surface, so it lines up with the cards beside it.
|
|
1838
|
+
* @module
|
|
1839
|
+
*/
|
|
1840
|
+
import { style, Surface } from '@tempoxyz/ds'
|
|
1841
|
+
|
|
1842
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1843
|
+
export function Demo() {
|
|
1844
|
+
return (
|
|
1845
|
+
<div {...styles.canvas()}>
|
|
1846
|
+
<Surface size="medium">
|
|
1847
|
+
<Surface.Title>Balance</Surface.Title>
|
|
1848
|
+
<Surface.Description>1,250.00 USDC</Surface.Description>
|
|
1849
|
+
</Surface>
|
|
1850
|
+
<Surface size="medium">
|
|
1851
|
+
<Surface.Title>Activity</Surface.Title>
|
|
1852
|
+
<Surface.Description>3 payments today</Surface.Description>
|
|
1853
|
+
</Surface>
|
|
1854
|
+
</div>
|
|
1855
|
+
)
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
namespace styles {
|
|
1859
|
+
export const canvas = style({
|
|
1860
|
+
backgroundColor: 'background.primary',
|
|
1861
|
+
borderRadius: 'sm',
|
|
1862
|
+
boxSizing: 'border-box',
|
|
1863
|
+
display: 'flex',
|
|
1864
|
+
flexDirection: 'column',
|
|
1865
|
+
gap: '12',
|
|
1866
|
+
padding: '12',
|
|
1867
|
+
width: '100% !custom',
|
|
1868
|
+
})
|
|
1869
|
+
}
|
|
1870
|
+
```
|
|
1871
|
+
|
|
1872
|
+
**Don't:** Add an Inset inside a Surface, which moves its content off the shared edge.
|
|
1873
|
+
|
|
1874
|
+
```tsx
|
|
1875
|
+
/**
|
|
1876
|
+
* Don't example for "Don't Double the Padding" on the Inset page.
|
|
1877
|
+
* Don't add an Inset inside a Surface, which moves its content off the shared edge.
|
|
1878
|
+
* @module
|
|
1879
|
+
*/
|
|
1880
|
+
import { Inset, style, Surface } from '@tempoxyz/ds'
|
|
1881
|
+
|
|
1882
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
1883
|
+
export function Demo() {
|
|
1884
|
+
return (
|
|
1885
|
+
<div {...styles.canvas()}>
|
|
1886
|
+
<Surface size="medium">
|
|
1887
|
+
<Surface.Title>Balance</Surface.Title>
|
|
1888
|
+
<Surface.Description>1,250.00 USDC</Surface.Description>
|
|
1889
|
+
</Surface>
|
|
1890
|
+
<Surface size="medium">
|
|
1891
|
+
<Inset space="16">
|
|
1892
|
+
<Surface.Title>Activity</Surface.Title>
|
|
1893
|
+
<Surface.Description>3 payments today</Surface.Description>
|
|
1894
|
+
</Inset>
|
|
1895
|
+
</Surface>
|
|
1896
|
+
</div>
|
|
1897
|
+
)
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
namespace styles {
|
|
1901
|
+
export const canvas = style({
|
|
1902
|
+
backgroundColor: 'background.primary',
|
|
1903
|
+
borderRadius: 'sm',
|
|
1904
|
+
boxSizing: 'border-box',
|
|
1905
|
+
display: 'flex',
|
|
1906
|
+
flexDirection: 'column',
|
|
1907
|
+
gap: '12',
|
|
1908
|
+
padding: '12',
|
|
1909
|
+
width: '100% !custom',
|
|
1910
|
+
})
|
|
1911
|
+
}
|
|
1912
|
+
```
|
|
1913
|
+
|
|
1914
|
+
#### Match Surface Padding
|
|
1915
|
+
|
|
1916
|
+
Use `16` or `24` for most regions, so they line up with a `medium` or `large` [Surface](#surface).
|
|
1917
|
+
|
|
1918
|
+
* **Medium (16):** Matches a `medium` Surface, such as a dashboard tile.
|
|
1919
|
+
* **Large (24):** Matches a `large` Surface, such as a page card.
|
|
1920
|
+
|
|
1921
|
+
### Accessibility
|
|
1922
|
+
|
|
1923
|
+
An inset adds padding only. It has no role, name, or keyboard behavior.
|
|
1924
|
+
|
|
1925
|
+
#### Semantics
|
|
1926
|
+
|
|
1927
|
+
* **Default Element (div):** Has no role. Screen readers pass over it.
|
|
1928
|
+
* **Semantic Element (render):** Render a section or aside when needed, such as `render= {<section aria-labelledby="…" />}`.
|
|
1929
|
+
|
|
1930
|
+
#### Your Responsibilities
|
|
1931
|
+
|
|
1932
|
+
Keep large inline padding off narrow viewports, so content [reflows](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html) at 320px without horizontal scrolling.
|
|
1933
|
+
|
|
1934
|
+
### Related
|
|
1935
|
+
|
|
1936
|
+
[Surface](#surface)
|
|
1937
|
+
|
|
1938
|
+
Use for padded cards.
|
|
1939
|
+
|
|
1940
|
+
[Stack](#stack)
|
|
1941
|
+
|
|
1942
|
+
Use for space between siblings.
|
|
1943
|
+
|
|
1944
|
+
[Layout](../foundations.md#layout)
|
|
1945
|
+
|
|
1946
|
+
Covers the spacing scale.
|
|
1947
|
+
|
|
1948
|
+
### Examples
|
|
1949
|
+
|
|
1950
|
+
#### Basic
|
|
1951
|
+
|
|
1952
|
+
```tsx
|
|
1953
|
+
import { Inset, Stack, style } from '@tempoxyz/ds'
|
|
1954
|
+
|
|
1955
|
+
export function Demo() {
|
|
1956
|
+
return (
|
|
1957
|
+
<Inset space="24" {...styles.card()}>
|
|
1958
|
+
<Stack gap="12">
|
|
1959
|
+
<span>Card content</span>
|
|
1960
|
+
<span>Second line</span>
|
|
1961
|
+
</Stack>
|
|
1962
|
+
</Inset>
|
|
1963
|
+
)
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
namespace styles {
|
|
1967
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
1968
|
+
}
|
|
1969
|
+
```
|
|
1970
|
+
|
|
1971
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inset/Basic.tsx)
|
|
1972
|
+
|
|
1973
|
+
#### Space
|
|
1974
|
+
|
|
1975
|
+
Set `space` to pad every side.
|
|
1976
|
+
|
|
1977
|
+
```tsx
|
|
1978
|
+
import { Inline, Inset, style } from '@tempoxyz/ds'
|
|
1979
|
+
|
|
1980
|
+
export function Demo() {
|
|
1981
|
+
return (
|
|
1982
|
+
<Inline align="start" gap="16" wrap>
|
|
1983
|
+
{(['8', '16', '24', '32'] as const).map((space) => (
|
|
1984
|
+
<Inset key={space} space={space} {...styles.card()}>
|
|
1985
|
+
space {space}
|
|
1986
|
+
</Inset>
|
|
1987
|
+
))}
|
|
1988
|
+
</Inline>
|
|
1989
|
+
)
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
namespace styles {
|
|
1993
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
1994
|
+
}
|
|
1995
|
+
```
|
|
1996
|
+
|
|
1997
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inset/Space.tsx)
|
|
1998
|
+
|
|
1999
|
+
#### Block
|
|
2000
|
+
|
|
2001
|
+
Set `block` or `inline` to override `space` on one axis.
|
|
2002
|
+
|
|
2003
|
+
```tsx
|
|
2004
|
+
import { Inset, style } from '@tempoxyz/ds'
|
|
2005
|
+
|
|
2006
|
+
export function Demo() {
|
|
2007
|
+
return (
|
|
2008
|
+
<Inset block="24" inline="32" {...styles.card()}>
|
|
2009
|
+
Block 6, inline 8
|
|
2010
|
+
</Inset>
|
|
2011
|
+
)
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
namespace styles {
|
|
2015
|
+
export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
|
|
2016
|
+
}
|
|
2017
|
+
```
|
|
2018
|
+
|
|
2019
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inset/Block.tsx)
|
|
2020
|
+
|
|
2021
|
+
## Separator
|
|
2022
|
+
|
|
2023
|
+
Draws a rule between groups of content.
|
|
2024
|
+
|
|
2025
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Separator.tsx)
|
|
2026
|
+
|
|
2027
|
+
Figma: [Elements/Divider](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-3269)
|
|
2028
|
+
|
|
2029
|
+
### Overview
|
|
2030
|
+
|
|
2031
|
+
Separator renders a 1px rule between thematic groups, such as menu sections or toolbar clusters. A horizontal rule sits centered in a 16px row. With `children`, it centers a short label between two rules, such as `or` between two ways to sign in.
|
|
2032
|
+
|
|
2033
|
+
### Anatomy
|
|
2034
|
+
|
|
2035
|
+
Import the component and assemble its parts.
|
|
2036
|
+
|
|
2037
|
+
```tsx
|
|
2038
|
+
import { Separator } from '@tempoxyz/ds'
|
|
2039
|
+
|
|
2040
|
+
<Separator />
|
|
2041
|
+
```
|
|
2042
|
+
|
|
2043
|
+
### Guidelines
|
|
2044
|
+
|
|
2045
|
+
#### When to Use
|
|
2046
|
+
|
|
2047
|
+
* Divide groups that spacing alone does not separate, such as line items and a total.
|
|
2048
|
+
* Divide clusters of toolbar controls, with `orientation="vertical"`.
|
|
2049
|
+
* Join two alternatives with a label, such as `or` between two ways to sign in.
|
|
2050
|
+
|
|
2051
|
+
#### When Not to Use
|
|
2052
|
+
|
|
2053
|
+
* Use [ListGroup](data-display.md#listgroup) or [Table](data-display.md#table) for lists of records. They draw their own dividers.
|
|
2054
|
+
* Use `SidebarMenu.Group` in a [SidebarMenu](navigation.md#sidebarmenu) and `Menu.Separator` in a [Menu](overlays.md#menu).
|
|
2055
|
+
|
|
2056
|
+
#### Try Space First
|
|
2057
|
+
|
|
2058
|
+
A larger gap separates most groups, such as a [Stack](#stack) with `gap="24"`. Add a separator only if the groups still run together, or one row must stand apart, such as a total.
|
|
2059
|
+
|
|
2060
|
+
**Do:** Separate the total from the line items above it.
|
|
2061
|
+
|
|
2062
|
+
```tsx
|
|
2063
|
+
/**
|
|
2064
|
+
* Do example for "Try Space First" on the Separator page.
|
|
2065
|
+
* Separate the total from the line items above it.
|
|
2066
|
+
* @module
|
|
2067
|
+
*/
|
|
2068
|
+
import { Separator, style } from '@tempoxyz/ds'
|
|
2069
|
+
|
|
2070
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2071
|
+
export function Demo() {
|
|
2072
|
+
return (
|
|
2073
|
+
<div {...styles.summary()}>
|
|
2074
|
+
<div {...styles.row()}>
|
|
2075
|
+
<span>Amount</span>
|
|
2076
|
+
<span>250.00 USDC</span>
|
|
2077
|
+
</div>
|
|
2078
|
+
<div {...styles.row()}>
|
|
2079
|
+
<span>Network fee</span>
|
|
2080
|
+
<span>0.01 USDC</span>
|
|
2081
|
+
</div>
|
|
2082
|
+
<Separator />
|
|
2083
|
+
<div {...styles.total()}>
|
|
2084
|
+
<span>Total</span>
|
|
2085
|
+
<span>250.01 USDC</span>
|
|
2086
|
+
</div>
|
|
2087
|
+
</div>
|
|
2088
|
+
)
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
namespace styles {
|
|
2092
|
+
export const row = style({
|
|
2093
|
+
color: 'content.secondary',
|
|
2094
|
+
display: 'flex',
|
|
2095
|
+
justifyContent: 'space-between',
|
|
2096
|
+
typography: 'body.b2',
|
|
2097
|
+
})
|
|
2098
|
+
|
|
2099
|
+
export const summary = style({
|
|
2100
|
+
display: 'flex',
|
|
2101
|
+
flexDirection: 'column',
|
|
2102
|
+
rowGap: '12',
|
|
2103
|
+
width: '100% !custom',
|
|
2104
|
+
})
|
|
2105
|
+
|
|
2106
|
+
export const total = style({
|
|
2107
|
+
color: 'content.primary',
|
|
2108
|
+
display: 'flex',
|
|
2109
|
+
justifyContent: 'space-between',
|
|
2110
|
+
typography: 'body.b2Strong',
|
|
2111
|
+
})
|
|
2112
|
+
}
|
|
2113
|
+
```
|
|
2114
|
+
|
|
2115
|
+
**Don't:** Rule off every row.
|
|
2116
|
+
|
|
2117
|
+
```tsx
|
|
2118
|
+
/** Don't example for "Try Space First" on the Separator page. Don't rule off every row. @module */
|
|
2119
|
+
import { Separator, style } from '@tempoxyz/ds'
|
|
2120
|
+
|
|
2121
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2122
|
+
export function Demo() {
|
|
2123
|
+
return (
|
|
2124
|
+
<div {...styles.summary()}>
|
|
2125
|
+
<Separator />
|
|
2126
|
+
<div {...styles.row()}>
|
|
2127
|
+
<span>Amount</span>
|
|
2128
|
+
<span>250.00 USDC</span>
|
|
2129
|
+
</div>
|
|
2130
|
+
<Separator />
|
|
2131
|
+
<div {...styles.row()}>
|
|
2132
|
+
<span>Network fee</span>
|
|
2133
|
+
<span>0.01 USDC</span>
|
|
2134
|
+
</div>
|
|
2135
|
+
<Separator />
|
|
2136
|
+
<div {...styles.total()}>
|
|
2137
|
+
<span>Total</span>
|
|
2138
|
+
<span>250.01 USDC</span>
|
|
2139
|
+
</div>
|
|
2140
|
+
<Separator />
|
|
2141
|
+
</div>
|
|
2142
|
+
)
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
namespace styles {
|
|
2146
|
+
export const row = style({
|
|
2147
|
+
color: 'content.secondary',
|
|
2148
|
+
display: 'flex',
|
|
2149
|
+
justifyContent: 'space-between',
|
|
2150
|
+
typography: 'body.b2',
|
|
2151
|
+
})
|
|
2152
|
+
|
|
2153
|
+
export const summary = style({
|
|
2154
|
+
display: 'flex',
|
|
2155
|
+
flexDirection: 'column',
|
|
2156
|
+
rowGap: '12',
|
|
2157
|
+
width: '100% !custom',
|
|
2158
|
+
})
|
|
2159
|
+
|
|
2160
|
+
export const total = style({
|
|
2161
|
+
color: 'content.primary',
|
|
2162
|
+
display: 'flex',
|
|
2163
|
+
justifyContent: 'space-between',
|
|
2164
|
+
typography: 'body.b2Strong',
|
|
2165
|
+
})
|
|
2166
|
+
}
|
|
2167
|
+
```
|
|
2168
|
+
|
|
2169
|
+
#### Keep Rules Inside Containers
|
|
2170
|
+
|
|
2171
|
+
The edge of a [Surface](#surface) or popup already ends the group.
|
|
2172
|
+
|
|
2173
|
+
**Do:** Place separators only between groups.
|
|
2174
|
+
|
|
2175
|
+
```tsx
|
|
2176
|
+
/**
|
|
2177
|
+
* Do example for "Keep Rules Inside Containers" on the Separator page.
|
|
2178
|
+
* Place separators only between groups.
|
|
2179
|
+
* @module
|
|
2180
|
+
*/
|
|
2181
|
+
import { Separator, style, Surface } from '@tempoxyz/ds'
|
|
2182
|
+
|
|
2183
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2184
|
+
export function Demo() {
|
|
2185
|
+
return (
|
|
2186
|
+
<div {...styles.canvas()}>
|
|
2187
|
+
<Surface size="medium" {...styles.summary()}>
|
|
2188
|
+
<div {...styles.row()}>
|
|
2189
|
+
<span>Amount</span>
|
|
2190
|
+
<span>250.00 USDC</span>
|
|
2191
|
+
</div>
|
|
2192
|
+
<div {...styles.row()}>
|
|
2193
|
+
<span>Network fee</span>
|
|
2194
|
+
<span>0.01 USDC</span>
|
|
2195
|
+
</div>
|
|
2196
|
+
<Separator />
|
|
2197
|
+
<div {...styles.total()}>
|
|
2198
|
+
<span>Total</span>
|
|
2199
|
+
<span>250.01 USDC</span>
|
|
2200
|
+
</div>
|
|
2201
|
+
</Surface>
|
|
2202
|
+
</div>
|
|
2203
|
+
)
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
namespace styles {
|
|
2207
|
+
export const canvas = style({
|
|
2208
|
+
backgroundColor: 'background.primary',
|
|
2209
|
+
borderRadius: 'sm',
|
|
2210
|
+
boxSizing: 'border-box',
|
|
2211
|
+
padding: '12',
|
|
2212
|
+
width: '100% !custom',
|
|
2213
|
+
})
|
|
2214
|
+
|
|
2215
|
+
export const row = style({
|
|
2216
|
+
color: 'content.secondary',
|
|
2217
|
+
display: 'flex',
|
|
2218
|
+
justifyContent: 'space-between',
|
|
2219
|
+
typography: 'body.b2',
|
|
2220
|
+
})
|
|
2221
|
+
|
|
2222
|
+
export const summary = style({ display: 'flex', flexDirection: 'column', rowGap: '12' })
|
|
2223
|
+
|
|
2224
|
+
export const total = style({
|
|
2225
|
+
color: 'content.primary',
|
|
2226
|
+
display: 'flex',
|
|
2227
|
+
justifyContent: 'space-between',
|
|
2228
|
+
typography: 'body.b2Strong',
|
|
2229
|
+
})
|
|
2230
|
+
}
|
|
2231
|
+
```
|
|
2232
|
+
|
|
2233
|
+
**Don't:** Place a separator at the top or bottom edge of a Surface.
|
|
2234
|
+
|
|
2235
|
+
```tsx
|
|
2236
|
+
/**
|
|
2237
|
+
* Don't example for "Keep Rules Inside Containers" on the Separator page.
|
|
2238
|
+
* Don't place a separator at the top or bottom edge of a Surface.
|
|
2239
|
+
* @module
|
|
2240
|
+
*/
|
|
2241
|
+
import { Separator, style, Surface } from '@tempoxyz/ds'
|
|
2242
|
+
|
|
2243
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2244
|
+
export function Demo() {
|
|
2245
|
+
return (
|
|
2246
|
+
<div {...styles.canvas()}>
|
|
2247
|
+
<Surface size="medium" {...styles.summary()}>
|
|
2248
|
+
<Separator />
|
|
2249
|
+
<div {...styles.row()}>
|
|
2250
|
+
<span>Amount</span>
|
|
2251
|
+
<span>250.00 USDC</span>
|
|
2252
|
+
</div>
|
|
2253
|
+
<div {...styles.row()}>
|
|
2254
|
+
<span>Network fee</span>
|
|
2255
|
+
<span>0.01 USDC</span>
|
|
2256
|
+
</div>
|
|
2257
|
+
<Separator />
|
|
2258
|
+
<div {...styles.total()}>
|
|
2259
|
+
<span>Total</span>
|
|
2260
|
+
<span>250.01 USDC</span>
|
|
2261
|
+
</div>
|
|
2262
|
+
<Separator />
|
|
2263
|
+
</Surface>
|
|
2264
|
+
</div>
|
|
2265
|
+
)
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
namespace styles {
|
|
2269
|
+
export const canvas = style({
|
|
2270
|
+
backgroundColor: 'background.primary',
|
|
2271
|
+
borderRadius: 'sm',
|
|
2272
|
+
boxSizing: 'border-box',
|
|
2273
|
+
padding: '12',
|
|
2274
|
+
width: '100% !custom',
|
|
2275
|
+
})
|
|
2276
|
+
|
|
2277
|
+
export const row = style({
|
|
2278
|
+
color: 'content.secondary',
|
|
2279
|
+
display: 'flex',
|
|
2280
|
+
justifyContent: 'space-between',
|
|
2281
|
+
typography: 'body.b2',
|
|
2282
|
+
})
|
|
2283
|
+
|
|
2284
|
+
export const summary = style({ display: 'flex', flexDirection: 'column', rowGap: '12' })
|
|
2285
|
+
|
|
2286
|
+
export const total = style({
|
|
2287
|
+
color: 'content.primary',
|
|
2288
|
+
display: 'flex',
|
|
2289
|
+
justifyContent: 'space-between',
|
|
2290
|
+
typography: 'body.b2Strong',
|
|
2291
|
+
})
|
|
2292
|
+
}
|
|
2293
|
+
```
|
|
2294
|
+
|
|
2295
|
+
### Accessibility
|
|
2296
|
+
|
|
2297
|
+
#### Semantics
|
|
2298
|
+
|
|
2299
|
+
* **Element (separator):** Exposed as a boundary between groups. Some screen readers announce "separator", and others skip it.
|
|
2300
|
+
* **Orientation (aria-orientation):** Follows `orientation`. A vertical separator stretches to the height of its row, at least 1em.
|
|
2301
|
+
* **Label (div):** A separator hides its children from screen readers, so a labeled one renders a `div` without the role. Screen readers read the label in place, and the rules stay hidden.
|
|
2302
|
+
* **No Focus:** Not focusable, with no keyboard behavior.
|
|
2303
|
+
|
|
2304
|
+
#### Your Responsibilities
|
|
2305
|
+
|
|
2306
|
+
* **Use Headings for Structure (SC 1.3.1):** A separator does not [name the group](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html) that follows it.
|
|
2307
|
+
* **Separate Meaningful Groups:** Use it only between meaningful groups. Draw a decorative line with a CSS border.
|
|
2308
|
+
|
|
2309
|
+
### Related
|
|
2310
|
+
|
|
2311
|
+
[Stack](#stack)
|
|
2312
|
+
|
|
2313
|
+
Use for spacing groups apart.
|
|
2314
|
+
|
|
2315
|
+
[ListGroup](data-display.md#listgroup)
|
|
2316
|
+
|
|
2317
|
+
Use for divided lists.
|
|
2318
|
+
|
|
2319
|
+
[Menu](overlays.md#menu)
|
|
2320
|
+
|
|
2321
|
+
Use for separators between menu groups.
|
|
2322
|
+
|
|
2323
|
+
### Examples
|
|
2324
|
+
|
|
2325
|
+
#### Basic
|
|
2326
|
+
|
|
2327
|
+
```tsx
|
|
2328
|
+
import { Separator, style } from '@tempoxyz/ds'
|
|
2329
|
+
|
|
2330
|
+
export const fill = true
|
|
2331
|
+
export function Demo() {
|
|
2332
|
+
return (
|
|
2333
|
+
<div {...styles.stack()}>
|
|
2334
|
+
<span>Above</span>
|
|
2335
|
+
<Separator />
|
|
2336
|
+
<span>Below</span>
|
|
2337
|
+
</div>
|
|
2338
|
+
)
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
namespace styles {
|
|
2342
|
+
export const stack = style({
|
|
2343
|
+
display: 'flex',
|
|
2344
|
+
flexDirection: 'column',
|
|
2345
|
+
gap: '12',
|
|
2346
|
+
maxWidth: '16rem !custom',
|
|
2347
|
+
})
|
|
2348
|
+
}
|
|
2349
|
+
```
|
|
2350
|
+
|
|
2351
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Separator/Basic.tsx)
|
|
2352
|
+
|
|
2353
|
+
#### Orientation
|
|
2354
|
+
|
|
2355
|
+
Set `orientation` to `horizontal` (default) or `vertical`.
|
|
2356
|
+
|
|
2357
|
+
```tsx
|
|
2358
|
+
import { Separator, style } from '@tempoxyz/ds'
|
|
2359
|
+
|
|
2360
|
+
export function Demo() {
|
|
2361
|
+
return (
|
|
2362
|
+
<div {...styles.row()}>
|
|
2363
|
+
<span>Left</span>
|
|
2364
|
+
<Separator orientation="vertical" />
|
|
2365
|
+
<span>Right</span>
|
|
2366
|
+
</div>
|
|
2367
|
+
)
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
namespace styles {
|
|
2371
|
+
export const row = style({ alignItems: 'center', display: 'flex', gap: '12', height: '24' })
|
|
2372
|
+
}
|
|
2373
|
+
```
|
|
2374
|
+
|
|
2375
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Separator/Orientation.tsx)
|
|
2376
|
+
|
|
2377
|
+
#### Label
|
|
2378
|
+
|
|
2379
|
+
Pass a short label as `children` to join two alternatives. A vertical separator ignores it.
|
|
2380
|
+
|
|
2381
|
+
```tsx
|
|
2382
|
+
import { Button, Separator, style } from '@tempoxyz/ds'
|
|
2383
|
+
|
|
2384
|
+
export function Demo() {
|
|
2385
|
+
return (
|
|
2386
|
+
<div {...styles.stack()}>
|
|
2387
|
+
<Button variant="secondary">Continue with passkey</Button>
|
|
2388
|
+
<Separator>or</Separator>
|
|
2389
|
+
<Button variant="secondary">Continue with email</Button>
|
|
2390
|
+
</div>
|
|
2391
|
+
)
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
namespace styles {
|
|
2395
|
+
export const stack = style({ display: 'grid', gap: '16', width: '320' })
|
|
2396
|
+
}
|
|
2397
|
+
```
|
|
2398
|
+
|
|
2399
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Separator/Label.tsx)
|
|
2400
|
+
|
|
2401
|
+
## Stack
|
|
2402
|
+
|
|
2403
|
+
Lays out children in a vertical column.
|
|
2404
|
+
|
|
2405
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Stack.tsx)
|
|
2406
|
+
|
|
2407
|
+
### Overview
|
|
2408
|
+
|
|
2409
|
+
Stack applies a spacing token `gap` between its children and stretches them to its width by default.
|
|
2410
|
+
|
|
2411
|
+
### Anatomy
|
|
2412
|
+
|
|
2413
|
+
Import the component and assemble its parts.
|
|
2414
|
+
|
|
2415
|
+
```tsx
|
|
2416
|
+
import { Stack } from '@tempoxyz/ds'
|
|
2417
|
+
|
|
2418
|
+
<Stack />
|
|
2419
|
+
```
|
|
2420
|
+
|
|
2421
|
+
### Guidelines
|
|
2422
|
+
|
|
2423
|
+
#### When to Use
|
|
2424
|
+
|
|
2425
|
+
* Space siblings vertically, such as form fields, settings sections, or cards in a column.
|
|
2426
|
+
* Place a label above its value, such as Recipient over a 0x address.
|
|
2427
|
+
|
|
2428
|
+
#### When Not to Use
|
|
2429
|
+
|
|
2430
|
+
* Use [Inline](#inline) for a horizontal row.
|
|
2431
|
+
* Use [Grid](#grid) for collections in columns.
|
|
2432
|
+
* Use [ListGroup](data-display.md#listgroup) for a divided list of settings or details.
|
|
2433
|
+
|
|
2434
|
+
#### Use Gap Instead of Margins
|
|
2435
|
+
|
|
2436
|
+
Space siblings with `gap`, not child margins. See [Layout](../foundations.md#layout).
|
|
2437
|
+
|
|
2438
|
+
**Do:** Set one `gap` on the Stack.
|
|
2439
|
+
|
|
2440
|
+
```tsx
|
|
2441
|
+
/** Do example for "Use Gap Instead of Margins" on the Stack page: set one `gap` on the Stack. @module */
|
|
2442
|
+
import { Stack, style, Surface } from '@tempoxyz/ds'
|
|
2443
|
+
|
|
2444
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2445
|
+
export function Demo() {
|
|
2446
|
+
return (
|
|
2447
|
+
<Stack gap="12" {...styles.canvas()}>
|
|
2448
|
+
<Surface size="small">Balance</Surface>
|
|
2449
|
+
<Surface size="small">Activity</Surface>
|
|
2450
|
+
<Surface size="small">Access keys</Surface>
|
|
2451
|
+
</Stack>
|
|
2452
|
+
)
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
namespace styles {
|
|
2456
|
+
export const canvas = style({
|
|
2457
|
+
backgroundColor: 'background.primary',
|
|
2458
|
+
borderRadius: 'sm',
|
|
2459
|
+
boxSizing: 'border-box',
|
|
2460
|
+
padding: '12',
|
|
2461
|
+
width: '100% !custom',
|
|
2462
|
+
})
|
|
2463
|
+
}
|
|
2464
|
+
```
|
|
2465
|
+
|
|
2466
|
+
**Don't:** Set margins on each child, which drift apart and leave space after the last one.
|
|
2467
|
+
|
|
2468
|
+
```tsx
|
|
2469
|
+
/**
|
|
2470
|
+
* Don't example for "Use Gap Instead of Margins" on the Stack page.
|
|
2471
|
+
* Don't set margins on each child, which drift apart and leave space after the last one.
|
|
2472
|
+
* @module
|
|
2473
|
+
*/
|
|
2474
|
+
import { style, Surface } from '@tempoxyz/ds'
|
|
2475
|
+
|
|
2476
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2477
|
+
export function Demo() {
|
|
2478
|
+
return (
|
|
2479
|
+
<div {...styles.canvas()}>
|
|
2480
|
+
<Surface size="small" {...styles.first()}>
|
|
2481
|
+
Balance
|
|
2482
|
+
</Surface>
|
|
2483
|
+
<Surface size="small" {...styles.second()}>
|
|
2484
|
+
Activity
|
|
2485
|
+
</Surface>
|
|
2486
|
+
<Surface size="small" {...styles.third()}>
|
|
2487
|
+
Access keys
|
|
2488
|
+
</Surface>
|
|
2489
|
+
</div>
|
|
2490
|
+
)
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
namespace styles {
|
|
2494
|
+
export const canvas = style({
|
|
2495
|
+
backgroundColor: 'background.primary',
|
|
2496
|
+
borderRadius: 'sm',
|
|
2497
|
+
boxSizing: 'border-box',
|
|
2498
|
+
padding: '12',
|
|
2499
|
+
width: '100% !custom',
|
|
2500
|
+
})
|
|
2501
|
+
|
|
2502
|
+
export const first = style({ marginBlockEnd: '4' })
|
|
2503
|
+
|
|
2504
|
+
export const second = style({ marginBlockEnd: '24' })
|
|
2505
|
+
|
|
2506
|
+
export const third = style({ marginBlockEnd: '16' })
|
|
2507
|
+
}
|
|
2508
|
+
```
|
|
2509
|
+
|
|
2510
|
+
#### Choose Gap by Relationship
|
|
2511
|
+
|
|
2512
|
+
Nest stacks so the space inside a group is smaller than the space between groups, such as `4` between a label and its value and `24` between pairs.
|
|
2513
|
+
|
|
2514
|
+
**Do:** Nest stacks so each label sits closer to its own value.
|
|
2515
|
+
|
|
2516
|
+
```tsx
|
|
2517
|
+
/**
|
|
2518
|
+
* Do example for "Choose Gap by Relationship" on the Stack page.
|
|
2519
|
+
* Nest stacks so each label sits closer to its own value.
|
|
2520
|
+
* @module
|
|
2521
|
+
*/
|
|
2522
|
+
import { Stack, style } from '@tempoxyz/ds'
|
|
2523
|
+
|
|
2524
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2525
|
+
export function Demo() {
|
|
2526
|
+
return (
|
|
2527
|
+
<Stack gap="24" {...styles.column()}>
|
|
2528
|
+
<Stack gap="4">
|
|
2529
|
+
<span {...styles.label()}>Recipient</span>
|
|
2530
|
+
<span {...styles.value()}>0x71C7…976F</span>
|
|
2531
|
+
</Stack>
|
|
2532
|
+
<Stack gap="4">
|
|
2533
|
+
<span {...styles.label()}>Amount</span>
|
|
2534
|
+
<span {...styles.value()}>250.00 USDC</span>
|
|
2535
|
+
</Stack>
|
|
2536
|
+
</Stack>
|
|
2537
|
+
)
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
namespace styles {
|
|
2541
|
+
export const column = style({ width: '100% !custom' })
|
|
2542
|
+
|
|
2543
|
+
export const label = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
2544
|
+
|
|
2545
|
+
export const value = style({ color: 'content.primary', typography: 'body.b1Strong' })
|
|
2546
|
+
}
|
|
2547
|
+
```
|
|
2548
|
+
|
|
2549
|
+
**Don't:** Space every item the same, which hides the groups.
|
|
2550
|
+
|
|
2551
|
+
```tsx
|
|
2552
|
+
/**
|
|
2553
|
+
* Don't example for "Choose Gap by Relationship" on the Stack page.
|
|
2554
|
+
* Don't space every item the same, which hides the groups.
|
|
2555
|
+
* @module
|
|
2556
|
+
*/
|
|
2557
|
+
import { Stack, style } from '@tempoxyz/ds'
|
|
2558
|
+
|
|
2559
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2560
|
+
export function Demo() {
|
|
2561
|
+
return (
|
|
2562
|
+
<Stack gap="16" {...styles.column()}>
|
|
2563
|
+
<span {...styles.label()}>Recipient</span>
|
|
2564
|
+
<span {...styles.value()}>0x71C7…976F</span>
|
|
2565
|
+
<span {...styles.label()}>Amount</span>
|
|
2566
|
+
<span {...styles.value()}>250.00 USDC</span>
|
|
2567
|
+
</Stack>
|
|
2568
|
+
)
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
namespace styles {
|
|
2572
|
+
export const column = style({ width: '100% !custom' })
|
|
2573
|
+
|
|
2574
|
+
export const label = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
2575
|
+
|
|
2576
|
+
export const value = style({ color: 'content.primary', typography: 'body.b1Strong' })
|
|
2577
|
+
}
|
|
2578
|
+
```
|
|
2579
|
+
|
|
2580
|
+
### Accessibility
|
|
2581
|
+
|
|
2582
|
+
Stack adds no role, name, or keyboard behavior.
|
|
2583
|
+
|
|
2584
|
+
#### Semantics
|
|
2585
|
+
|
|
2586
|
+
* **Element (div):** Carries no role by default.
|
|
2587
|
+
* **Render (render):** Swaps in a semantic element, such as a nav for links, or a list so screen readers announce the count.
|
|
2588
|
+
|
|
2589
|
+
#### Your Responsibilities
|
|
2590
|
+
|
|
2591
|
+
* **Match DOM and Visual Order (SC 1.3.2, SC 2.4.3):** Don't reorder children with CSS. [Reading](https://www.w3.org/WAI/WCAG22/Understanding/meaningful-sequence.html) and [focus](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) order follow the DOM.
|
|
2592
|
+
|
|
2593
|
+
### Related
|
|
2594
|
+
|
|
2595
|
+
[Inline](#inline)
|
|
2596
|
+
|
|
2597
|
+
Use for horizontal rows.
|
|
2598
|
+
|
|
2599
|
+
[Grid](#grid)
|
|
2600
|
+
|
|
2601
|
+
Use for columns of items.
|
|
2602
|
+
|
|
2603
|
+
[Separator](#separator)
|
|
2604
|
+
|
|
2605
|
+
Use for a rule between groups.
|
|
2606
|
+
|
|
2607
|
+
[Layout](../foundations.md#layout)
|
|
2608
|
+
|
|
2609
|
+
Covers the spacing scale.
|
|
2610
|
+
|
|
2611
|
+
### Examples
|
|
2612
|
+
|
|
2613
|
+
#### Basic
|
|
2614
|
+
|
|
2615
|
+
```tsx
|
|
2616
|
+
import { Stack } from '@tempoxyz/ds'
|
|
2617
|
+
|
|
2618
|
+
export function Demo() {
|
|
2619
|
+
return (
|
|
2620
|
+
<Stack gap="12">
|
|
2621
|
+
<span>Card content</span>
|
|
2622
|
+
<span>Second line</span>
|
|
2623
|
+
</Stack>
|
|
2624
|
+
)
|
|
2625
|
+
}
|
|
2626
|
+
```
|
|
2627
|
+
|
|
2628
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Stack/Basic.tsx)
|
|
2629
|
+
|
|
2630
|
+
#### Gap
|
|
2631
|
+
|
|
2632
|
+
Set `gap` to a spacing token. It defaults to `16`.
|
|
2633
|
+
|
|
2634
|
+
```tsx
|
|
2635
|
+
import { Inline, Stack, style } from '@tempoxyz/ds'
|
|
2636
|
+
|
|
2637
|
+
export function Demo() {
|
|
2638
|
+
return (
|
|
2639
|
+
<Inline align="start" gap="32" wrap>
|
|
2640
|
+
{(['4', '12', '24'] as const).map((gap) => (
|
|
2641
|
+
<Stack gap={gap} key={gap}>
|
|
2642
|
+
{[1, 2, 3].map((n) => (
|
|
2643
|
+
<span key={n} {...styles.chip()}>
|
|
2644
|
+
gap {gap}
|
|
2645
|
+
</span>
|
|
2646
|
+
))}
|
|
2647
|
+
</Stack>
|
|
2648
|
+
))}
|
|
2649
|
+
</Inline>
|
|
2650
|
+
)
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
namespace styles {
|
|
2654
|
+
export const chip = style({
|
|
2655
|
+
backgroundColor: 'container.regular',
|
|
2656
|
+
borderRadius: 'full',
|
|
2657
|
+
cornerShape: 'round',
|
|
2658
|
+
paddingBlock: '4',
|
|
2659
|
+
paddingInline: '12',
|
|
2660
|
+
})
|
|
2661
|
+
}
|
|
2662
|
+
```
|
|
2663
|
+
|
|
2664
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Stack/Gap.tsx)
|
|
2665
|
+
|
|
2666
|
+
#### Align
|
|
2667
|
+
|
|
2668
|
+
Set `align` to `start`, `center`, `end`, or `stretch` (default).
|
|
2669
|
+
|
|
2670
|
+
```tsx
|
|
2671
|
+
import { Inline, Stack, style } from '@tempoxyz/ds'
|
|
2672
|
+
|
|
2673
|
+
export function Demo() {
|
|
2674
|
+
return (
|
|
2675
|
+
<Inline align="start" gap="32" wrap>
|
|
2676
|
+
{(['start', 'center', 'end', 'stretch'] as const).map((align) => (
|
|
2677
|
+
<Stack align={align} gap="8" key={align} {...styles.column()}>
|
|
2678
|
+
<span {...styles.chip()}>{align}</span>
|
|
2679
|
+
<span {...styles.chip()}>Second line</span>
|
|
2680
|
+
</Stack>
|
|
2681
|
+
))}
|
|
2682
|
+
</Inline>
|
|
2683
|
+
)
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
namespace styles {
|
|
2687
|
+
export const chip = style({
|
|
2688
|
+
backgroundColor: 'container.regular',
|
|
2689
|
+
borderRadius: 'full',
|
|
2690
|
+
cornerShape: 'round',
|
|
2691
|
+
paddingBlock: '4',
|
|
2692
|
+
paddingInline: '12',
|
|
2693
|
+
})
|
|
2694
|
+
|
|
2695
|
+
export const column = style({ width: '10rem !custom' })
|
|
2696
|
+
}
|
|
2697
|
+
```
|
|
2698
|
+
|
|
2699
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Stack/Align.tsx)
|
|
2700
|
+
|
|
2701
|
+
## Surface
|
|
2702
|
+
|
|
2703
|
+
A card container for grouping related content.
|
|
2704
|
+
|
|
2705
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Surface.tsx)
|
|
2706
|
+
|
|
2707
|
+
Figma: [Content/Card](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-5510)
|
|
2708
|
+
|
|
2709
|
+
### Overview
|
|
2710
|
+
|
|
2711
|
+
A surface renders a `div` with a thin border by default. Its `size` sets the corner radius and the padding to the same value.
|
|
2712
|
+
|
|
2713
|
+
### Anatomy
|
|
2714
|
+
|
|
2715
|
+
Import the component and assemble its parts.
|
|
2716
|
+
|
|
2717
|
+
```tsx
|
|
2718
|
+
import { Surface } from '@tempoxyz/ds'
|
|
2719
|
+
|
|
2720
|
+
<Surface>
|
|
2721
|
+
<Surface.Header>
|
|
2722
|
+
<Surface.Title />
|
|
2723
|
+
</Surface.Header>
|
|
2724
|
+
<Surface.Description />
|
|
2725
|
+
<Surface.Links />
|
|
2726
|
+
</Surface>
|
|
2727
|
+
```
|
|
2728
|
+
|
|
2729
|
+
### Guidelines
|
|
2730
|
+
|
|
2731
|
+
#### When to Use
|
|
2732
|
+
|
|
2733
|
+
* Group related content into a card, such as a wallet's Balance, an Activity list, or an API key's details.
|
|
2734
|
+
* Make a whole card pressable when it leads to one place, such as a project card that opens its dashboard.
|
|
2735
|
+
|
|
2736
|
+
#### When Not to Use
|
|
2737
|
+
|
|
2738
|
+
* Use [Alert](feedback-and-status.md#alert) for a message about a section, and [Banner](feedback-and-status.md#banner) for one about the page.
|
|
2739
|
+
* Use [Dialog](overlays.md#dialog) or [Popover](overlays.md#popover) for content that opens over the page.
|
|
2740
|
+
* Use [Stack](#stack) or [Inset](#inset) to space content without a visible container.
|
|
2741
|
+
* Use [Frame](#frame) inside a surface for a card with a footer of actions.
|
|
2742
|
+
|
|
2743
|
+
#### Name Each Card
|
|
2744
|
+
|
|
2745
|
+
Start a card with a `Surface.Header` that holds a `Surface.Title`. Put a card-level action at the end of the header, such as a `small` `tertiary` [Button](actions.md#button).
|
|
2746
|
+
|
|
2747
|
+
**Do:** Name the card with a `Surface.Title`, and put its action at the end of the header.
|
|
2748
|
+
|
|
2749
|
+
```tsx
|
|
2750
|
+
/**
|
|
2751
|
+
* Do example for "Name Each Card" on the Surface page.
|
|
2752
|
+
* Name the card with a `Surface.Title`, and put its action at the end of the header.
|
|
2753
|
+
* @module
|
|
2754
|
+
*/
|
|
2755
|
+
import { Amount, Button, ListGroup, style, Surface } from '@tempoxyz/ds'
|
|
2756
|
+
|
|
2757
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2758
|
+
export function Demo() {
|
|
2759
|
+
return (
|
|
2760
|
+
<div {...styles.canvas()}>
|
|
2761
|
+
<Surface size="medium">
|
|
2762
|
+
<Surface.Header>
|
|
2763
|
+
<Surface.Title>Balances</Surface.Title>
|
|
2764
|
+
<Button size="small" variant="tertiary">
|
|
2765
|
+
View all
|
|
2766
|
+
</Button>
|
|
2767
|
+
</Surface.Header>
|
|
2768
|
+
<ListGroup dividers={false}>
|
|
2769
|
+
<ListGroup.Row>
|
|
2770
|
+
<ListGroup.Label>USDC</ListGroup.Label>
|
|
2771
|
+
<Amount value="1250.00" />
|
|
2772
|
+
</ListGroup.Row>
|
|
2773
|
+
<ListGroup.Row>
|
|
2774
|
+
<ListGroup.Label>pathUSD</ListGroup.Label>
|
|
2775
|
+
<Amount value="80.25" />
|
|
2776
|
+
</ListGroup.Row>
|
|
2777
|
+
</ListGroup>
|
|
2778
|
+
</Surface>
|
|
2779
|
+
</div>
|
|
2780
|
+
)
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
namespace styles {
|
|
2784
|
+
export const canvas = style({
|
|
2785
|
+
backgroundColor: 'background.primary',
|
|
2786
|
+
borderRadius: 'sm',
|
|
2787
|
+
boxSizing: 'border-box',
|
|
2788
|
+
padding: '12',
|
|
2789
|
+
width: '100% !custom',
|
|
2790
|
+
})
|
|
2791
|
+
}
|
|
2792
|
+
```
|
|
2793
|
+
|
|
2794
|
+
**Don't:** Start a card with its content.
|
|
2795
|
+
|
|
2796
|
+
```tsx
|
|
2797
|
+
/** Don't example for "Name Each Card" on the Surface page. Don't start a card with its content. @module */
|
|
2798
|
+
import { Amount, ListGroup, style, Surface } from '@tempoxyz/ds'
|
|
2799
|
+
|
|
2800
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2801
|
+
export function Demo() {
|
|
2802
|
+
return (
|
|
2803
|
+
<div {...styles.canvas()}>
|
|
2804
|
+
<Surface size="medium">
|
|
2805
|
+
<ListGroup dividers={false}>
|
|
2806
|
+
<ListGroup.Row>
|
|
2807
|
+
<ListGroup.Label>USDC</ListGroup.Label>
|
|
2808
|
+
<Amount value="1250.00" />
|
|
2809
|
+
</ListGroup.Row>
|
|
2810
|
+
<ListGroup.Row>
|
|
2811
|
+
<ListGroup.Label>pathUSD</ListGroup.Label>
|
|
2812
|
+
<Amount value="80.25" />
|
|
2813
|
+
</ListGroup.Row>
|
|
2814
|
+
</ListGroup>
|
|
2815
|
+
</Surface>
|
|
2816
|
+
</div>
|
|
2817
|
+
)
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
namespace styles {
|
|
2821
|
+
export const canvas = style({
|
|
2822
|
+
backgroundColor: 'background.primary',
|
|
2823
|
+
borderRadius: 'sm',
|
|
2824
|
+
boxSizing: 'border-box',
|
|
2825
|
+
padding: '12',
|
|
2826
|
+
width: '100% !custom',
|
|
2827
|
+
})
|
|
2828
|
+
}
|
|
2829
|
+
```
|
|
2830
|
+
|
|
2831
|
+
#### Match Size to Density
|
|
2832
|
+
|
|
2833
|
+
* **Large (24px):** The default, for page cards such as Balances.
|
|
2834
|
+
* **Medium (16px):** For dashboard tiles, such as TPS.
|
|
2835
|
+
* **Small (12px):** For compact tiles, such as Block time.
|
|
2836
|
+
|
|
2837
|
+
Keep one size across cards that sit side by side.
|
|
2838
|
+
|
|
2839
|
+
#### Keep Pressable Cards Free of Other Controls
|
|
2840
|
+
|
|
2841
|
+
A surface rendered as a link or button is one target, and screen readers announce the whole card as one control.
|
|
2842
|
+
|
|
2843
|
+
**Do:** Make the whole card one link with a short title.
|
|
2844
|
+
|
|
2845
|
+
```tsx
|
|
2846
|
+
/**
|
|
2847
|
+
* Do example for "Keep Pressable Cards Free of Other Controls" on the Surface page.
|
|
2848
|
+
* Make the whole card one link with a short title.
|
|
2849
|
+
* @module
|
|
2850
|
+
*/
|
|
2851
|
+
import { style, Surface } from '@tempoxyz/ds'
|
|
2852
|
+
|
|
2853
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2854
|
+
export function Demo() {
|
|
2855
|
+
return (
|
|
2856
|
+
<div {...styles.canvas()}>
|
|
2857
|
+
<Surface render={<a href="#" />} size="medium">
|
|
2858
|
+
<span {...styles.title()}>Production key</span>
|
|
2859
|
+
<span {...styles.meta()}>Created 3 days ago</span>
|
|
2860
|
+
</Surface>
|
|
2861
|
+
</div>
|
|
2862
|
+
)
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
namespace styles {
|
|
2866
|
+
export const canvas = style({
|
|
2867
|
+
backgroundColor: 'background.primary',
|
|
2868
|
+
borderRadius: 'sm',
|
|
2869
|
+
padding: '16',
|
|
2870
|
+
width: '16rem !custom',
|
|
2871
|
+
})
|
|
2872
|
+
|
|
2873
|
+
export const meta = style({ color: 'content.secondary', display: 'block', typography: 'body.b3' })
|
|
2874
|
+
|
|
2875
|
+
export const title = style({ display: 'block', typography: 'body.b1Strong' })
|
|
2876
|
+
}
|
|
2877
|
+
```
|
|
2878
|
+
|
|
2879
|
+
**Don't:** Place a button inside a pressable card.
|
|
2880
|
+
|
|
2881
|
+
```tsx
|
|
2882
|
+
/**
|
|
2883
|
+
* Don't example for "Keep Pressable Cards Free of Other Controls" on the Surface page.
|
|
2884
|
+
* Don't place a button inside a pressable card.
|
|
2885
|
+
* @module
|
|
2886
|
+
*/
|
|
2887
|
+
import { Button, style, Surface } from '@tempoxyz/ds'
|
|
2888
|
+
|
|
2889
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2890
|
+
export function Demo() {
|
|
2891
|
+
return (
|
|
2892
|
+
<div {...styles.canvas()}>
|
|
2893
|
+
<Surface render={<a href="#" />} size="medium">
|
|
2894
|
+
<span {...styles.title()}>Production key</span>
|
|
2895
|
+
<span {...styles.meta()}>Created 3 days ago</span>
|
|
2896
|
+
<Button size="small" {...styles.action()}>
|
|
2897
|
+
Revoke key
|
|
2898
|
+
</Button>
|
|
2899
|
+
</Surface>
|
|
2900
|
+
</div>
|
|
2901
|
+
)
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
namespace styles {
|
|
2905
|
+
export const action = style({ marginBlockStart: '12' })
|
|
2906
|
+
|
|
2907
|
+
export const canvas = style({
|
|
2908
|
+
backgroundColor: 'background.primary',
|
|
2909
|
+
borderRadius: 'sm',
|
|
2910
|
+
padding: '16',
|
|
2911
|
+
width: '16rem !custom',
|
|
2912
|
+
})
|
|
2913
|
+
|
|
2914
|
+
export const meta = style({ color: 'content.secondary', display: 'block', typography: 'body.b3' })
|
|
2915
|
+
|
|
2916
|
+
export const title = style({ display: 'block', typography: 'body.b1Strong' })
|
|
2917
|
+
}
|
|
2918
|
+
```
|
|
2919
|
+
|
|
2920
|
+
#### Don't Nest Surfaces
|
|
2921
|
+
|
|
2922
|
+
Divide the content of one surface with [ListGroup](data-display.md#listgroup), a [Table](data-display.md#table), or a [Separator](#separator). A table placed directly inside a surface bleeds 12px into its padding, so its rows end 12px inside the edges of a large surface and its text stays on the content edge. The surface draws no border around it.
|
|
2923
|
+
|
|
2924
|
+
**Do:** Divide one surface with ListGroup.
|
|
2925
|
+
|
|
2926
|
+
```tsx
|
|
2927
|
+
/** Do example for "Don't Nest Surfaces" on the Surface page: divide one surface with ListGroup. @module */
|
|
2928
|
+
import { Amount, Hex, ListGroup, style, Surface } from '@tempoxyz/ds'
|
|
2929
|
+
|
|
2930
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2931
|
+
export function Demo() {
|
|
2932
|
+
return (
|
|
2933
|
+
<div {...styles.canvas()}>
|
|
2934
|
+
<Surface size="medium">
|
|
2935
|
+
<ListGroup>
|
|
2936
|
+
<ListGroup.Row>
|
|
2937
|
+
<ListGroup.Label>Amount</ListGroup.Label>
|
|
2938
|
+
<Amount symbol="USDC" value="48.50" />
|
|
2939
|
+
</ListGroup.Row>
|
|
2940
|
+
<ListGroup.Row>
|
|
2941
|
+
<ListGroup.Label>Recipient</ListGroup.Label>
|
|
2942
|
+
<Hex value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
|
|
2943
|
+
</ListGroup.Row>
|
|
2944
|
+
</ListGroup>
|
|
2945
|
+
</Surface>
|
|
2946
|
+
</div>
|
|
2947
|
+
)
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
namespace styles {
|
|
2951
|
+
export const canvas = style({
|
|
2952
|
+
backgroundColor: 'background.primary',
|
|
2953
|
+
borderRadius: 'sm',
|
|
2954
|
+
boxSizing: 'border-box',
|
|
2955
|
+
padding: '12',
|
|
2956
|
+
width: '100% !custom',
|
|
2957
|
+
})
|
|
2958
|
+
}
|
|
2959
|
+
```
|
|
2960
|
+
|
|
2961
|
+
**Don't:** Place surfaces inside a surface.
|
|
2962
|
+
|
|
2963
|
+
```tsx
|
|
2964
|
+
/** Don't example for "Don't Nest Surfaces" on the Surface page. Don't place surfaces inside a surface. @module */
|
|
2965
|
+
import { Amount, Hex, style, Surface } from '@tempoxyz/ds'
|
|
2966
|
+
|
|
2967
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
2968
|
+
export function Demo() {
|
|
2969
|
+
return (
|
|
2970
|
+
<div {...styles.canvas()}>
|
|
2971
|
+
<Surface size="medium" {...styles.outer()}>
|
|
2972
|
+
<Surface size="small" {...styles.row()}>
|
|
2973
|
+
<span>Amount</span>
|
|
2974
|
+
<Amount symbol="USDC" value="48.50" />
|
|
2975
|
+
</Surface>
|
|
2976
|
+
<Surface size="small" {...styles.row()}>
|
|
2977
|
+
<span>Recipient</span>
|
|
2978
|
+
<Hex value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
|
|
2979
|
+
</Surface>
|
|
2980
|
+
</Surface>
|
|
2981
|
+
</div>
|
|
2982
|
+
)
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
namespace styles {
|
|
2986
|
+
export const canvas = style({
|
|
2987
|
+
backgroundColor: 'background.primary',
|
|
2988
|
+
borderRadius: 'sm',
|
|
2989
|
+
boxSizing: 'border-box',
|
|
2990
|
+
padding: '12',
|
|
2991
|
+
width: '100% !custom',
|
|
2992
|
+
})
|
|
2993
|
+
|
|
2994
|
+
export const outer = style({ display: 'flex', flexDirection: 'column', gap: '8' })
|
|
2995
|
+
|
|
2996
|
+
export const row = style({
|
|
2997
|
+
alignItems: 'center',
|
|
2998
|
+
backgroundColor: 'container.regular',
|
|
2999
|
+
display: 'flex',
|
|
3000
|
+
justifyContent: 'space-between',
|
|
3001
|
+
})
|
|
3002
|
+
}
|
|
3003
|
+
```
|
|
3004
|
+
|
|
3005
|
+
### Content
|
|
3006
|
+
|
|
3007
|
+
* Write titles as short nouns, such as Balances, Activity, or Routes.
|
|
3008
|
+
* Keep `Surface.Description` to one or two sentences.
|
|
3009
|
+
* Use `Surface.Links` for two or three follow-up tasks, written as verbs, such as Make a transfer.
|
|
3010
|
+
|
|
3011
|
+
### Accessibility
|
|
3012
|
+
|
|
3013
|
+
A surface takes its semantics from the element you render, such as a `section`, a `button`, or a link.
|
|
3014
|
+
|
|
3015
|
+
#### Semantics
|
|
3016
|
+
|
|
3017
|
+
* **Default Element (div):** Carries no role.
|
|
3018
|
+
* **Surface.Title (h2):** Lets screen reader users find the card by heading.
|
|
3019
|
+
* **Surface.Description (p):** A plain paragraph under the title.
|
|
3020
|
+
* **Pressable Cards (button or link):** The whole card becomes one control, named by its text.
|
|
3021
|
+
* **Disabled (aria-disabled):** Dims the card and drops pointer events. Only a button also stops keyboard activation.
|
|
3022
|
+
|
|
3023
|
+
#### Keyboard
|
|
3024
|
+
|
|
3025
|
+
For a pressable surface rendered as a button or link:
|
|
3026
|
+
|
|
3027
|
+
* **Move Focus to the Card (Tab):** Moves focus to the card.
|
|
3028
|
+
* **Activate a Link or Button (Enter):** Activates a link or button card.
|
|
3029
|
+
* **Activate a Button (Space):** Activates a button card.
|
|
3030
|
+
|
|
3031
|
+
#### Your Responsibilities
|
|
3032
|
+
|
|
3033
|
+
* **Name Regions (aria-labelledby):** If the card is a distinct region, render a section labelled by its title.
|
|
3034
|
+
* **Fit the Outline (h2):** Place cards where their title's heading level fits the page outline.
|
|
3035
|
+
* **Keep Pressable Text Short:** The card's full content becomes its accessible name, so keep its text short.
|
|
3036
|
+
* **Disabling Link Cards (href):** A link can't be disabled. Remove its `href` when it must not work.
|
|
3037
|
+
|
|
3038
|
+
### Related
|
|
3039
|
+
|
|
3040
|
+
[Frame](#frame)
|
|
3041
|
+
|
|
3042
|
+
Use for a header, body, and footer inside a card.
|
|
3043
|
+
|
|
3044
|
+
[ListGroup](data-display.md#listgroup)
|
|
3045
|
+
|
|
3046
|
+
Use for divided content in a card.
|
|
3047
|
+
|
|
3048
|
+
[Grid](#grid)
|
|
3049
|
+
|
|
3050
|
+
Use for laying out several cards.
|
|
3051
|
+
|
|
3052
|
+
[Dashboards](../patterns.md#dashboards)
|
|
3053
|
+
|
|
3054
|
+
Covers metric tiles.
|
|
3055
|
+
|
|
3056
|
+
### Examples
|
|
3057
|
+
|
|
3058
|
+
#### Basic
|
|
3059
|
+
|
|
3060
|
+
```tsx
|
|
3061
|
+
import { style, Surface } from '@tempoxyz/ds'
|
|
3062
|
+
import { SwapHorizontal } from '@tempoxyz/ds/icons'
|
|
3063
|
+
|
|
3064
|
+
export function Demo() {
|
|
3065
|
+
return (
|
|
3066
|
+
<div {...styles.grid()}>
|
|
3067
|
+
<Surface>
|
|
3068
|
+
<Surface.Header>
|
|
3069
|
+
<Surface.Title>
|
|
3070
|
+
<SwapHorizontal />
|
|
3071
|
+
Routes
|
|
3072
|
+
</Surface.Title>
|
|
3073
|
+
</Surface.Header>
|
|
3074
|
+
<Surface.Description>
|
|
3075
|
+
Move stablecoins between Tempo and other networks.
|
|
3076
|
+
</Surface.Description>
|
|
3077
|
+
<Surface.Links>
|
|
3078
|
+
<a href="#basic">Make a transfer</a>
|
|
3079
|
+
<a href="#basic">Accept deposits</a>
|
|
3080
|
+
<a href="#basic">Supported routes</a>
|
|
3081
|
+
</Surface.Links>
|
|
3082
|
+
</Surface>
|
|
3083
|
+
</div>
|
|
3084
|
+
)
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
namespace styles {
|
|
3088
|
+
export const grid = style({
|
|
3089
|
+
alignItems: 'start',
|
|
3090
|
+
backgroundColor: 'background.primary',
|
|
3091
|
+
display: 'grid',
|
|
3092
|
+
gap: '12',
|
|
3093
|
+
padding: '16',
|
|
3094
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(14rem, 1fr)) !custom',
|
|
3095
|
+
})
|
|
3096
|
+
}
|
|
3097
|
+
```
|
|
3098
|
+
|
|
3099
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Surface/Basic.tsx)
|
|
3100
|
+
|
|
3101
|
+
#### Header
|
|
3102
|
+
|
|
3103
|
+
Place a `Surface.Title` and an optional action inside `Surface.Header`.
|
|
3104
|
+
|
|
3105
|
+
```tsx
|
|
3106
|
+
import { Button, style, Surface, TokenLogo } from '@tempoxyz/ds'
|
|
3107
|
+
|
|
3108
|
+
const balances = [
|
|
3109
|
+
['Bridged USDC (Stargate)', '0x20c000000000000000000000b9537d11c60e8b50', '$2.02'],
|
|
3110
|
+
['pathUSD', '0x20c0000000000000000000000000000000000000', '$0.12'],
|
|
3111
|
+
['USDT0', '0x20c00000000000000000000014f22ca97301eb73', '$0.10'],
|
|
3112
|
+
] as const
|
|
3113
|
+
|
|
3114
|
+
export function Demo() {
|
|
3115
|
+
return (
|
|
3116
|
+
<div {...styles.grid()}>
|
|
3117
|
+
<Surface>
|
|
3118
|
+
<Surface.Header>
|
|
3119
|
+
<Surface.Title>Balances</Surface.Title>
|
|
3120
|
+
<Button size="small" variant="tertiary">
|
|
3121
|
+
View all
|
|
3122
|
+
</Button>
|
|
3123
|
+
</Surface.Header>
|
|
3124
|
+
{balances.map(([name, address, amount]) => (
|
|
3125
|
+
<div key={address} {...styles.balance()}>
|
|
3126
|
+
<TokenLogo address={address} />
|
|
3127
|
+
<span {...styles.name()}>{name}</span>
|
|
3128
|
+
{amount}
|
|
3129
|
+
</div>
|
|
3130
|
+
))}
|
|
3131
|
+
</Surface>
|
|
3132
|
+
</div>
|
|
3133
|
+
)
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
namespace styles {
|
|
3137
|
+
export const balance = style({
|
|
3138
|
+
alignItems: 'center',
|
|
3139
|
+
columnGap: '12',
|
|
3140
|
+
display: 'flex',
|
|
3141
|
+
paddingBlock: '8',
|
|
3142
|
+
typography: 'body.b1Strong',
|
|
3143
|
+
})
|
|
3144
|
+
|
|
3145
|
+
export const grid = style({
|
|
3146
|
+
backgroundColor: 'background.primary',
|
|
3147
|
+
display: 'grid',
|
|
3148
|
+
padding: '16',
|
|
3149
|
+
})
|
|
3150
|
+
|
|
3151
|
+
export const name = style({ flex: '1 !custom' })
|
|
3152
|
+
}
|
|
3153
|
+
```
|
|
3154
|
+
|
|
3155
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Surface/Header.tsx)
|
|
3156
|
+
|
|
3157
|
+
#### List
|
|
3158
|
+
|
|
3159
|
+
A [ListGroup](data-display.md#listgroup) inside a surface bleeds into its padding, so a row's hover fill reaches the edges of the surface. Each row is 44px, and a [Select](forms-and-inputs.md#select) in a row hugs its value at the end of the row.
|
|
3160
|
+
|
|
3161
|
+
```tsx
|
|
3162
|
+
/** Renders a small surface whose list holds a network picker and a row of token logos, for the Surface docs. @module */
|
|
3163
|
+
import { ListGroup, NetworkLogo, Select, style, Surface, TokenLogo } from '@tempoxyz/ds'
|
|
3164
|
+
|
|
3165
|
+
const networks = [
|
|
3166
|
+
{ available: true, id: 'tempo', name: 'Tempo' },
|
|
3167
|
+
{ available: false, id: 'ethereum', name: 'Ethereum' },
|
|
3168
|
+
{ available: false, id: 'base', name: 'Base' },
|
|
3169
|
+
] as const
|
|
3170
|
+
|
|
3171
|
+
const stablecoins = [
|
|
3172
|
+
['pathUSD', '0x20c0000000000000000000000000000000000000'],
|
|
3173
|
+
['Bridged USDC (Stargate)', '0x20c000000000000000000000b9537d11c60e8b50'],
|
|
3174
|
+
['USDT0', '0x20c00000000000000000000014f22ca97301eb73'],
|
|
3175
|
+
] as const
|
|
3176
|
+
|
|
3177
|
+
export function Demo() {
|
|
3178
|
+
return (
|
|
3179
|
+
<div {...styles.grid()}>
|
|
3180
|
+
<Surface size="small">
|
|
3181
|
+
<ListGroup>
|
|
3182
|
+
<ListGroup.Row>
|
|
3183
|
+
<ListGroup.Label id="surface-list-network">Network</ListGroup.Label>
|
|
3184
|
+
<Select.Root value="tempo">
|
|
3185
|
+
<Select.Trigger aria-labelledby="surface-list-network">
|
|
3186
|
+
<Select.Value>
|
|
3187
|
+
{() => (
|
|
3188
|
+
<span {...styles.value()}>
|
|
3189
|
+
<NetworkLogo network="tempo" size="medium" />
|
|
3190
|
+
Tempo
|
|
3191
|
+
</span>
|
|
3192
|
+
)}
|
|
3193
|
+
</Select.Value>
|
|
3194
|
+
<Select.Icon />
|
|
3195
|
+
</Select.Trigger>
|
|
3196
|
+
<Select.Popup align="end">
|
|
3197
|
+
{networks.map((network) => (
|
|
3198
|
+
<Select.Item disabled={!network.available} key={network.id} value={network.id}>
|
|
3199
|
+
<Select.ItemPrefix>
|
|
3200
|
+
<NetworkLogo network={network.id} size="medium" />
|
|
3201
|
+
</Select.ItemPrefix>
|
|
3202
|
+
<Select.ItemText>{network.name}</Select.ItemText>
|
|
3203
|
+
{network.available ? null : <Select.ItemSuffix>Coming soon</Select.ItemSuffix>}
|
|
3204
|
+
</Select.Item>
|
|
3205
|
+
))}
|
|
3206
|
+
</Select.Popup>
|
|
3207
|
+
</Select.Root>
|
|
3208
|
+
</ListGroup.Row>
|
|
3209
|
+
<ListGroup.Row>
|
|
3210
|
+
<ListGroup.Label>Supported stablecoins</ListGroup.Label>
|
|
3211
|
+
<span {...styles.coins()}>
|
|
3212
|
+
{stablecoins.map(([symbol, address]) => (
|
|
3213
|
+
<TokenLogo address={address} alt={symbol} key={address} />
|
|
3214
|
+
))}
|
|
3215
|
+
</span>
|
|
3216
|
+
</ListGroup.Row>
|
|
3217
|
+
</ListGroup>
|
|
3218
|
+
</Surface>
|
|
3219
|
+
</div>
|
|
3220
|
+
)
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
namespace styles {
|
|
3224
|
+
export const coins = style({ display: 'flex', gap: '4', marginInlineStart: 'auto !custom' })
|
|
3225
|
+
|
|
3226
|
+
export const grid = style({ display: 'grid', maxWidth: '25rem !custom', width: '100% !custom' })
|
|
3227
|
+
|
|
3228
|
+
export const value = style({ alignItems: 'center', display: 'flex', gap: '8' })
|
|
3229
|
+
}
|
|
3230
|
+
```
|
|
3231
|
+
|
|
3232
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Surface/List.tsx)
|
|
3233
|
+
|
|
3234
|
+
#### Size
|
|
3235
|
+
|
|
3236
|
+
Set `size` to `small`, `medium`, or `large` (default).
|
|
3237
|
+
|
|
3238
|
+
```tsx
|
|
3239
|
+
import { style, Surface } from '@tempoxyz/ds'
|
|
3240
|
+
|
|
3241
|
+
export function Demo() {
|
|
3242
|
+
return (
|
|
3243
|
+
<div {...styles.grid()}>
|
|
3244
|
+
{(['large', 'medium', 'small'] as const).map((size) => (
|
|
3245
|
+
<Surface key={size} size={size}>
|
|
3246
|
+
Size {size}
|
|
3247
|
+
</Surface>
|
|
3248
|
+
))}
|
|
3249
|
+
</div>
|
|
3250
|
+
)
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
namespace styles {
|
|
3254
|
+
// Surfaces keep their content height instead of stretching to the tallest one in a row.
|
|
3255
|
+
export const grid = style({
|
|
3256
|
+
alignItems: 'start',
|
|
3257
|
+
backgroundColor: 'background.primary',
|
|
3258
|
+
display: 'grid',
|
|
3259
|
+
gap: '12',
|
|
3260
|
+
padding: '16',
|
|
3261
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(14rem, 1fr)) !custom',
|
|
3262
|
+
})
|
|
3263
|
+
}
|
|
3264
|
+
```
|
|
3265
|
+
|
|
3266
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Surface/Size.tsx)
|
|
3267
|
+
|
|
3268
|
+
#### Render
|
|
3269
|
+
|
|
3270
|
+
Pass a `button` or link to `render` for a pressable surface with hover, press, and focus styles.
|
|
3271
|
+
|
|
3272
|
+
```tsx
|
|
3273
|
+
import { style, Surface } from '@tempoxyz/ds'
|
|
3274
|
+
import { SwapHorizontal } from '@tempoxyz/ds/icons'
|
|
3275
|
+
|
|
3276
|
+
export function Demo() {
|
|
3277
|
+
return (
|
|
3278
|
+
<div {...styles.grid()}>
|
|
3279
|
+
<Surface render={<a href="#render" />}>
|
|
3280
|
+
<Surface.Header>
|
|
3281
|
+
<Surface.Title>
|
|
3282
|
+
<SwapHorizontal />
|
|
3283
|
+
Routes
|
|
3284
|
+
</Surface.Title>
|
|
3285
|
+
</Surface.Header>
|
|
3286
|
+
<Surface.Description>
|
|
3287
|
+
Move stablecoins between Tempo and other networks.
|
|
3288
|
+
</Surface.Description>
|
|
3289
|
+
</Surface>
|
|
3290
|
+
<Surface render={<button type="button" />}>Interactive button</Surface>
|
|
3291
|
+
<Surface render={<a href="#render" />}>Interactive link</Surface>
|
|
3292
|
+
</div>
|
|
3293
|
+
)
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
namespace styles {
|
|
3297
|
+
// Surfaces keep their content height instead of stretching to the tallest one in a row.
|
|
3298
|
+
export const grid = style({
|
|
3299
|
+
alignItems: 'start',
|
|
3300
|
+
backgroundColor: 'background.primary',
|
|
3301
|
+
display: 'grid',
|
|
3302
|
+
gap: '12',
|
|
3303
|
+
padding: '16',
|
|
3304
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(14rem, 1fr)) !custom',
|
|
3305
|
+
})
|
|
3306
|
+
}
|
|
3307
|
+
```
|
|
3308
|
+
|
|
3309
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Surface/Render.tsx)
|
|
3310
|
+
|
|
3311
|
+
#### Disabled
|
|
3312
|
+
|
|
3313
|
+
Set `disabled` on a pressable surface to block interaction.
|
|
3314
|
+
|
|
3315
|
+
```tsx
|
|
3316
|
+
import { style, Surface } from '@tempoxyz/ds'
|
|
3317
|
+
|
|
3318
|
+
export function Demo() {
|
|
3319
|
+
return (
|
|
3320
|
+
<div {...styles.grid()}>
|
|
3321
|
+
<Surface disabled render={<button type="button" />}>
|
|
3322
|
+
Disabled button
|
|
3323
|
+
</Surface>
|
|
3324
|
+
</div>
|
|
3325
|
+
)
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
namespace styles {
|
|
3329
|
+
export const grid = style({
|
|
3330
|
+
alignItems: 'start',
|
|
3331
|
+
backgroundColor: 'background.primary',
|
|
3332
|
+
display: 'grid',
|
|
3333
|
+
padding: '16',
|
|
3334
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(14rem, 1fr)) !custom',
|
|
3335
|
+
})
|
|
3336
|
+
}
|
|
3337
|
+
```
|
|
3338
|
+
|
|
3339
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Surface/Disabled.tsx)
|