@tempoxyz/ds 0.3.10 → 0.3.11
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 +9 -0
- package/dist/docs/components/accordion.md +489 -0
- package/dist/docs/components/address-card.md +147 -0
- package/dist/docs/components/agent-logo.md +194 -0
- package/dist/docs/components/alert-dialog.md +631 -0
- package/dist/docs/components/alert.md +448 -0
- package/dist/docs/components/amount-input.md +305 -0
- package/dist/docs/components/amount.md +794 -0
- package/dist/docs/components/app-shell.md +559 -0
- package/dist/docs/components/asset-chip.md +294 -0
- package/dist/docs/components/autocomplete.md +619 -0
- package/dist/docs/components/avatar.md +321 -0
- package/dist/docs/components/badge.md +339 -0
- package/dist/docs/components/badged-logo.md +116 -0
- package/dist/docs/components/banner.md +379 -0
- package/dist/docs/components/bar-chart.md +208 -0
- package/dist/docs/components/breadcrumbs.md +380 -0
- package/dist/docs/components/button-group.md +286 -0
- package/dist/docs/components/button.md +650 -0
- package/dist/docs/components/calendar.md +375 -0
- package/dist/docs/components/callout.md +96 -0
- package/dist/docs/components/checkbox-group.md +521 -0
- package/dist/docs/components/checkbox.md +467 -0
- package/dist/docs/components/choice-group.md +516 -0
- package/dist/docs/components/choicebox.md +641 -0
- package/dist/docs/components/code.md +100 -0
- package/dist/docs/components/combobox.md +939 -0
- package/dist/docs/components/container.md +257 -0
- package/dist/docs/components/copy-button.md +642 -0
- package/dist/docs/components/date-picker.md +514 -0
- package/dist/docs/components/dialog.md +1332 -0
- package/dist/docs/components/drawer.md +966 -0
- package/dist/docs/components/empty.md +340 -0
- package/dist/docs/components/field.md +570 -0
- package/dist/docs/components/fieldset.md +398 -0
- package/dist/docs/components/frame.md +434 -0
- package/dist/docs/components/gauge.md +299 -0
- package/dist/docs/components/get-started-visual.md +117 -0
- package/dist/docs/components/grid.md +288 -0
- package/dist/docs/components/hero-visual.md +155 -0
- package/dist/docs/components/hex.md +487 -0
- package/dist/docs/components/icon-tile.md +292 -0
- package/dist/docs/components/identicon.md +371 -0
- package/dist/docs/components/inline.md +233 -0
- package/dist/docs/components/inset.md +225 -0
- package/dist/docs/components/kbd.md +423 -0
- package/dist/docs/components/list-group.md +981 -0
- package/dist/docs/components/loading-dots.md +237 -0
- package/dist/docs/components/menu.md +934 -0
- package/dist/docs/components/native-select.md +204 -0
- package/dist/docs/components/network-logo.md +248 -0
- package/dist/docs/components/number-field.md +543 -0
- package/dist/docs/components/otp-field.md +616 -0
- package/dist/docs/components/pagination.md +516 -0
- package/dist/docs/components/popover.md +544 -0
- package/dist/docs/components/progress.md +388 -0
- package/dist/docs/components/qr.md +314 -0
- package/dist/docs/components/radio-group.md +528 -0
- package/dist/docs/components/secret-value.md +406 -0
- package/dist/docs/components/select.md +751 -0
- package/dist/docs/components/separator.md +379 -0
- package/dist/docs/components/sidebar-menu.md +922 -0
- package/dist/docs/components/skeleton.md +517 -0
- package/dist/docs/components/slider.md +539 -0
- package/dist/docs/components/snippet.md +424 -0
- package/dist/docs/components/spinner.md +216 -0
- package/dist/docs/components/split-bar.md +139 -0
- package/dist/docs/components/split-button.md +464 -0
- package/dist/docs/components/stack.md +299 -0
- package/dist/docs/components/status-chip.md +226 -0
- package/dist/docs/components/status-indicator.md +119 -0
- package/dist/docs/components/status-row.md +174 -0
- package/dist/docs/components/stepper.md +451 -0
- package/dist/docs/components/success-hero.md +157 -0
- package/dist/docs/components/surface.md +639 -0
- package/dist/docs/components/switch.md +472 -0
- package/dist/docs/components/table.md +967 -0
- package/dist/docs/components/tabs.md +627 -0
- package/dist/docs/components/tempo-logo.md +185 -0
- package/dist/docs/components/text-input.md +624 -0
- package/dist/docs/components/textarea.md +352 -0
- package/dist/docs/components/toast.md +535 -0
- package/dist/docs/components/token-logo.md +371 -0
- package/dist/docs/components/token.md +247 -0
- package/dist/docs/components/tooltip.md +490 -0
- package/dist/docs/components/verification-code.md +116 -0
- package/dist/docs/components/visual.md +249 -0
- package/dist/docs/components.md +203 -0
- package/dist/docs/foundations/accessibility.md +377 -0
- package/dist/docs/foundations/agents.md +150 -0
- package/dist/docs/foundations/color.md +522 -0
- package/dist/docs/foundations/content/tone.md +194 -0
- package/dist/docs/foundations/content/voice.md +194 -0
- package/dist/docs/foundations/content/writing-style.md +406 -0
- package/dist/docs/foundations/iconography.md +282 -0
- package/dist/docs/foundations/intent.md +360 -0
- package/dist/docs/foundations/layout.md +508 -0
- package/dist/docs/foundations/linter.md +296 -0
- package/dist/docs/foundations/motion.md +151 -0
- package/dist/docs/foundations/radius-and-padding.md +86 -0
- package/dist/docs/foundations/typography.md +266 -0
- package/dist/docs/index.md +137 -0
- package/dist/docs/introduction/faq.md +132 -0
- package/dist/docs/introduction/getting-started.md +377 -0
- package/dist/docs/patterns/blockchain-values.md +709 -0
- package/dist/docs/patterns/dashboards.md +638 -0
- package/dist/docs/patterns/destructive-actions.md +626 -0
- package/dist/docs/patterns/empty-states.md +612 -0
- package/dist/docs/patterns/errors-and-validation.md +808 -0
- package/dist/docs/patterns/feedback-and-status.md +518 -0
- package/dist/docs/patterns/forms.md +679 -0
- package/dist/docs/patterns/loading.md +630 -0
- package/dist/docs/patterns/navigation.md +397 -0
- package/dist/docs/patterns/payments.md +765 -0
- package/dist/docs/patterns/responsive-layout.md +997 -0
- package/dist/docs/patterns/tables-and-lists.md +964 -0
- package/dist/docs/products/tempo-console.md +671 -0
- package/dist/docs/products/tempo-performance.md +437 -0
- package/dist/docs/products/tempo-wallet.md +438 -0
- package/package.json +1 -1
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
# Layout
|
|
2
|
+
|
|
3
|
+
Page structure, grid, spacing, radius, and elevation.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Tempo pages are calm and orderly. Flat cards sit on a tinted page, line up on a twelve-column grid, and keep generous space between groups, so the content stands out more than its frame.
|
|
8
|
+
|
|
9
|
+
Space follows relationships. Elements sit close within a group, further apart between groups, and furthest apart between sections. As the screen widens, the margins grow and the sidebar opens, while the content keeps a comfortable width.
|
|
10
|
+
|
|
11
|
+
For page frames and width changes, see [Responsive Layout](/docs/patterns/responsive-layout).
|
|
12
|
+
|
|
13
|
+
## Page Structure
|
|
14
|
+
|
|
15
|
+
Every page shares one frame, which [App Shell](/docs/components/app-shell) provides.
|
|
16
|
+
|
|
17
|
+
* **Sidebar:** Navigation on the start edge, which moves into a drawer on small screens.
|
|
18
|
+
* **Top Bar:** The page title and its main action, in one bar above the content.
|
|
19
|
+
* **Content:** Cards, charts, and tables, arranged on the page grid below the bar.
|
|
20
|
+
|
|
21
|
+
## Grid
|
|
22
|
+
|
|
23
|
+
Wide pages divide into twelve columns. Each card, chart, and table takes a share of them, and every row keeps the same gutters. [Grid](/docs/components/grid) lays out the columns.
|
|
24
|
+
|
|
25
|
+
* **Summary Cards (3 of 12):** Key figures in a row of equal cards.
|
|
26
|
+
* **Chart and Panel (8 and 4):** A wide chart beside a narrow panel.
|
|
27
|
+
* **Tables (12 of 12):** Lists and tables across the full width.
|
|
28
|
+
* **Small Screens (phone):** Cards pair up, and panels stack.
|
|
29
|
+
|
|
30
|
+
## Spacing
|
|
31
|
+
|
|
32
|
+
Spacing comes from one scale of steps. Pick a step by how closely the elements relate: the closer the relationship, the smaller the gap.
|
|
33
|
+
|
|
34
|
+
* **Related Elements (4 to 8):** An icon and its label, or a label and its value.
|
|
35
|
+
* **Items and Fields (12 to 16):** Items in a list, fields in a form, and buttons.
|
|
36
|
+
* **Groups and Cards (24 to 32):** Groups within a section, such as cards in a grid.
|
|
37
|
+
* **Page Sections (40 to 64):** The sections of a page, such as a table.
|
|
38
|
+
|
|
39
|
+
## Radius
|
|
40
|
+
|
|
41
|
+
Larger elements get rounder corners, from fields at 12px to modals at 32px. [Radius and Padding](/docs/foundations/radius-and-padding) covers each role and its padding.
|
|
42
|
+
|
|
43
|
+
* `none`: `0rem`
|
|
44
|
+
* `3xs`: `calc(0.25rem * var(--tds-corner-scale, 1))`
|
|
45
|
+
* `2xs`: `calc(0.5rem * var(--tds-corner-scale, 1))`
|
|
46
|
+
* `xs`: `calc(0.75rem * var(--tds-corner-scale, 1))`
|
|
47
|
+
* `sm`: `calc(1rem * var(--tds-corner-scale, 1))`
|
|
48
|
+
* `md`: `calc(1.5rem * var(--tds-corner-scale, 1))`
|
|
49
|
+
* `lg`: `calc(2rem * var(--tds-corner-scale, 1))`
|
|
50
|
+
* `xl`: `calc(2.5rem * var(--tds-corner-scale, 1))`
|
|
51
|
+
* `2xl`: `calc(4rem * var(--tds-corner-scale, 1))`
|
|
52
|
+
* `full`: `62.4375rem`
|
|
53
|
+
|
|
54
|
+
## Elevation
|
|
55
|
+
|
|
56
|
+
Shadows mark layers that float above the page, and most surfaces need none. In dark mode, a layer lifts with a lighter surface rather than a deeper shadow.
|
|
57
|
+
|
|
58
|
+
* **Flat (none):** Cards and panels, which sit flat on the page.
|
|
59
|
+
* **Small (shadow.small):** Controls that lift off a track, such as a switch thumb.
|
|
60
|
+
* **Regular (shadow.regular):** Menus, toasts, and other popups over the page.
|
|
61
|
+
* **Large (shadow.large):** Dialogs and drawers, above the dimmed page.
|
|
62
|
+
|
|
63
|
+
## Widths
|
|
64
|
+
|
|
65
|
+
[Container](/docs/components/container) centers content at a maximum width, with side gutters that grow on larger screens. Pick its size by the content, not by the screen.
|
|
66
|
+
|
|
67
|
+
* **Narrow (48rem):** Forms, settings, and single-task flows.
|
|
68
|
+
* **Medium (64rem):** Detail pages, such as a transaction or an API key.
|
|
69
|
+
* **Wide (80rem):** The default, for dashboards, tables, and card grids.
|
|
70
|
+
* **Full (none):** Charts and canvases that manage their own width.
|
|
71
|
+
|
|
72
|
+
## Breakpoints
|
|
73
|
+
|
|
74
|
+
Design for the smallest screen first, then let content spread into more columns as space allows. Components change layout at the same widths, so a layout that shifts beside one should switch with it.
|
|
75
|
+
|
|
76
|
+
* **Phone (0 to 639px):** One column, with the sidebar in a drawer.
|
|
77
|
+
* **Tablet (640 to 1023px):** Two columns, where the content allows.
|
|
78
|
+
* **Desktop (1024px and up):** The sidebar opens, and grids gain columns.
|
|
79
|
+
|
|
80
|
+
Write a breakpoint as a query inside a style.
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { style } from '@tempoxyz/ds'
|
|
84
|
+
|
|
85
|
+
namespace styles {
|
|
86
|
+
export const metrics = style({
|
|
87
|
+
display: 'grid',
|
|
88
|
+
gap: '16',
|
|
89
|
+
'@media >=768': { gridTemplateColumns: 'repeat(3, minmax(0, 1fr)) !custom' },
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Layout Primitives
|
|
95
|
+
|
|
96
|
+
Primitives arrange content without adding meaning. When a region needs meaning, render the primitive as a semantic element, such as a list or the main landmark.
|
|
97
|
+
|
|
98
|
+
* **Stack (gap 16):** [Stack](/docs/components/stack) spaces a vertical run, such as fields in a form.
|
|
99
|
+
* **Inline (gap 8):** [Inline](/docs/components/inline) spaces a horizontal run, such as actions or badges.
|
|
100
|
+
* **Grid (gap 24):** [Grid](/docs/components/grid) arranges similar items, such as metric tiles.
|
|
101
|
+
* **Container (size):** [Container](/docs/components/container) sets the page width and side gutters.
|
|
102
|
+
* **Inset (space):** [Inset](/docs/components/inset) pads a region without drawing a container.
|
|
103
|
+
* **Surface (size):** [Surface](/docs/components/surface) is a visible card that groups related content.
|
|
104
|
+
|
|
105
|
+
## Guidelines
|
|
106
|
+
|
|
107
|
+
### Space Siblings With Gap
|
|
108
|
+
|
|
109
|
+
Space siblings from their parent. Margins on each child collapse, double up when items reorder, and leave stray space after the last item.
|
|
110
|
+
|
|
111
|
+
**Do:** Space the items of a list from their parent.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
/**
|
|
115
|
+
* Do example for "Space Siblings With Gap" on the Layout page.
|
|
116
|
+
* Space the items of a list with `gap` on the parent.
|
|
117
|
+
* @module
|
|
118
|
+
*/
|
|
119
|
+
import { style } from '@tempoxyz/ds'
|
|
120
|
+
|
|
121
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
122
|
+
export function Demo() {
|
|
123
|
+
return (
|
|
124
|
+
<div {...styles.list()}>
|
|
125
|
+
<span {...styles.item()}>Sent 25.00 USDC to 0x3c44…93bc</span>
|
|
126
|
+
<span {...styles.item()}>Received 120.00 USDC</span>
|
|
127
|
+
<span {...styles.item()}>Sent 8.50 USDC to 0x90f7…b906</span>
|
|
128
|
+
</div>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
namespace styles {
|
|
133
|
+
export const item = style({
|
|
134
|
+
backgroundColor: 'container.regular',
|
|
135
|
+
borderRadius: '2xs',
|
|
136
|
+
color: 'content.primary',
|
|
137
|
+
paddingBlock: '8',
|
|
138
|
+
paddingInline: '12',
|
|
139
|
+
typography: 'body.b2',
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
export const list = style({
|
|
143
|
+
borderColor: 'line.secondary',
|
|
144
|
+
borderRadius: 'xs',
|
|
145
|
+
borderStyle: 'dashed',
|
|
146
|
+
borderWidth: 'regular',
|
|
147
|
+
display: 'flex',
|
|
148
|
+
flexDirection: 'column',
|
|
149
|
+
gap: '12',
|
|
150
|
+
maxWidth: '100% !custom',
|
|
151
|
+
padding: '12',
|
|
152
|
+
width: '18rem !custom',
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Don't:** Add a margin to each child, which leaves space after the last one.
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
/**
|
|
161
|
+
* Don't example for "Space Siblings With Gap" on the Layout page.
|
|
162
|
+
* Don't add a margin to each child, which leaves space after the last one.
|
|
163
|
+
* @module
|
|
164
|
+
*/
|
|
165
|
+
import { style } from '@tempoxyz/ds'
|
|
166
|
+
|
|
167
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
168
|
+
export function Demo() {
|
|
169
|
+
return (
|
|
170
|
+
<div {...styles.list()}>
|
|
171
|
+
<span {...styles.item()}>Sent 25.00 USDC to 0x3c44…93bc</span>
|
|
172
|
+
<span {...styles.item()}>Received 120.00 USDC</span>
|
|
173
|
+
<span {...styles.item()}>Sent 8.50 USDC to 0x90f7…b906</span>
|
|
174
|
+
</div>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
namespace styles {
|
|
179
|
+
export const item = style({
|
|
180
|
+
backgroundColor: 'container.regular',
|
|
181
|
+
borderRadius: '2xs',
|
|
182
|
+
color: 'content.primary',
|
|
183
|
+
marginBottom: '12',
|
|
184
|
+
paddingBlock: '8',
|
|
185
|
+
paddingInline: '12',
|
|
186
|
+
typography: 'body.b2',
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
export const list = style({
|
|
190
|
+
borderColor: 'line.secondary',
|
|
191
|
+
borderRadius: 'xs',
|
|
192
|
+
borderStyle: 'dashed',
|
|
193
|
+
borderWidth: 'regular',
|
|
194
|
+
display: 'flex',
|
|
195
|
+
flexDirection: 'column',
|
|
196
|
+
maxWidth: '100% !custom',
|
|
197
|
+
padding: '12',
|
|
198
|
+
width: '18rem !custom',
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Group Related Content by Proximity
|
|
204
|
+
|
|
205
|
+
Put less space inside a group than between groups. A label sits close to its value, and separate pairs sit well apart, so they need no dividers.
|
|
206
|
+
|
|
207
|
+
**Do:** Keep each label close to its value and leave more space between pairs.
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
/**
|
|
211
|
+
* Do example for "Group Related Content by Proximity" on the Layout page.
|
|
212
|
+
* Keep each label close to its value and leave more space between pairs.
|
|
213
|
+
* @module
|
|
214
|
+
*/
|
|
215
|
+
import { Stack, style } from '@tempoxyz/ds'
|
|
216
|
+
|
|
217
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
218
|
+
export function Demo() {
|
|
219
|
+
return (
|
|
220
|
+
<Stack gap="24">
|
|
221
|
+
<Stack gap="4">
|
|
222
|
+
<span {...styles.label()}>Recipient</span>
|
|
223
|
+
<span {...styles.value()}>0x3c44…93bc</span>
|
|
224
|
+
</Stack>
|
|
225
|
+
<Stack gap="4">
|
|
226
|
+
<span {...styles.label()}>Amount</span>
|
|
227
|
+
<span {...styles.value()}>250.00 PathUSD</span>
|
|
228
|
+
</Stack>
|
|
229
|
+
<Stack gap="4">
|
|
230
|
+
<span {...styles.label()}>Network fee</span>
|
|
231
|
+
<span {...styles.value()}>0.01 PathUSD</span>
|
|
232
|
+
</Stack>
|
|
233
|
+
</Stack>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
namespace styles {
|
|
238
|
+
export const label = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
239
|
+
|
|
240
|
+
export const value = style({ color: 'content.primary', typography: 'body.b1Strong' })
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Don't:** Space every line equally, which makes labels and values hard to pair.
|
|
245
|
+
|
|
246
|
+
```tsx
|
|
247
|
+
/**
|
|
248
|
+
* Don't example for "Group Related Content by Proximity" on the Layout page.
|
|
249
|
+
* Don't space every line equally, which makes labels and values hard to pair.
|
|
250
|
+
* @module
|
|
251
|
+
*/
|
|
252
|
+
import { Stack, style } from '@tempoxyz/ds'
|
|
253
|
+
|
|
254
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
255
|
+
export function Demo() {
|
|
256
|
+
return (
|
|
257
|
+
<Stack gap="12">
|
|
258
|
+
<span {...styles.label()}>Recipient</span>
|
|
259
|
+
<span {...styles.value()}>0x3c44…93bc</span>
|
|
260
|
+
<span {...styles.label()}>Amount</span>
|
|
261
|
+
<span {...styles.value()}>250.00 PathUSD</span>
|
|
262
|
+
<span {...styles.label()}>Network fee</span>
|
|
263
|
+
<span {...styles.value()}>0.01 PathUSD</span>
|
|
264
|
+
</Stack>
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
namespace styles {
|
|
269
|
+
export const label = style({ color: 'content.secondary', typography: 'body.b3' })
|
|
270
|
+
|
|
271
|
+
export const value = style({ color: 'content.primary', typography: 'body.b1Strong' })
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Keep Cards Flat
|
|
276
|
+
|
|
277
|
+
Separate a [Surface](/docs/components/surface) from the page with its lighter background, not a shadow. Keep shadows for content that floats over other content.
|
|
278
|
+
|
|
279
|
+
**Do:** Keep cards flat, and add a shadow only to the layer above them.
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
<LayoutDemo kind="elevated" />
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Don't:** Give every card a shadow.
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
<LayoutDemo kind="shadowed" />
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Use One Surface per Group
|
|
292
|
+
|
|
293
|
+
**Do:** Use one surface with a title for one group.
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
<Surface>
|
|
297
|
+
<Surface.Header>
|
|
298
|
+
<Surface.Title>Balances</Surface.Title>
|
|
299
|
+
<Button size="small" variant="tertiary">View all</Button>
|
|
300
|
+
</Surface.Header>
|
|
301
|
+
<span>120.00 USDC</span>
|
|
302
|
+
</Surface>
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Don't:** Nest surfaces to create structure.
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
<Surface>
|
|
309
|
+
<Surface>
|
|
310
|
+
<Surface>
|
|
311
|
+
<span>120.00 USDC</span>
|
|
312
|
+
</Surface>
|
|
313
|
+
</Surface>
|
|
314
|
+
</Surface>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Size Containers by Content
|
|
318
|
+
|
|
319
|
+
Pick the narrowest [Container](/docs/components/container) that fits the content.
|
|
320
|
+
|
|
321
|
+
**Do:** Keep a form in a narrow container, so each field is as wide as its content needs.
|
|
322
|
+
|
|
323
|
+
```tsx
|
|
324
|
+
<Field.Root>
|
|
325
|
+
<Field.Label>Recipient</Field.Label>
|
|
326
|
+
<TextInput.Group>
|
|
327
|
+
<TextInput.Control placeholder="Address or username" />
|
|
328
|
+
</TextInput.Group>
|
|
329
|
+
</Field.Root>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Don't:** Stretch a form across a wide page.
|
|
333
|
+
|
|
334
|
+
```tsx
|
|
335
|
+
<LayoutDemo kind="container" width="full" />
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Let Collections Reflow
|
|
339
|
+
|
|
340
|
+
For cards and metric tiles, let the grid fit as many columns as the width allows. A fitted grid collapses to one column on a phone without extra breakpoints.
|
|
341
|
+
|
|
342
|
+
**Do:** Let a collection reflow to one column at 320px.
|
|
343
|
+
|
|
344
|
+
```tsx
|
|
345
|
+
<LayoutDemo kind="columns" width="phone" />
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**Don't:** Fix a column count that runs past a narrow screen.
|
|
349
|
+
|
|
350
|
+
```tsx
|
|
351
|
+
<LayoutDemo kind="overflow" />
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Keep Source Order Visual Order
|
|
355
|
+
|
|
356
|
+
Don't reorder content visually. Keyboard focus and screen readers follow the source, so a reordered layout makes focus jump.
|
|
357
|
+
|
|
358
|
+
**Do:** Write elements in the order they appear, so focus moves left to right.
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
/**
|
|
362
|
+
* Do example for "Keep Source Order Visual Order" on the Layout page.
|
|
363
|
+
* Write elements in the order they appear, so focus moves left to right.
|
|
364
|
+
* @module
|
|
365
|
+
*/
|
|
366
|
+
import { Button, style } from '@tempoxyz/ds'
|
|
367
|
+
|
|
368
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
369
|
+
export function Demo() {
|
|
370
|
+
return (
|
|
371
|
+
<div {...styles.row()}>
|
|
372
|
+
<span {...styles.item()}>
|
|
373
|
+
<span {...styles.step()}>1</span>
|
|
374
|
+
<Button variant="secondary">Cancel</Button>
|
|
375
|
+
</span>
|
|
376
|
+
<span {...styles.item()}>
|
|
377
|
+
<span {...styles.step()}>2</span>
|
|
378
|
+
<Button>Send payment</Button>
|
|
379
|
+
</span>
|
|
380
|
+
</div>
|
|
381
|
+
)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
namespace styles {
|
|
385
|
+
export const item = style({
|
|
386
|
+
alignItems: 'center',
|
|
387
|
+
display: 'flex',
|
|
388
|
+
flexDirection: 'column',
|
|
389
|
+
gap: '8',
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
export const row = style({ alignItems: 'flex-end', display: 'flex', gap: '12' })
|
|
393
|
+
|
|
394
|
+
export const step = style({
|
|
395
|
+
alignItems: 'center',
|
|
396
|
+
backgroundColor: 'accent.blue.background',
|
|
397
|
+
borderRadius: 'full',
|
|
398
|
+
color: 'white !custom',
|
|
399
|
+
cornerShape: 'round',
|
|
400
|
+
display: 'inline-flex',
|
|
401
|
+
height: '20',
|
|
402
|
+
justifyContent: 'center',
|
|
403
|
+
typography: 'body.b3Strong',
|
|
404
|
+
width: '20',
|
|
405
|
+
})
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Don't:** Reverse the visual order, which makes focus jump backward.
|
|
410
|
+
|
|
411
|
+
```tsx
|
|
412
|
+
/**
|
|
413
|
+
* Don't example for "Keep Source Order Visual Order" on the Layout page.
|
|
414
|
+
* Don't reverse the visual order, which makes focus jump backward.
|
|
415
|
+
* @module
|
|
416
|
+
*/
|
|
417
|
+
import { Button, style } from '@tempoxyz/ds'
|
|
418
|
+
|
|
419
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
420
|
+
export function Demo() {
|
|
421
|
+
return (
|
|
422
|
+
<div {...styles.row()}>
|
|
423
|
+
<span {...styles.item()}>
|
|
424
|
+
<span {...styles.step()}>1</span>
|
|
425
|
+
<Button>Send payment</Button>
|
|
426
|
+
</span>
|
|
427
|
+
<span {...styles.item()}>
|
|
428
|
+
<span {...styles.step()}>2</span>
|
|
429
|
+
<Button variant="secondary">Cancel</Button>
|
|
430
|
+
</span>
|
|
431
|
+
</div>
|
|
432
|
+
)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
namespace styles {
|
|
436
|
+
export const item = style({
|
|
437
|
+
alignItems: 'center',
|
|
438
|
+
display: 'flex',
|
|
439
|
+
flexDirection: 'column',
|
|
440
|
+
gap: '8',
|
|
441
|
+
})
|
|
442
|
+
|
|
443
|
+
export const row = style({
|
|
444
|
+
alignItems: 'flex-end',
|
|
445
|
+
display: 'flex',
|
|
446
|
+
flexDirection: 'row-reverse',
|
|
447
|
+
gap: '12',
|
|
448
|
+
justifyContent: 'flex-end',
|
|
449
|
+
})
|
|
450
|
+
|
|
451
|
+
export const step = style({
|
|
452
|
+
alignItems: 'center',
|
|
453
|
+
backgroundColor: 'accent.blue.background',
|
|
454
|
+
borderRadius: 'full',
|
|
455
|
+
color: 'white !custom',
|
|
456
|
+
cornerShape: 'round',
|
|
457
|
+
display: 'inline-flex',
|
|
458
|
+
height: '20',
|
|
459
|
+
justifyContent: 'center',
|
|
460
|
+
typography: 'body.b3Strong',
|
|
461
|
+
width: '20',
|
|
462
|
+
})
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
## Accessibility
|
|
467
|
+
|
|
468
|
+
* **Reflow (320px):** Content reflows without sideways scrolling, as fitted grids do by default.
|
|
469
|
+
* **Regions (render):** Primitives add no roles, so render regions as meaningful elements.
|
|
470
|
+
* **Text Size (200%):** Spacing grows with larger default text, so check layouts at 200%.
|
|
471
|
+
|
|
472
|
+
## Related
|
|
473
|
+
|
|
474
|
+
[Responsive Layout](/docs/patterns/responsive-layout)
|
|
475
|
+
|
|
476
|
+
Covers page frames and width changes.
|
|
477
|
+
|
|
478
|
+
[Stack](/docs/components/stack)
|
|
479
|
+
|
|
480
|
+
Use for arranging content.
|
|
481
|
+
|
|
482
|
+
[Inline](/docs/components/inline)
|
|
483
|
+
|
|
484
|
+
Use for arranging content.
|
|
485
|
+
|
|
486
|
+
[Grid](/docs/components/grid)
|
|
487
|
+
|
|
488
|
+
Use for arranging content.
|
|
489
|
+
|
|
490
|
+
[Container](/docs/components/container)
|
|
491
|
+
|
|
492
|
+
Use for width and padding.
|
|
493
|
+
|
|
494
|
+
[Inset](/docs/components/inset)
|
|
495
|
+
|
|
496
|
+
Use for width and padding.
|
|
497
|
+
|
|
498
|
+
[Surface](/docs/components/surface)
|
|
499
|
+
|
|
500
|
+
Use for cards.
|
|
501
|
+
|
|
502
|
+
[App Shell](/docs/components/app-shell)
|
|
503
|
+
|
|
504
|
+
Use for the application frame.
|
|
505
|
+
|
|
506
|
+
[Radius and Padding](/docs/foundations/radius-and-padding)
|
|
507
|
+
|
|
508
|
+
Covers how padding pairs with each radius.
|