@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.
Files changed (131) hide show
  1. package/dist/docs/AGENTS.md +73 -10
  2. package/dist/docs/{marketing/introduction/getting-started.md → marketing.md} +28 -20
  3. package/dist/docs/product/components/actions.md +2058 -0
  4. package/dist/docs/product/components/blockchain.md +3825 -0
  5. package/dist/docs/product/components/data-display.md +5901 -0
  6. package/dist/docs/product/components/feedback-and-status.md +4008 -0
  7. package/dist/docs/product/components/forms-and-inputs.md +10543 -0
  8. package/dist/docs/product/components/layout.md +3339 -0
  9. package/dist/docs/product/components/navigation.md +2914 -0
  10. package/dist/docs/product/components/overlays.md +4917 -0
  11. package/dist/docs/product/components.md +125 -125
  12. package/dist/docs/product/foundations.md +4596 -0
  13. package/dist/docs/product/patterns.md +10129 -0
  14. package/package.json +1 -1
  15. package/dist/docs/index.md +0 -145
  16. package/dist/docs/product/components/accordion.md +0 -489
  17. package/dist/docs/product/components/address-card.md +0 -147
  18. package/dist/docs/product/components/agent-logo.md +0 -194
  19. package/dist/docs/product/components/alert-dialog.md +0 -631
  20. package/dist/docs/product/components/alert.md +0 -448
  21. package/dist/docs/product/components/amount-input.md +0 -305
  22. package/dist/docs/product/components/amount.md +0 -794
  23. package/dist/docs/product/components/app-shell.md +0 -559
  24. package/dist/docs/product/components/asset-chip.md +0 -294
  25. package/dist/docs/product/components/autocomplete.md +0 -620
  26. package/dist/docs/product/components/avatar.md +0 -321
  27. package/dist/docs/product/components/badge.md +0 -339
  28. package/dist/docs/product/components/badged-logo.md +0 -116
  29. package/dist/docs/product/components/banner.md +0 -379
  30. package/dist/docs/product/components/bar-chart.md +0 -208
  31. package/dist/docs/product/components/breadcrumbs.md +0 -380
  32. package/dist/docs/product/components/button-group.md +0 -286
  33. package/dist/docs/product/components/button.md +0 -650
  34. package/dist/docs/product/components/calendar.md +0 -375
  35. package/dist/docs/product/components/callout.md +0 -96
  36. package/dist/docs/product/components/checkbox-group.md +0 -521
  37. package/dist/docs/product/components/checkbox.md +0 -467
  38. package/dist/docs/product/components/choice-group.md +0 -516
  39. package/dist/docs/product/components/choicebox.md +0 -641
  40. package/dist/docs/product/components/code.md +0 -100
  41. package/dist/docs/product/components/combobox.md +0 -939
  42. package/dist/docs/product/components/container.md +0 -257
  43. package/dist/docs/product/components/copy-button.md +0 -642
  44. package/dist/docs/product/components/date-picker.md +0 -514
  45. package/dist/docs/product/components/dialog.md +0 -1332
  46. package/dist/docs/product/components/drawer.md +0 -966
  47. package/dist/docs/product/components/empty.md +0 -340
  48. package/dist/docs/product/components/field.md +0 -570
  49. package/dist/docs/product/components/fieldset.md +0 -398
  50. package/dist/docs/product/components/frame.md +0 -434
  51. package/dist/docs/product/components/gauge.md +0 -299
  52. package/dist/docs/product/components/get-started-visual.md +0 -117
  53. package/dist/docs/product/components/grid.md +0 -288
  54. package/dist/docs/product/components/hero-visual.md +0 -155
  55. package/dist/docs/product/components/hex.md +0 -487
  56. package/dist/docs/product/components/icon-tile.md +0 -292
  57. package/dist/docs/product/components/identicon.md +0 -371
  58. package/dist/docs/product/components/inline.md +0 -233
  59. package/dist/docs/product/components/inset.md +0 -225
  60. package/dist/docs/product/components/kbd.md +0 -423
  61. package/dist/docs/product/components/list-group.md +0 -981
  62. package/dist/docs/product/components/loading-dots.md +0 -237
  63. package/dist/docs/product/components/menu.md +0 -934
  64. package/dist/docs/product/components/native-select.md +0 -204
  65. package/dist/docs/product/components/network-logo.md +0 -248
  66. package/dist/docs/product/components/number-field.md +0 -543
  67. package/dist/docs/product/components/otp-field.md +0 -616
  68. package/dist/docs/product/components/pagination.md +0 -516
  69. package/dist/docs/product/components/popover.md +0 -544
  70. package/dist/docs/product/components/progress.md +0 -388
  71. package/dist/docs/product/components/qr.md +0 -314
  72. package/dist/docs/product/components/radio-group.md +0 -528
  73. package/dist/docs/product/components/secret-value.md +0 -406
  74. package/dist/docs/product/components/select.md +0 -751
  75. package/dist/docs/product/components/separator.md +0 -379
  76. package/dist/docs/product/components/sidebar-menu.md +0 -922
  77. package/dist/docs/product/components/skeleton.md +0 -517
  78. package/dist/docs/product/components/slider.md +0 -539
  79. package/dist/docs/product/components/snippet.md +0 -424
  80. package/dist/docs/product/components/spinner.md +0 -216
  81. package/dist/docs/product/components/split-bar.md +0 -139
  82. package/dist/docs/product/components/split-button.md +0 -464
  83. package/dist/docs/product/components/stack.md +0 -299
  84. package/dist/docs/product/components/status-chip.md +0 -226
  85. package/dist/docs/product/components/status-indicator.md +0 -119
  86. package/dist/docs/product/components/status-row.md +0 -174
  87. package/dist/docs/product/components/stepper.md +0 -451
  88. package/dist/docs/product/components/success-hero.md +0 -157
  89. package/dist/docs/product/components/surface.md +0 -639
  90. package/dist/docs/product/components/switch.md +0 -472
  91. package/dist/docs/product/components/table.md +0 -968
  92. package/dist/docs/product/components/tabs.md +0 -627
  93. package/dist/docs/product/components/tempo-logo.md +0 -185
  94. package/dist/docs/product/components/text-input.md +0 -624
  95. package/dist/docs/product/components/textarea.md +0 -352
  96. package/dist/docs/product/components/toast.md +0 -535
  97. package/dist/docs/product/components/token-logo.md +0 -371
  98. package/dist/docs/product/components/token.md +0 -247
  99. package/dist/docs/product/components/tooltip.md +0 -490
  100. package/dist/docs/product/components/verification-code.md +0 -116
  101. package/dist/docs/product/components/visual.md +0 -249
  102. package/dist/docs/product/foundations/accessibility.md +0 -377
  103. package/dist/docs/product/foundations/agents.md +0 -159
  104. package/dist/docs/product/foundations/color.md +0 -522
  105. package/dist/docs/product/foundations/content/tone.md +0 -194
  106. package/dist/docs/product/foundations/content/voice.md +0 -194
  107. package/dist/docs/product/foundations/content/writing-style.md +0 -406
  108. package/dist/docs/product/foundations/iconography.md +0 -282
  109. package/dist/docs/product/foundations/intent.md +0 -360
  110. package/dist/docs/product/foundations/layout.md +0 -508
  111. package/dist/docs/product/foundations/linter.md +0 -523
  112. package/dist/docs/product/foundations/motion.md +0 -151
  113. package/dist/docs/product/foundations/radius-and-padding.md +0 -86
  114. package/dist/docs/product/foundations/typography.md +0 -331
  115. package/dist/docs/product/introduction/faq.md +0 -133
  116. package/dist/docs/product/introduction/getting-started.md +0 -377
  117. package/dist/docs/product/patterns/blockchain-values.md +0 -709
  118. package/dist/docs/product/patterns/dashboards.md +0 -638
  119. package/dist/docs/product/patterns/destructive-actions.md +0 -626
  120. package/dist/docs/product/patterns/empty-states.md +0 -612
  121. package/dist/docs/product/patterns/errors-and-validation.md +0 -808
  122. package/dist/docs/product/patterns/feedback-and-status.md +0 -518
  123. package/dist/docs/product/patterns/forms.md +0 -679
  124. package/dist/docs/product/patterns/loading.md +0 -630
  125. package/dist/docs/product/patterns/navigation.md +0 -397
  126. package/dist/docs/product/patterns/payments.md +0 -765
  127. package/dist/docs/product/patterns/responsive-layout.md +0 -997
  128. package/dist/docs/product/patterns/tables-and-lists.md +0 -1170
  129. package/dist/docs/product/products/tempo-console.md +0 -671
  130. package/dist/docs/product/products/tempo-performance.md +0 -435
  131. package/dist/docs/product/products/tempo-wallet.md +0 -438
@@ -1,299 +0,0 @@
1
- # Gauge
2
-
3
- Shows a measurement within a range as a ring.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Gauge.tsx)
6
-
7
- ## Overview
8
-
9
- A gauge is a ring that shows a measurement within a range, such as usage or a score.
10
-
11
- ## Examples
12
-
13
- ### Basic
14
-
15
- ```tsx
16
- import { Gauge } from '@tempoxyz/ds'
17
-
18
- export function Demo() {
19
- return <Gauge aria-label="Storage used" showValue value={72} />
20
- }
21
- ```
22
-
23
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Gauge/Basic.tsx)
24
-
25
- ### Intent
26
-
27
- Set `intent` to `neutral` (default) or `positive`.
28
-
29
- ```tsx
30
- import { Gauge, style } from '@tempoxyz/ds'
31
-
32
- export function Demo() {
33
- return (
34
- <div {...styles.row()}>
35
- {(['neutral', 'positive'] as const).map((intent, index) => (
36
- <Gauge aria-label={intent} intent={intent} key={intent} showValue value={20 + index * 20} />
37
- ))}
38
- </div>
39
- )
40
- }
41
-
42
- namespace styles {
43
- export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '16' })
44
- }
45
- ```
46
-
47
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Gauge/Intent.tsx)
48
-
49
- ### Size
50
-
51
- Set `size` to `small`, `medium` (default), or `large`.
52
-
53
- ```tsx
54
- import { Gauge, style } from '@tempoxyz/ds'
55
-
56
- export function Demo() {
57
- return (
58
- <div {...styles.row()}>
59
- <Gauge aria-label="Small" size="small" value={72} />
60
- <Gauge aria-label="Medium" size="medium" value={72} />
61
- <Gauge aria-label="Large" showValue size="large" value={72} />
62
- </div>
63
- )
64
- }
65
-
66
- namespace styles {
67
- export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '16' })
68
- }
69
- ```
70
-
71
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Gauge/Size.tsx)
72
-
73
- ### ShowValue
74
-
75
- Set `showValue` to print the value inside the ring.
76
-
77
- ```tsx
78
- import { Gauge, style } from '@tempoxyz/ds'
79
-
80
- export function Demo() {
81
- return (
82
- <div {...styles.row()}>
83
- <Gauge aria-label="Hidden value" value={40} />
84
- <Gauge aria-label="Shown value" showValue value={40} />
85
- </div>
86
- )
87
- }
88
-
89
- namespace styles {
90
- export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '16' })
91
- }
92
- ```
93
-
94
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Gauge/ShowValue.tsx)
95
-
96
- ## Anatomy
97
-
98
- Import the component and assemble its parts.
99
-
100
- ```tsx
101
- import { Gauge } from '@tempoxyz/ds'
102
-
103
- <Gauge />
104
- ```
105
-
106
- ## Guidelines
107
-
108
- ### When to Use
109
-
110
- * Show how much of a limit is used, such as API requests against a quota.
111
- * Show a ratio in a metric tile, such as gas used against the gas limit.
112
- * Show a score with a fixed range, such as validator uptime.
113
-
114
- ### When Not to Use
115
-
116
- * Use [Progress](progress.md) for a task that advances, such as an upload.
117
- * Use [Skeleton](skeleton.md) or [Spinner](spinner.md) while the measurement loads.
118
- * Use [Slider](slider.md) when the user sets the value.
119
- * Use plain text if the value has no fixed maximum, such as 4,812 TPS.
120
-
121
- ### Show the Value in Text
122
-
123
- Set `showValue` to print the percentage in the ring.
124
-
125
- **Do:** Pair the ring with its label and the absolute values beside it.
126
-
127
- ```tsx
128
- /**
129
- * Do example for "Show the Value in Text" on the Gauge page.
130
- * Pair the ring with its label and the absolute values beside it.
131
- * @module
132
- */
133
- import { Gauge, style } from '@tempoxyz/ds'
134
-
135
- /** Renders the static preview, which the guideline card shows inert. */
136
- export function Demo() {
137
- return (
138
- <div {...styles.row()}>
139
- <Gauge aria-labelledby="gauge-requests" max={10000} showValue value={7200} />
140
- <div {...styles.text()}>
141
- <div {...styles.label()} id="gauge-requests">
142
- API requests this month
143
- </div>
144
- <div {...styles.value()}>7,200 of 10,000</div>
145
- </div>
146
- </div>
147
- )
148
- }
149
-
150
- namespace styles {
151
- export const label = style({ color: 'content.primary', typography: 'body.b2' })
152
-
153
- export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
154
-
155
- export const text = style({ display: 'flex', flexDirection: 'column', gap: '4' })
156
-
157
- export const value = style({ color: 'content.secondary', typography: 'body.b3' })
158
- }
159
- ```
160
-
161
- **Don't:** Show a ring without its value or what it measures.
162
-
163
- ```tsx
164
- /**
165
- * Don't example for "Show the Value in Text" on the Gauge page.
166
- * Don't show a ring without its value or what it measures.
167
- * @module
168
- */
169
- import { Gauge } from '@tempoxyz/ds'
170
-
171
- /** Renders the static preview, which the guideline card shows inert. */
172
- export function Demo() {
173
- return <Gauge aria-label="Usage" max={10000} value={7200} />
174
- }
175
- ```
176
-
177
- ### Pass the Real Range
178
-
179
- The ring, `showValue`, and the accessible value derive the percentage from `min` (default 0) and `max` (default 100).
180
-
181
- **Do:** Set `max` to the actual bound, such as `value={7200}` with `max={10000}`.
182
-
183
- ```tsx
184
- /**
185
- * Do example for "Pass the Real Range" on the Gauge page.
186
- * Set `max` to the actual bound, such as `value={7200}` with `max={10000}`.
187
- * @module
188
- */
189
- import { Gauge, style } from '@tempoxyz/ds'
190
-
191
- /** Renders the static preview, which the guideline card shows inert. */
192
- export function Demo() {
193
- return (
194
- <div {...styles.row()}>
195
- <Gauge aria-labelledby="gauge-range" max={10000} showValue value={7200} />
196
- <div {...styles.text()}>
197
- <div {...styles.label()} id="gauge-range">
198
- API requests this month
199
- </div>
200
- <div {...styles.value()}>7,200 of 10,000</div>
201
- </div>
202
- </div>
203
- )
204
- }
205
-
206
- namespace styles {
207
- export const label = style({ color: 'content.primary', typography: 'body.b2' })
208
-
209
- export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
210
-
211
- export const text = style({ display: 'flex', flexDirection: 'column', gap: '4' })
212
-
213
- export const value = style({ color: 'content.secondary', typography: 'body.b3' })
214
- }
215
- ```
216
-
217
- **Don't:** Pass a raw count against the default `max` of 100.
218
-
219
- ```tsx
220
- /**
221
- * Don't example for "Pass the Real Range" on the Gauge page.
222
- * Don't pass a raw count against the default `max` of 100.
223
- * @module
224
- */
225
- import { Gauge, style } from '@tempoxyz/ds'
226
-
227
- /** Renders the static preview, which the guideline card shows inert. */
228
- export function Demo() {
229
- return (
230
- <div {...styles.row()}>
231
- <Gauge aria-labelledby="gauge-default" showValue value={7200} />
232
- <div {...styles.text()}>
233
- <div {...styles.label()} id="gauge-default">
234
- API requests this month
235
- </div>
236
- <div {...styles.value()}>7,200 of 10,000</div>
237
- </div>
238
- </div>
239
- )
240
- }
241
-
242
- namespace styles {
243
- export const label = style({ color: 'content.primary', typography: 'body.b2' })
244
-
245
- export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
246
-
247
- export const text = style({ display: 'flex', flexDirection: 'column', gap: '4' })
248
-
249
- export const value = style({ color: 'content.secondary', typography: 'body.b3' })
250
- }
251
- ```
252
-
253
- ### Choose an Intent
254
-
255
- * **Most Measurements (neutral):** The default, for a measurement such as API requests against a quota.
256
- * **Full Is Good (positive):** A measurement where a full value is good, such as 100% uptime.
257
- * **Nearing a Limit (Alert):** There is no `warning` intent. Add a `warning` [Alert](alert.md) with the next step.
258
-
259
- ### Match Size to Context
260
-
261
- * **Small (32px):** Table cells and dense lists. Print the value beside it.
262
- * **Medium (48px):** The default, for metric tiles and cards.
263
- * **Large (80px):** A featured measurement, such as plan usage in billing.
264
-
265
- ## Content
266
-
267
- * **Label:** Name the measurement, not the component, such as Gas used.
268
-
269
- ## Accessibility
270
-
271
- A gauge renders a `meter`. It follows the [WAI-ARIA Authoring Practices meter pattern](https://www.w3.org/WAI/ARIA/apg/patterns/meter/). It is not a live region, so a changed value is read only on the next visit.
272
-
273
- ### Semantics
274
-
275
- * **Root (meter):** Reports its minimum, maximum, and value to assistive technology.
276
- * **Value Text (72%):** Defaults to the value as a locale-formatted percentage of the range.
277
- * **Ring (aria-hidden):** Hidden. Assistive technology reads the value text instead.
278
- * **Visible Value (showValue):** Shows the number. It ignores `format`, which changes only the announced text.
279
- * **Arc Color (foreground):** Green for positive intent, on a gray track. Keep the gauge on a plain surface.
280
- * **Reduced Motion (reduce):** Under reduced motion, the arc doesn't animate between values.
281
-
282
- ### Your Responsibilities
283
-
284
- * **Name the Gauge (SC 4.1.2):** Use `aria-label` or `aria-labelledby`. The gauge renders no label.
285
- * **Describe Non-Percentage Values (getAriaValueText):** Use it if a percentage doesn't describe the value, such as "7.2 of 10 GB".
286
-
287
- ## Related
288
-
289
- [Progress](progress.md)
290
-
291
- Use for a task that advances.
292
-
293
- [Alert](alert.md)
294
-
295
- Use for a warning when usage nears a limit.
296
-
297
- [Dashboards](../patterns/dashboards.md)
298
-
299
- Covers laying out metric tiles.
@@ -1,117 +0,0 @@
1
- # GetStartedVisual
2
-
3
- Illustrates one step of a get started flow at the top of its card.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/GetStartedVisual.tsx)
6
-
7
- Figma: [Content/Get Started Visual](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-3110)
8
-
9
- ## Overview
10
-
11
- A get started visual renders a 320 by 160px illustration on a dark ground. `step` selects the artwork of connecting, adding funds, or adding a passkey.
12
-
13
- ## Examples
14
-
15
- ### Basic
16
-
17
- Set `step` to `connect` (default), `funds`, or `passkey`.
18
-
19
- ```tsx
20
- /** Demonstrates GetStartedVisual in the documentation. @module */
21
- import { GetStartedVisual, style } from '@tempoxyz/ds'
22
-
23
- export function Demo() {
24
- return (
25
- <div {...styles.frame()}>
26
- <GetStartedVisual step="connect" />
27
- </div>
28
- )
29
- }
30
-
31
- namespace styles {
32
- export const frame = style({ maxWidth: '20rem !custom', width: '100% !custom' })
33
- }
34
- ```
35
-
36
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/GetStartedVisual/Basic.tsx)
37
-
38
- ### Steps
39
-
40
- Each step of the flow has its own artwork.
41
-
42
- ```tsx
43
- /** Demonstrates GetStartedVisual in the documentation. @module */
44
- import { GetStartedVisual, style } from '@tempoxyz/ds'
45
-
46
- export function Demo() {
47
- return (
48
- <div {...styles.row()}>
49
- <GetStartedVisual step="connect" />
50
- <GetStartedVisual step="funds" />
51
- <GetStartedVisual step="passkey" />
52
- </div>
53
- )
54
- }
55
-
56
- namespace styles {
57
- export const row = style({ display: 'flex', flexWrap: 'wrap', gap: '16' })
58
- }
59
- ```
60
-
61
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/GetStartedVisual/Steps.tsx)
62
-
63
- ## Anatomy
64
-
65
- Import the component.
66
-
67
- ```tsx
68
- import { GetStartedVisual } from '@tempoxyz/ds'
69
-
70
- <GetStartedVisual />
71
- ```
72
-
73
- ## Guidelines
74
-
75
- ### When to Use
76
-
77
- * Open each card of a get started list, above the title of its step.
78
-
79
- ### When Not to Use
80
-
81
- * Use [Visual](visual.md) for the top of a modal.
82
- * Use [IconTile](icon-tile.md) for a step that needs only an icon.
83
-
84
- ### Match the Artwork to the Step
85
-
86
- **Do:** Show the funds artwork on the step that adds funds.
87
-
88
- ```tsx
89
- <GetStartedVisual step="funds" />
90
- ```
91
-
92
- **Don't:** Reuse one artwork for every step.
93
-
94
- ```tsx
95
- <GetStartedVisual step="passkey" />
96
- ```
97
-
98
- ### Use One Visual per Card
99
-
100
- Place one visual at the top of a card. Two visuals in one card compete for attention.
101
-
102
- ## Accessibility
103
-
104
- The visual renders a `<div>` with no role and takes no focus. Screen readers skip the artwork.
105
-
106
- * **Artwork (aria-hidden):** Decorative, so screen readers skip it.
107
- * **Name the Step in Text (Your task):** The title of the card names the step.
108
-
109
- ## Related
110
-
111
- [Visual](visual.md)
112
-
113
- Use for the illustration at the top of a modal.
114
-
115
- [HeroVisual](hero-visual.md)
116
-
117
- Use for the hero card beside a setup flow.
@@ -1,288 +0,0 @@
1
- # Grid
2
-
3
- Lays out children on a responsive grid.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Grid.tsx)
6
-
7
- ## Overview
8
-
9
- Grid places children on equal tracks, either a fixed `columns` count or as many as the width allows with `fit`.
10
-
11
- ## Examples
12
-
13
- ### Basic
14
-
15
- ```tsx
16
- import { Grid, Inset, style } from '@tempoxyz/ds'
17
-
18
- export const fill = true
19
- export function Demo() {
20
- return (
21
- <Grid columns="3" gap="16">
22
- {[1, 2, 3].map((n) => (
23
- <Inset key={n} space="16" {...styles.card()}>
24
- Column {n}
25
- </Inset>
26
- ))}
27
- </Grid>
28
- )
29
- }
30
-
31
- namespace styles {
32
- export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
33
- }
34
- ```
35
-
36
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Grid/Basic.tsx)
37
-
38
- ### Fit
39
-
40
- Set `fit` to `small`, `medium`, or `large` for tracks of at least 10rem, 14rem, or 20rem. It overrides `columns`.
41
-
42
- ```tsx
43
- import { Grid, Inset, style } from '@tempoxyz/ds'
44
-
45
- export const fill = true
46
- export function Demo() {
47
- return (
48
- <Grid fit="medium" gap="16">
49
- {[1, 2, 3, 4].map((n) => (
50
- <Inset key={n} block="24" inline="32" {...styles.card()}>
51
- Fit {n}
52
- </Inset>
53
- ))}
54
- </Grid>
55
- )
56
- }
57
-
58
- namespace styles {
59
- export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
60
- }
61
- ```
62
-
63
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Grid/Fit.tsx)
64
-
65
- ### Columns
66
-
67
- Set `columns` to `1`, `2`, `3`, `4`, `6`, or `12` equal tracks.
68
-
69
- ```tsx
70
- import { Grid, Inset, Stack, style } from '@tempoxyz/ds'
71
-
72
- export const fill = true
73
- export function Demo() {
74
- return (
75
- <Stack gap="24">
76
- {(['2', '3', '4'] as const).map((columns) => (
77
- <Grid columns={columns} gap="8" key={columns}>
78
- {Array.from({ length: Number(columns) }, (_, index) => (
79
- <Inset key={index} space="16" {...styles.card()}>
80
- {columns} columns
81
- </Inset>
82
- ))}
83
- </Grid>
84
- ))}
85
- </Stack>
86
- )
87
- }
88
-
89
- namespace styles {
90
- export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
91
- }
92
- ```
93
-
94
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Grid/Columns.tsx)
95
-
96
- ### Gap
97
-
98
- Set `gap` to a spacing token. `rowGap` and `columnGap` override it on one axis.
99
-
100
- ```tsx
101
- import { Grid, Inset, style } from '@tempoxyz/ds'
102
-
103
- export const fill = true
104
- export function Demo() {
105
- return (
106
- <Grid columnGap="8" columns="3" rowGap="32">
107
- {[1, 2, 3, 4, 5, 6].map((n) => (
108
- <Inset key={n} space="16" {...styles.card()}>
109
- Column {n}
110
- </Inset>
111
- ))}
112
- </Grid>
113
- )
114
- }
115
-
116
- namespace styles {
117
- export const card = style({ backgroundColor: 'background.elevated', borderRadius: 'sm' })
118
- }
119
- ```
120
-
121
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Grid/Gap.tsx)
122
-
123
- ## Anatomy
124
-
125
- Import the component and assemble its parts.
126
-
127
- ```tsx
128
- import { Grid } from '@tempoxyz/ds'
129
-
130
- <Grid />
131
- ```
132
-
133
- ## Guidelines
134
-
135
- ### When to Use
136
-
137
- * Lay out similar items, such as metric tiles, token balance cards, or API key cards.
138
- * Build a two-dimensional page layout with a fixed structure, such as a 12-column dashboard.
139
-
140
- ### When Not to Use
141
-
142
- * Use [Table](table.md) for records to compare across columns, such as transactions.
143
- * Use [Stack](stack.md) for one column, and [Inline](inline.md) for one row.
144
-
145
- ### Prefer Fit Over Fixed Columns
146
-
147
- **Do:** Set `fit` so tiles drop to fewer columns as the width shrinks.
148
-
149
- ```tsx
150
- /**
151
- * Do example for "Prefer Fit Over Fixed Columns" on the Grid page.
152
- * Set `fit` so tiles drop to fewer columns as the width shrinks.
153
- * @module
154
- */
155
- import { Grid, style, Surface } from '@tempoxyz/ds'
156
-
157
- const metrics = [
158
- ['TPS', '4,218'],
159
- ['Block time', '0.5s'],
160
- ['Finality', '0.6s'],
161
- ] as const
162
-
163
- /** Renders the static preview, which the guideline card shows inert. */
164
- export function Demo() {
165
- return (
166
- <Grid fit="small" gap="12" {...styles.canvas()}>
167
- {metrics.map(([label, value]) => (
168
- <Surface key={label} size="medium">
169
- <span {...styles.label()}>{label}</span>
170
- <span {...styles.value()}>{value}</span>
171
- </Surface>
172
- ))}
173
- </Grid>
174
- )
175
- }
176
-
177
- namespace styles {
178
- export const canvas = style({
179
- backgroundColor: 'background.primary',
180
- borderRadius: 'sm',
181
- boxSizing: 'border-box',
182
- padding: '12',
183
- width: '100% !custom',
184
- })
185
-
186
- export const label = style({
187
- color: 'content.secondary',
188
- display: 'block',
189
- typography: 'body.b3',
190
- })
191
-
192
- export const value = style({ display: 'block', typography: 'heading.h3' })
193
- }
194
- ```
195
-
196
- **Don't:** Force four fixed columns into a narrow container.
197
-
198
- ```tsx
199
- /**
200
- * Don't example for "Prefer Fit Over Fixed Columns" on the Grid page.
201
- * Don't force four fixed columns into a narrow container.
202
- * @module
203
- */
204
- import { Grid, style, Surface } from '@tempoxyz/ds'
205
-
206
- const metrics = [
207
- ['TPS', '4,218'],
208
- ['Block time', '0.5s'],
209
- ['Finality', '0.6s'],
210
- ['Gas price', '0.1 gwei'],
211
- ] as const
212
-
213
- /** Renders the static preview, which the guideline card shows inert. */
214
- export function Demo() {
215
- return (
216
- <Grid columns="4" gap="12" {...styles.canvas()}>
217
- {metrics.map(([label, value]) => (
218
- <Surface key={label} size="medium">
219
- <span {...styles.label()}>{label}</span>
220
- <span {...styles.value()}>{value}</span>
221
- </Surface>
222
- ))}
223
- </Grid>
224
- )
225
- }
226
-
227
- namespace styles {
228
- export const canvas = style({
229
- backgroundColor: 'background.primary',
230
- borderRadius: 'sm',
231
- boxSizing: 'border-box',
232
- padding: '12',
233
- width: '100% !custom',
234
- })
235
-
236
- export const label = style({
237
- color: 'content.secondary',
238
- display: 'block',
239
- typography: 'body.b3',
240
- })
241
-
242
- export const value = style({ display: 'block', typography: 'heading.h3' })
243
- }
244
- ```
245
-
246
- ### Change Columns at Breakpoints
247
-
248
- If a layout needs a set count per width, change `gridTemplateColumns` under a [breakpoint](../foundations/layout.md#breakpoints) key. Write the narrowest layout as the base style.
249
-
250
- * **Base (0 to 767px):** One column on phones, with no media key.
251
- * **Tablet ('@media 768'):** More columns from 48rem.
252
- * **Desktop ('@media 1024'):** The full count from 64rem. Use `'@media <1024'` for anything narrower.
253
-
254
- ### Pick a Gap From the Scale
255
-
256
- * **Cards (24):** The default, for cards.
257
- * **Dense Tiles (12 or 16):** For dense dashboard tiles.
258
-
259
- ## Accessibility
260
-
261
- Grid has no role, name, or keyboard behavior.
262
-
263
- ### Semantics
264
-
265
- * **Default Element (div):** Has no role. Screen readers pass over it.
266
- * **Semantic Element (render):** If the children are items or links, render a list or nav, such as `render={<ul />}`.
267
-
268
- ### Your Responsibilities
269
-
270
- * **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)).
271
-
272
- ## Related
273
-
274
- [Surface](surface.md)
275
-
276
- Use for the cards inside a grid.
277
-
278
- [Table](table.md)
279
-
280
- Use for comparing records.
281
-
282
- [Dashboards](../patterns/dashboards.md)
283
-
284
- Covers metric tile layouts.
285
-
286
- [Responsive Layout](../patterns/responsive-layout.md)
287
-
288
- Covers adapting pages across breakpoints.