@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,1170 +0,0 @@
1
- # Tables and Lists
2
-
3
- Present records, such as payments and API keys, to scan, compare, and act on.
4
-
5
- ## Overview
6
-
7
- Tempo collections include wallet activity, scheduled payouts, API keys, webhooks, and blocks. Each needs a structure that fits its reading pattern, consistent alignment, and clear loading, empty, and narrow-screen states.
8
-
9
- > [!NOTE]
10
- > The live examples are reference layouts built from library components and `style`, not shipped components. No data grid component exists, so sorting, selection, and paging state live in your app.
11
-
12
- ## Choose a Structure
13
-
14
- * **Table (Table):** Records compared across the same columns, such as payments, payouts, API keys, or blocks.
15
- * **ListGroup (ListGroup):** The key-value details of one record, settings, and navigation lists.
16
- * **Stacked List Items:** Items with a main line and a few attributes, such as activity. Also narrow-screen tables.
17
-
18
- **Do:** Use [ListGroup](../components/list-group.md) with `ListGroup.Label` for the fields of one
19
- record.
20
-
21
- ```tsx
22
- /**
23
- * Do example for "Tables and Lists" on the Tables and Lists page.
24
- * Use ListGroup with `ListGroup.Label` for the fields of one record.
25
- * @module
26
- */
27
- import { ListGroup, style, Surface } from '@tempoxyz/ds'
28
-
29
- /** Renders the static preview, which the guideline card shows inert. */
30
- export function Demo() {
31
- return (
32
- <Surface size="small" {...styles.card()}>
33
- <ListGroup.Root>
34
- <ListGroup.Row>
35
- <ListGroup.Label>Status</ListGroup.Label>
36
- Confirmed
37
- </ListGroup.Row>
38
- <ListGroup.Row>
39
- <ListGroup.Label>Amount</ListGroup.Label>
40
- $1,200.00
41
- </ListGroup.Row>
42
- <ListGroup.Row>
43
- <ListGroup.Label>Network fee</ListGroup.Label>
44
- $0.00003
45
- </ListGroup.Row>
46
- </ListGroup.Root>
47
- </Surface>
48
- )
49
- }
50
-
51
- namespace styles {
52
- export const card = style({
53
- boxShadow: '0 0 0 1px light-dark(#0000001a, #ffffff1f) !custom',
54
- width: '16rem !custom',
55
- })
56
- }
57
- ```
58
-
59
- **Don't:** Build a two-column Field and Value table for a single record.
60
-
61
- ```tsx
62
- /**
63
- * Don't example for "Tables and Lists" on the Tables and Lists page.
64
- * Don't build a two-column Field and Value table for a single record.
65
- * @module
66
- */
67
- import { style, Surface, Table } from '@tempoxyz/ds'
68
-
69
- const fields = [
70
- ['Status', 'Confirmed'],
71
- ['Amount', '$1,200.00'],
72
- ['Network fee', '$0.00003'],
73
- ] as const
74
-
75
- /** Renders the static preview, which the guideline card shows inert. */
76
- export function Demo() {
77
- return (
78
- <Surface size="small" {...styles.card()}>
79
- <Table.Root size="small">
80
- <Table.Head>
81
- <Table.Row>
82
- <Table.HeaderCell>Field</Table.HeaderCell>
83
- <Table.HeaderCell>Value</Table.HeaderCell>
84
- </Table.Row>
85
- </Table.Head>
86
- <Table.Body>
87
- {fields.map(([field, value]) => (
88
- <Table.Row key={field}>
89
- <Table.Cell>{field}</Table.Cell>
90
- <Table.Cell>{value}</Table.Cell>
91
- </Table.Row>
92
- ))}
93
- </Table.Body>
94
- </Table.Root>
95
- </Surface>
96
- )
97
- }
98
-
99
- namespace styles {
100
- export const card = style({
101
- boxShadow: '0 0 0 1px light-dark(#0000001a, #ffffff1f) !custom',
102
- width: '16rem !custom',
103
- })
104
- }
105
- ```
106
-
107
- ## Recommended Structure
108
-
109
- Place a table in a [Surface](../components/surface.md), with a `Surface.Header` above it for the title and actions. A direct child `table` bleeds into the padding of the surface, so row fills and dividers reach its edges.
110
-
111
- * **Header (1):** The title of the collection, filters, and actions such as Export CSV.
112
- * **Table (2):** The table itself, named by a caption or by `aria-labelledby`.
113
- * **Footer (3):** The visible range, such as 1–20 of 248, and pagination or a Load more button.
114
-
115
- ## Align Columns by Content
116
-
117
- * **Start-Align Text:** Start-align text, such as names, descriptions, and dates.
118
- * **Monospace Identifiers (mono):** Use it for hashes and other identifiers. Shorten them in the middle with `formatHex`.
119
- * **Amount Last:** Put the amount in the last column where possible. The last column aligns to the end automatically.
120
-
121
- **Do:** End-align amounts and their headers with `justify="end"` and `numeric` cells, so decimals line
122
- up.
123
-
124
- ```tsx
125
- /**
126
- * Do example for "Tables and Lists" on the Tables and Lists page.
127
- * End-align amounts and their headers with `justify="end"` and `numeric` cells, so decimals line up.
128
- * @module
129
- */
130
- import { style, Table } from '@tempoxyz/ds'
131
-
132
- const rows = [
133
- ['Payroll', '$1,200.00'],
134
- ['Hosting', '$48.50'],
135
- ['Refund', '$9.99'],
136
- ] as const
137
-
138
- /** Renders the static preview, which the guideline card shows inert. */
139
- export function Demo() {
140
- return (
141
- <Table.Root size="small" {...styles.table()}>
142
- <Table.Head>
143
- <Table.Row>
144
- <Table.HeaderCell>Payment</Table.HeaderCell>
145
- <Table.HeaderCell justify="end">Amount</Table.HeaderCell>
146
- </Table.Row>
147
- </Table.Head>
148
- <Table.Body>
149
- {rows.map(([payment, amount]) => (
150
- <Table.Row key={payment}>
151
- <Table.Cell>{payment}</Table.Cell>
152
- <Table.Cell justify="end" numeric>
153
- {amount}
154
- </Table.Cell>
155
- </Table.Row>
156
- ))}
157
- </Table.Body>
158
- </Table.Root>
159
- )
160
- }
161
-
162
- namespace styles {
163
- export const table = style({ maxWidth: '16rem !custom' })
164
- }
165
- ```
166
-
167
- **Don't:** Start-align amounts. Digits of different lengths do not line up.
168
-
169
- ```tsx
170
- /**
171
- * Don't example for "Tables and Lists" on the Tables and Lists page.
172
- * Don't start-align amounts. Digits of different lengths do not line up.
173
- * @module
174
- */
175
- import { style, Table } from '@tempoxyz/ds'
176
-
177
- const rows = [
178
- ['$1,200.00', 'Payroll'],
179
- ['$48.50', 'Hosting'],
180
- ['$9.99', 'Refund'],
181
- ] as const
182
-
183
- /** Renders the static preview, which the guideline card shows inert. */
184
- export function Demo() {
185
- return (
186
- <Table.Root size="small" {...styles.table()}>
187
- <Table.Head>
188
- <Table.Row>
189
- <Table.HeaderCell>Amount</Table.HeaderCell>
190
- <Table.HeaderCell>Payment</Table.HeaderCell>
191
- </Table.Row>
192
- </Table.Head>
193
- <Table.Body>
194
- {rows.map(([amount, payment]) => (
195
- <Table.Row key={payment}>
196
- <Table.Cell>{amount}</Table.Cell>
197
- <Table.Cell>{payment}</Table.Cell>
198
- </Table.Row>
199
- ))}
200
- </Table.Body>
201
- </Table.Root>
202
- )
203
- }
204
-
205
- namespace styles {
206
- export const table = style({ maxWidth: '16rem !custom' })
207
- }
208
- ```
209
-
210
- ## Keep Multi-Line Rows Readable
211
-
212
- A row with a wrapped description or a second line of detail grows taller than its neighbours. Keep each value whole and each row anchored to its first line.
213
-
214
- * **Top-Align Tall Rows (verticalAlign):** If any cell in a table wraps or adds a subtitle, top-align every cell, so each row reads from its first line.
215
- * **Keep Dates Whole (nowrap):** Keep a date and its time on one line. If the column is narrow, drop the time from secondary dates.
216
- * **Shorten Every Identifier (formatHex):** Shorten each address inside a compound value, such as a route. A symbol, such as USDC, stays whole.
217
- * **Wrap Prose Only (Table.Subtitle):** Let only sentences wrap. Put a secondary value in a `Table.Subtitle` below the cell's first line.
218
-
219
- **Do:** Top-align a tall row, keep the date on one line, and shorten each address in the route.
220
-
221
- ```tsx
222
- /**
223
- * Do example for "Keep Multi-Line Rows Readable" on the Tables and Lists page.
224
- * Top-align a row whose cells wrap, keep dates whole, and shorten each address in a compound value.
225
- * @module
226
- */
227
- import { formatHex, style, Table } from '@tempoxyz/ds'
228
-
229
- /** Renders the static preview, which the guideline card shows inert. */
230
- export function Demo() {
231
- return (
232
- <Table.Root size="small" {...styles.table()}>
233
- <Table.Head>
234
- <Table.Row>
235
- <Table.HeaderCell>Route</Table.HeaderCell>
236
- <Table.HeaderCell>Updated</Table.HeaderCell>
237
- </Table.Row>
238
- </Table.Head>
239
- <Table.Body>
240
- <Table.Row>
241
- <Table.Cell mono {...styles.top()}>
242
- {formatHex('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', { evm: false })} →{' '}
243
- {formatHex('0x20c0000000000000000000000000000000000000')}
244
- <Table.Subtitle>Chain 792703809 → 4217</Table.Subtitle>
245
- </Table.Cell>
246
- <Table.Cell {...styles.date()}>Oct 9, 2026, 12:04 AM</Table.Cell>
247
- </Table.Row>
248
- </Table.Body>
249
- </Table.Root>
250
- )
251
- }
252
-
253
- namespace styles {
254
- export const date = style({ verticalAlign: 'top', whiteSpace: 'nowrap' })
255
-
256
- export const table = style({ maxWidth: '18rem !custom' })
257
-
258
- export const top = style({ verticalAlign: 'top' })
259
- }
260
- ```
261
-
262
- **Don't:** Let a full address or a date wrap across lines in a middle-aligned row.
263
-
264
- ```tsx
265
- /**
266
- * Don't example for "Keep Multi-Line Rows Readable" on the Tables and Lists page.
267
- * A full address wraps across lines, the date breaks mid-value, and middle alignment staggers the row.
268
- * @module
269
- */
270
- import { style, Table } from '@tempoxyz/ds'
271
-
272
- /** Renders the static preview, which the guideline card shows inert. */
273
- export function Demo() {
274
- return (
275
- <Table.Root size="small" {...styles.table()}>
276
- <Table.Head>
277
- <Table.Row>
278
- <Table.HeaderCell>Route</Table.HeaderCell>
279
- <Table.HeaderCell>Updated</Table.HeaderCell>
280
- </Table.Row>
281
- </Table.Head>
282
- <Table.Body>
283
- <Table.Row>
284
- <Table.Cell {...styles.wrap()}>
285
- EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v →
286
- 0x20c0000000000000000000000000000000000000
287
- <Table.Subtitle>Chain 792703809 → 4217</Table.Subtitle>
288
- </Table.Cell>
289
- <Table.Cell {...styles.narrow()}>Oct 9, 2026, 12:04 AM</Table.Cell>
290
- </Table.Row>
291
- </Table.Body>
292
- </Table.Root>
293
- )
294
- }
295
-
296
- namespace styles {
297
- export const narrow = style({ width: '5rem !custom' })
298
-
299
- export const table = style({ maxWidth: '18rem !custom', tableLayout: 'fixed !custom' })
300
-
301
- export const wrap = style({ overflowWrap: 'anywhere' })
302
- }
303
- ```
304
-
305
- ## Select Rows and Act in Bulk
306
-
307
- If an action applies to several records at once, such as pausing payouts or revoking keys, add a leading column of small [Checkbox](../components/checkbox.md) controls. Select rows in the example to show the bulk actions.
308
-
309
- ```tsx
310
- import { Amount, Badge, Button, Checkbox, Inset, style, Surface, Table } from '@tempoxyz/ds'
311
- import { ArrowDown, ArrowUp, Sort } from '@tempoxyz/ds/icons'
312
- import { useState } from 'react'
313
-
314
- export const fill = true
315
- const payouts = [
316
- {
317
- amount: '1200.00',
318
- date: '2026-10-20',
319
- id: 'p1',
320
- recipient: 'Ada Lovelace',
321
- status: 'Scheduled',
322
- },
323
- { amount: '48.50', date: '2026-10-18', id: 'p2', recipient: 'Grace Hopper', status: 'Scheduled' },
324
- { amount: '310.00', date: '2026-10-21', id: 'p3', recipient: 'Alan Turing', status: 'Paused' },
325
- {
326
- amount: '9.99',
327
- date: '2026-10-19',
328
- id: 'p4',
329
- recipient: 'Katherine Johnson',
330
- status: 'Scheduled',
331
- },
332
- ]
333
-
334
- type Column = 'amount' | 'date'
335
-
336
- export function Demo() {
337
- const [selected, setSelected] = useState<readonly string[]>([])
338
- const [sort, setSort] = useState<{ column: Column; direction: 'ascending' | 'descending' }>({
339
- column: 'date',
340
- direction: 'descending',
341
- })
342
-
343
- const rows = [...payouts].sort((a, b) => {
344
- const order =
345
- sort.column === 'amount' ? Number(a.amount) - Number(b.amount) : a.date.localeCompare(b.date)
346
- return sort.direction === 'ascending' ? order : -order
347
- })
348
- const all = selected.length === payouts.length
349
- const some = selected.length > 0 && !all
350
-
351
- function toggle(column: Column) {
352
- setSort((current) => ({
353
- column,
354
- direction:
355
- current.column === column && current.direction === 'descending'
356
- ? 'ascending'
357
- : 'descending',
358
- }))
359
- }
360
-
361
- function header(column: Column, label: string) {
362
- const active = sort.column === column
363
- const Icon = (() => {
364
- if (!active) return Sort
365
- return sort.direction === 'ascending' ? ArrowUp : ArrowDown
366
- })()
367
-
368
- return (
369
- <Table.HeaderCell
370
- aria-sort={active ? sort.direction : undefined}
371
- justify={column === 'amount' ? 'end' : 'start'}
372
- >
373
- <button onClick={() => toggle(column)} type="button" {...styles.sort()}>
374
- {label}
375
- <Icon aria-hidden="true" />
376
- </button>
377
- </Table.HeaderCell>
378
- )
379
- }
380
-
381
- return (
382
- <Inset
383
- aria-label="Scheduled payouts"
384
- role="region"
385
- space="16"
386
- tabIndex={0}
387
- {...styles.region()}
388
- >
389
- <Surface {...styles.surface()}>
390
- <Surface.Header>
391
- <Surface.Title>Scheduled payouts</Surface.Title>
392
- <div {...styles.actions()}>
393
- <span role="status" {...styles.count()}>
394
- {selected.length > 0 ? `${selected.length} selected` : ''}
395
- </span>
396
- {selected.length > 0 ? (
397
- <>
398
- <Button onClick={() => setSelected([])} size="small" variant="tertiary">
399
- Clear
400
- </Button>
401
- <Button size="small" variant="secondary">
402
- Pause
403
- </Button>
404
- <Button size="small">Cancel payouts</Button>
405
- </>
406
- ) : (
407
- <Button size="small" variant="secondary">
408
- Export CSV
409
- </Button>
410
- )}
411
- </div>
412
- </Surface.Header>
413
- <Table.Root>
414
- <Table.Head>
415
- <Table.Row>
416
- <Table.HeaderCell {...styles.check()}>
417
- <Checkbox
418
- aria-label="Select all payouts"
419
- checked={all}
420
- indeterminate={some}
421
- onCheckedChange={() => setSelected(all ? [] : payouts.map((payout) => payout.id))}
422
- size="small"
423
- />
424
- </Table.HeaderCell>
425
- <Table.HeaderCell>Recipient</Table.HeaderCell>
426
- {header('date', 'Date')}
427
- <Table.HeaderCell>Status</Table.HeaderCell>
428
- {header('amount', 'Amount')}
429
- </Table.Row>
430
- </Table.Head>
431
- <Table.Body>
432
- {rows.map((payout) => {
433
- const checked = selected.includes(payout.id)
434
-
435
- return (
436
- <Table.Row data-selected={checked || undefined} key={payout.id} {...styles.row()}>
437
- <Table.Cell {...styles.check()}>
438
- <Checkbox
439
- aria-label={`Select payout to ${payout.recipient}`}
440
- checked={checked}
441
- onCheckedChange={() =>
442
- setSelected(
443
- checked
444
- ? selected.filter((id) => id !== payout.id)
445
- : [...selected, payout.id],
446
- )
447
- }
448
- size="small"
449
- />
450
- </Table.Cell>
451
- <Table.Cell>{payout.recipient}</Table.Cell>
452
- <Table.Cell>
453
- <time dateTime={payout.date}>
454
- {new Date(`${payout.date}T12:00:00`).toLocaleDateString(undefined, {
455
- day: 'numeric',
456
- month: 'short',
457
- })}
458
- </time>
459
- </Table.Cell>
460
- <Table.Cell>
461
- <Badge size="small">{payout.status}</Badge>
462
- </Table.Cell>
463
- <Table.Cell justify="end" numeric>
464
- <Amount align="right" currency="USD" value={payout.amount} />
465
- </Table.Cell>
466
- </Table.Row>
467
- )
468
- })}
469
- </Table.Body>
470
- </Table.Root>
471
- </Surface>
472
- </Inset>
473
- )
474
- }
475
-
476
- namespace styles {
477
- export const actions = style({ alignItems: 'center', columnGap: '8', display: 'flex' })
478
-
479
- export const check = style({ width: '1px !custom' })
480
-
481
- export const count = style({ color: 'content.secondary', typography: 'body.b3' })
482
-
483
- export const region = style({ backgroundColor: 'background.primary', overflowX: 'auto' })
484
-
485
- export const row = style({
486
- selectors: { '&[data-selected]': { backgroundColor: 'container.regular' } },
487
- })
488
-
489
- export const sort = style({
490
- alignItems: 'center',
491
- appearance: 'none !custom',
492
- backgroundColor: 'transparent !custom',
493
- border: 'none !custom',
494
- borderRadius: '3xs',
495
- color: 'inherit !custom',
496
- columnGap: '4',
497
- cursor: 'pointer',
498
- display: 'inline-flex',
499
- font: 'inherit !custom',
500
- outlineColor: 'transparent !custom',
501
- outlineOffset: '2',
502
- outlineStyle: 'solid !custom',
503
- outlineWidth: '2',
504
- padding: '0',
505
- transitionDuration: '160',
506
- transitionProperty: 'color, outline-color',
507
- transitionTimingFunction: 'snappy',
508
- selectors: {
509
- '&:focus-visible': { outlineColor: 'border.focus' },
510
- '&:hover': { color: 'content.primary' },
511
- },
512
- })
513
-
514
- export const surface = style({ minWidth: '36rem !custom' })
515
- }
516
- ```
517
-
518
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/TablesSelection.tsx)
519
-
520
- * **Name Each Checkbox:** Name each checkbox by its row, such as Select payout to Ada Lovelace.
521
- * **Header Checkbox (indeterminate):** The header checkbox selects every row on the page. It shows this state while only some rows are selected.
522
- * **Selection Count:** Show the count, such as 2 selected, beside the bulk actions and a Clear action.
523
- * **Select All Matching:** If more pages exist, state that the header selects this page only. Offer to select all matches.
524
-
525
- Confirm a destructive bulk action in an [AlertDialog](../components/alert-dialog.md) that names the count, such as Cancel 2 payouts, as [Destructive Actions](destructive-actions.md) describes.
526
-
527
- ## Edit Rows in Place
528
-
529
- If people enter or change several records with the same fields, such as the recipients of a batch payout, put the controls in the cells of a table. Change an amount in the example to show the error, or add and remove rows.
530
-
531
- ```tsx
532
- /** Reference layout of a table whose rows people edit in place, such as the recipients of a batch payout. @module */
533
- import { Amount, Button, Field, Inset, style, Surface, Table, TextInput } from '@tempoxyz/ds'
534
- import { Delete, Plus } from '@tempoxyz/ds/icons'
535
- import { useState } from 'react'
536
-
537
- export const fill = true
538
- type Row = { amount: string; id: number; recipient: string }
539
-
540
- const initial: readonly Row[] = [
541
- { amount: '1200.00', id: 1, recipient: 'ada.tempo' },
542
- { amount: '48.5x', id: 2, recipient: 'grace.tempo' },
543
- { amount: '310.00', id: 3, recipient: 'alan.tempo' },
544
- ]
545
-
546
- function valid(amount: string) {
547
- return /^\d+(?:\.\d{1,2})?$/.test(amount) && Number(amount) > 0
548
- }
549
-
550
- export function Demo() {
551
- const [next, setNext] = useState(initial.length + 1)
552
- const [rows, setRows] = useState<readonly Row[]>(initial)
553
-
554
- const total = rows
555
- .filter((row) => valid(row.amount))
556
- .reduce((sum, row) => sum + Number(row.amount), 0)
557
-
558
- function update(id: number, field: 'amount' | 'recipient', value: string) {
559
- setRows((current) => current.map((row) => (row.id === id ? { ...row, [field]: value } : row)))
560
- }
561
-
562
- return (
563
- <Inset aria-label="Batch payout" role="region" space="16" tabIndex={0} {...styles.region()}>
564
- <Surface {...styles.surface()}>
565
- <Surface.Header>
566
- <Surface.Title id="batch-title">Batch payout</Surface.Title>
567
- <Button
568
- onClick={() => {
569
- setRows((current) => [...current, { amount: '', id: next, recipient: '' }])
570
- setNext(next + 1)
571
- }}
572
- size="small"
573
- variant="secondary"
574
- >
575
- <Plus />
576
- Add recipient
577
- </Button>
578
- </Surface.Header>
579
- <Table.Root aria-labelledby="batch-title" size="large">
580
- <Table.Head>
581
- <Table.Row>
582
- <Table.HeaderCell id="batch-recipient">Recipient</Table.HeaderCell>
583
- <Table.HeaderCell id="batch-amount">Amount</Table.HeaderCell>
584
- <Table.HeaderCell {...styles.action()}>
585
- <span {...styles.hidden()}>Actions</span>
586
- </Table.HeaderCell>
587
- </Table.Row>
588
- </Table.Head>
589
- <Table.Body>
590
- {rows.map((row, index) => {
591
- const invalid = row.amount !== '' && !valid(row.amount)
592
-
593
- return (
594
- <Table.Row key={row.id}>
595
- <Table.Cell {...styles.top()}>
596
- <Field.Root>
597
- <TextInput.Group>
598
- <TextInput.Control
599
- aria-label={`Recipient, row ${index + 1}`}
600
- autoComplete="off"
601
- onValueChange={(value) => update(row.id, 'recipient', value)}
602
- placeholder="name.tempo or 0x…"
603
- value={row.recipient}
604
- />
605
- </TextInput.Group>
606
- </Field.Root>
607
- </Table.Cell>
608
- <Table.Cell {...styles.top()}>
609
- <Field.Root invalid={invalid}>
610
- <TextInput.Group>
611
- <TextInput.Control
612
- aria-label={`Amount, row ${index + 1}`}
613
- inputMode="decimal"
614
- onValueChange={(value) => update(row.id, 'amount', value)}
615
- placeholder="0.00"
616
- value={row.amount}
617
- />
618
- <TextInput.Suffix>USDC</TextInput.Suffix>
619
- </TextInput.Group>
620
- <Field.Error match={invalid}>Enter an amount, such as 25.00.</Field.Error>
621
- </Field.Root>
622
- </Table.Cell>
623
- <Table.Cell {...styles.remove()}>
624
- <Button
625
- aria-label={`Remove row ${index + 1}`}
626
- disabled={rows.length === 1}
627
- onClick={() =>
628
- setRows((current) => current.filter((item) => item.id !== row.id))
629
- }
630
- shape="icon"
631
- size="small"
632
- variant="tertiary"
633
- >
634
- <Delete />
635
- </Button>
636
- </Table.Cell>
637
- </Table.Row>
638
- )
639
- })}
640
- </Table.Body>
641
- </Table.Root>
642
- <div {...styles.total()}>
643
- <span>Total</span>
644
- <Amount align="right" symbol="USDC" value={total.toFixed(2)} />
645
- </div>
646
- </Surface>
647
- </Inset>
648
- )
649
- }
650
-
651
- namespace styles {
652
- export const action = style({ width: '1px !custom' })
653
-
654
- export const hidden = style({
655
- clipPath: 'inset(50%) !custom',
656
- height: '1px !custom',
657
- overflow: 'hidden',
658
- position: 'absolute',
659
- whiteSpace: 'nowrap',
660
- width: '1px !custom',
661
- })
662
-
663
- export const region = style({ backgroundColor: 'background.primary', overflowX: 'auto' })
664
-
665
- export const remove = style({ verticalAlign: 'top', width: '1px !custom' })
666
-
667
- export const surface = style({ minWidth: '36rem !custom' })
668
-
669
- export const top = style({ verticalAlign: 'top' })
670
-
671
- export const total = style({
672
- alignItems: 'center',
673
- color: 'content.primary',
674
- display: 'flex',
675
- justifyContent: 'space-between',
676
- paddingBlockStart: '12',
677
- typography: 'body.b2Strong',
678
- })
679
- }
680
- ```
681
-
682
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/TablesEditable.tsx)
683
-
684
- * **Row Height (large):** Use the large table, whose rows hold a medium field without a change in height.
685
- * **Header as Label (aria-label):** The column header is the visible label. Name each control by its column and row.
686
- * **Errors in the Cell (Field.Error):** Wrap each control in a Field, and show its error below the control in the same cell.
687
- * **Rows and Totals:** Add rows from the header. Remove each row with a named icon button. Show totals below.
688
-
689
- **Do:** Keep the controls and type of the library, and let the header label the column.
690
-
691
- ```tsx
692
- <Table.Root size="large" style={{ width: 280 }}>
693
- <Table.Head>
694
- <Table.Row>
695
- <Table.HeaderCell>Recipient</Table.HeaderCell>
696
- <Table.HeaderCell>Amount</Table.HeaderCell>
697
- </Table.Row>
698
- </Table.Head>
699
- <Table.Body>
700
- <Table.Row>
701
- <Table.Cell>
702
- <TextInput.Group>
703
- <TextInput.Control aria-label="Recipient, row 1" defaultValue="ada.tempo" />
704
- </TextInput.Group>
705
- </Table.Cell>
706
- <Table.Cell>
707
- <TextInput.Group>
708
- <TextInput.Control aria-label="Amount, row 1" defaultValue="25.00" />
709
- </TextInput.Group>
710
- </Table.Cell>
711
- </Table.Row>
712
- </Table.Body>
713
- </Table.Root>
714
- ```
715
-
716
- **Don't:** Build a grid of native inputs with hand-styled headers in a new type set.
717
-
718
- ```tsx
719
- <div style={{ display: 'grid', gap: 8, gridTemplateColumns: '1fr 1fr', width: 280 }}>
720
- <strong>RECIPIENT</strong>
721
- <strong>AMOUNT</strong>
722
- <input aria-label="Recipient, row 1" defaultValue="ada.tempo" />
723
- <input aria-label="Amount, row 1" defaultValue="25.00" />
724
- </div>
725
- ```
726
-
727
- Use an editable table only for repeated records. For the fields of one record, use one column of fields, as [Forms](forms.md) describes. If a row needs more than three or four controls, edit it in a [Dialog](../components/dialog.md) or a [Drawer](../components/drawer.md) instead.
728
-
729
- ## Sort Columns
730
-
731
- [Table](../components/table.md) has no built-in sorting. Put a `button` inside each sortable `Table.HeaderCell`. Set `aria-sort` to `ascending` or `descending` on the sorted column.
732
-
733
- * **Direction:** Show the sort direction with an arrow, and mark other sortable columns with the sort icon.
734
- * **Default order:** Sort activity newest first. A first click on a numeric column sorts largest first.
735
- * **Whole data set:** Sort every record, not only the rows on the current page.
736
-
737
- ## Paginate or Load More
738
-
739
- * **Pagination (Pagination):** For lists revisited by position or shared, such as invoices, audit logs, or blocks. Give each page a URL.
740
- * **Load More:** For feeds read from the top, such as wallet activity. Append the next batch below the current rows.
741
- * **Infinite Scroll (Avoid):** On the web, it hides the footer and leaves no position to return to.
742
-
743
- Show the range beside either control, such as Showing 20 of 248. After Load more, keep focus on the button.
744
-
745
- Below 640px, show Previous and Next with a Page 1 of 3 label between them, as in the stacked example. Use `medium` pagination for touch targets.
746
-
747
- ## Choose a Density
748
-
749
- * **Small (32px):** For dense consoles and dashboards with many rows. Pair with small buttons.
750
- * **Medium (40px):** The default size, for most tables in consoles and settings.
751
- * **Large (56px):** For touch-first screens and rows with two lines or an [Avatar](../components/avatar.md).
752
-
753
- Use one density per table. [ListGroup](../components/list-group.md) keep one 36px height for key-value facts.
754
-
755
- ## Keep Headers in View
756
-
757
- If a long table scrolls, set `sticky` on `Table.Head`. This works inside a container with a fixed height or with the page. Header cells take the surface background, so rows pass beneath them. An ancestor with `overflow: hidden` stops the header from sticking.
758
-
759
- ## States
760
-
761
- Keep the headers and filters in place in every state, so the table does not jump.
762
-
763
- ```tsx
764
- import { Amount, Button, ChoiceGroup, Empty, Hex, Skeleton, Stack, style, Table } from '@tempoxyz/ds'
765
- import { History } from '@tempoxyz/ds/icons'
766
- import { useState } from 'react'
767
-
768
- export const fill = true
769
- const activity = [
770
- ['0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060', 'Sent', '-1200.00'],
771
- ['0x91bd07e1c3e05a2277a1c0d94f2a91c3b6a900fa2b585dd299e03d12fa4293bc', 'Received', '4005.00'],
772
- ['0xc3e05a2291bd07e14f2a91c3b6a900fa2b585dd299e03d12fa4293bc77a1c0d9', 'Sent', '-48.50'],
773
- ['0x77a1c0d94f2a91c3b6a900fa2b585dd299e03d12fa4293bcc3e05a2291bd07e1', 'Received', '250.00'],
774
- ['0x2b585dd299e03d12fa4293bc77a1c0d94f2a91c3b6a900fac3e05a2291bd07e1', 'Sent', '-9.99'],
775
- ['0xd299e03d12fa4293bc77a1c0d94f2a91c3b6a900fa2b585dc3e05a2291bd07e1', 'Received', '1250.50'],
776
- ['0x4f2a91c3b6a900fa2b585dd299e03d12fa4293bc77a1c0d9c3e05a2291bd07e1', 'Sent', '-310.00'],
777
- ['0xb6a900fa2b585dd299e03d12fa4293bc77a1c0d94f2a91c3c3e05a2291bd07e1', 'Received', '75.25'],
778
- ] as const
779
-
780
- type State = 'empty' | 'loaded' | 'loading'
781
-
782
- export function Demo() {
783
- const [state, setState] = useState<State>('loaded')
784
-
785
- return (
786
- <Stack gap="16">
787
- <ChoiceGroup.Root
788
- aria-label="Table state"
789
- onValueChange={(value) => setState(value as State)}
790
- size="small"
791
- value={state}
792
- >
793
- <ChoiceGroup.Item value="loaded">Loaded</ChoiceGroup.Item>
794
- <ChoiceGroup.Item value="loading">Loading</ChoiceGroup.Item>
795
- <ChoiceGroup.Item value="empty">Empty</ChoiceGroup.Item>
796
- </ChoiceGroup.Root>
797
- <div aria-labelledby="activity-title" role="region" tabIndex={0} {...styles.scroll()}>
798
- <Table.Root aria-busy={state === 'loading' || undefined} size="small">
799
- <Table.Caption id="activity-title">Recent activity</Table.Caption>
800
- <Table.Head sticky>
801
- <Table.Row>
802
- <Table.HeaderCell>Transaction</Table.HeaderCell>
803
- <Table.HeaderCell>Type</Table.HeaderCell>
804
- <Table.HeaderCell justify="end">Amount</Table.HeaderCell>
805
- </Table.Row>
806
- </Table.Head>
807
- <Table.Body>
808
- {state === 'loaded' &&
809
- activity.map(([hash, type, amount]) => (
810
- <Table.Row key={hash}>
811
- <Table.Cell>
812
- <div {...styles.hash()}>
813
- <Hex value={hash} />
814
- </div>
815
- </Table.Cell>
816
- <Table.Cell>{type}</Table.Cell>
817
- <Table.Cell numeric>
818
- <Amount
819
- align="right"
820
- sign={amount.startsWith('-') ? '−' : '+'}
821
- symbol="USDC"
822
- value={amount.replace('-', '')}
823
- />
824
- </Table.Cell>
825
- </Table.Row>
826
- ))}
827
- {state === 'loading' &&
828
- ['60%', '45%', '70%', '50%'].map((width) => (
829
- <Table.Row key={width}>
830
- <Table.Cell>
831
- <Skeleton shape="pill" style={{ height: 12, width }} />
832
- </Table.Cell>
833
- <Table.Cell>
834
- <Skeleton shape="pill" style={{ height: 12, width: '4rem' }} />
835
- </Table.Cell>
836
- <Table.Cell>
837
- <Skeleton
838
- shape="pill"
839
- style={{ height: 12, marginInlineStart: 'auto', width: '5rem' }}
840
- />
841
- </Table.Cell>
842
- </Table.Row>
843
- ))}
844
- {state === 'empty' && (
845
- <Table.Row>
846
- <Table.Cell colSpan={3}>
847
- <Empty.Root>
848
- <Empty.Icon>
849
- <History />
850
- </Empty.Icon>
851
- <Empty.Title>No activity yet</Empty.Title>
852
- <Empty.Description>Payments you send or receive appear here.</Empty.Description>
853
- <Empty.Actions>
854
- <Button size="small">Add funds</Button>
855
- </Empty.Actions>
856
- </Empty.Root>
857
- </Table.Cell>
858
- </Table.Row>
859
- )}
860
- </Table.Body>
861
- </Table.Root>
862
- </div>
863
- {state === 'loaded' && (
864
- <div {...styles.footer()}>
865
- <span {...styles.count()}>Showing 8 of 24</span>
866
- <Button size="small" variant="secondary">
867
- Load more
868
- </Button>
869
- </div>
870
- )}
871
- </Stack>
872
- )
873
- }
874
-
875
- namespace styles {
876
- export const count = style({ color: 'content.secondary', typography: 'body.b3' })
877
-
878
- export const footer = style({
879
- alignItems: 'center',
880
- display: 'flex',
881
- flexWrap: 'wrap',
882
- gap: '12',
883
- justifyContent: 'space-between',
884
- })
885
-
886
- export const hash = style({ maxWidth: '12rem !custom' })
887
-
888
- export const scroll = style({
889
- backgroundColor: 'background.elevated',
890
- borderColor: 'line.secondary',
891
- borderRadius: 'sm',
892
- borderStyle: 'solid',
893
- borderWidth: 'regular',
894
- maxHeight: '18rem !custom',
895
- overflowY: 'auto',
896
- })
897
- }
898
- ```
899
-
900
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/TablesStates.tsx)
901
-
902
- * **Loading (aria-busy):** Keep the headers and show three to five placeholder rows. Mark the table busy.
903
- * **Empty (Empty):** If no records exist yet, offer the action that creates the first one. [Empty States](empty-states.md) covers the variants.
904
- * **Error (negative):** Show a negative [Alert](../components/alert.md) above the table with Retry. Keep rows that already loaded.
905
- * **Updating:** Keep the current rows while a sort or filter loads. Replace them when the new rows arrive.
906
-
907
- **Do:** Explain an empty result in a row that spans every column, with a way out.
908
-
909
- ```tsx
910
- /**
911
- * Do example for "Tables and Lists" on the Tables and Lists page.
912
- * Explain an empty result in a row that spans every column, with a way out.
913
- * @module
914
- */
915
- import { Button, style, Table } from '@tempoxyz/ds'
916
-
917
- /** Renders the static preview, which the guideline card shows inert. */
918
- export function Demo() {
919
- return (
920
- <Table.Root size="small" {...styles.table()}>
921
- <Table.Head>
922
- <Table.Row>
923
- <Table.HeaderCell>Key</Table.HeaderCell>
924
- <Table.HeaderCell>Last used</Table.HeaderCell>
925
- </Table.Row>
926
- </Table.Head>
927
- <Table.Body>
928
- <Table.Row>
929
- <Table.Cell colSpan={2}>
930
- <div {...styles.empty()}>
931
- <span {...styles.text()}>No keys match Staging.</span>
932
- <Button size="small" variant="secondary">
933
- Clear filter
934
- </Button>
935
- </div>
936
- </Table.Cell>
937
- </Table.Row>
938
- </Table.Body>
939
- </Table.Root>
940
- )
941
- }
942
-
943
- namespace styles {
944
- export const empty = style({
945
- alignItems: 'center',
946
- display: 'flex',
947
- flexDirection: 'column',
948
- paddingBlock: '16',
949
- rowGap: '12',
950
- })
951
-
952
- export const table = style({ maxWidth: '17rem !custom' })
953
-
954
- export const text = style({ color: 'content.secondary', typography: 'body.b2' })
955
- }
956
- ```
957
-
958
- **Don't:** Leave headers above an empty body.
959
-
960
- ```tsx
961
- /**
962
- * Don't example for "Tables and Lists" on the Tables and Lists page.
963
- * Don't leave headers above an empty body.
964
- * @module
965
- */
966
- import { style, Table } from '@tempoxyz/ds'
967
-
968
- /** Renders the static preview, which the guideline card shows inert. */
969
- export function Demo() {
970
- return (
971
- <Table.Root size="small" {...styles.table()}>
972
- <Table.Head>
973
- <Table.Row>
974
- <Table.HeaderCell>Key</Table.HeaderCell>
975
- <Table.HeaderCell>Last used</Table.HeaderCell>
976
- </Table.Row>
977
- </Table.Head>
978
- <Table.Body />
979
- </Table.Root>
980
- )
981
- }
982
-
983
- namespace styles {
984
- export const table = style({ maxWidth: '17rem !custom' })
985
- }
986
- ```
987
-
988
- ## Below 640px
989
-
990
- Tables with more than two or three columns do not fit a phone. Turn each row into a stacked list item: the main text and amount on the first line, the date and status beneath. Below 640px, the preview switches layouts.
991
-
992
- ```tsx
993
- import { Amount, Badge, ListGroup, Pagination, Stack, style, Surface, Table } from '@tempoxyz/ds'
994
-
995
- export const fill = true
996
- const payments = [
997
- { amount: '1200.00', date: 'Oct 20', recipient: 'Ada Lovelace', status: 'Confirmed' },
998
- { amount: '48.50', date: 'Oct 19', recipient: 'Grace Hopper', status: 'Confirmed' },
999
- { amount: '310.00', date: 'Oct 18', recipient: 'Alan Turing', status: 'Pending' },
1000
- { amount: '9.99', date: 'Oct 18', recipient: 'Katherine Johnson', status: 'Failed' },
1001
- ] as const
1002
-
1003
- const intents = { Confirmed: 'positive', Failed: 'negative', Pending: 'warning' } as const
1004
-
1005
- export function Demo() {
1006
- return (
1007
- <Stack gap="16" {...styles.demo()}>
1008
- <h2 id="payments-title" {...styles.title()}>
1009
- Payments
1010
- </h2>
1011
- {/* Both layouts render, and `display: none` keeps only the visible one in the accessibility tree. */}
1012
- <div {...styles.wide()}>
1013
- <Surface>
1014
- <Table.Root aria-labelledby="payments-title">
1015
- <Table.Head>
1016
- <Table.Row>
1017
- <Table.HeaderCell>Recipient</Table.HeaderCell>
1018
- <Table.HeaderCell>Date</Table.HeaderCell>
1019
- <Table.HeaderCell>Status</Table.HeaderCell>
1020
- <Table.HeaderCell justify="end">Amount</Table.HeaderCell>
1021
- </Table.Row>
1022
- </Table.Head>
1023
- <Table.Body>
1024
- {payments.map((payment) => (
1025
- <Table.Row key={payment.recipient}>
1026
- <Table.Cell>{payment.recipient}</Table.Cell>
1027
- <Table.Cell>{payment.date}</Table.Cell>
1028
- <Table.Cell status={intents[payment.status]}>{payment.status}</Table.Cell>
1029
- <Table.Cell numeric>
1030
- <Amount align="right" currency="USD" value={payment.amount} />
1031
- </Table.Cell>
1032
- </Table.Row>
1033
- ))}
1034
- </Table.Body>
1035
- </Table.Root>
1036
- </Surface>
1037
- </div>
1038
- <div {...styles.narrow()}>
1039
- <Surface size="small">
1040
- <ListGroup.Root aria-labelledby="payments-title" role="list">
1041
- {payments.map((payment) => (
1042
- <ListGroup.Row key={payment.recipient} role="listitem">
1043
- <ListGroup.Info>
1044
- <ListGroup.Title>{payment.recipient}</ListGroup.Title>
1045
- <ListGroup.Description>{payment.date}</ListGroup.Description>
1046
- </ListGroup.Info>
1047
- <span {...styles.end()}>
1048
- <Amount currency="USD" value={payment.amount} />
1049
- <Badge size="small">{payment.status}</Badge>
1050
- </span>
1051
- </ListGroup.Row>
1052
- ))}
1053
- </ListGroup.Root>
1054
- </Surface>
1055
- </div>
1056
- <div {...styles.footer()}>
1057
- <span {...styles.count()}>1–4 of 12</span>
1058
- <div {...styles.wide()}>
1059
- <Pagination>
1060
- <Pagination.Previous disabled />
1061
- <Pagination.Page current href="#">
1062
- 1
1063
- </Pagination.Page>
1064
- <Pagination.Page href="#">2</Pagination.Page>
1065
- <Pagination.Page href="#">3</Pagination.Page>
1066
- <Pagination.Next href="#" />
1067
- </Pagination>
1068
- </div>
1069
- <div {...styles.narrow()}>
1070
- <Pagination>
1071
- <Pagination.Previous disabled />
1072
- <Pagination.Ellipsis>Page 1 of 3</Pagination.Ellipsis>
1073
- <Pagination.Next href="#" />
1074
- </Pagination>
1075
- </div>
1076
- </div>
1077
- </Stack>
1078
- )
1079
- }
1080
-
1081
- namespace styles {
1082
- export const count = style({
1083
- color: 'content.secondary',
1084
- display: 'none',
1085
- typography: 'body.b3',
1086
- '@media 640': { display: 'inline' },
1087
- })
1088
-
1089
- export const demo = style({ backgroundColor: 'background.primary', padding: '16' })
1090
-
1091
- export const end = style({
1092
- alignItems: 'flex-end',
1093
- display: 'flex',
1094
- flexDirection: 'column',
1095
- flexShrink: '0 !custom',
1096
- rowGap: '4',
1097
- })
1098
-
1099
- export const footer = style({
1100
- alignItems: 'center',
1101
- display: 'flex',
1102
- flexWrap: 'wrap',
1103
- gap: '12',
1104
- justifyContent: 'space-between',
1105
- })
1106
-
1107
- export const narrow = style({ '@media 640': { display: 'none' } })
1108
-
1109
- export const title = style({ margin: '0', typography: 'heading.h3' })
1110
-
1111
- export const wide = style({ display: 'none', '@media 640': { display: 'block' } })
1112
- }
1113
- ```
1114
-
1115
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/TablesResponsive.tsx)
1116
-
1117
- * **Switch Layouts (sm):** Render a table from this breakpoint and a list below it. Only the visible layout stays in the accessibility tree.
1118
- * **Same Records and Actions:** Keep records, order, and actions the same in both layouts. Put columns that do not fit in the detail view.
1119
- * **Scroll to Compare (tabIndex=0):** Keep a table only to compare values across columns, and [scroll it inside its own region](responsive-layout.md#scroll-wide-content-inside-its-own-region).
1120
-
1121
- ## Content
1122
-
1123
- * **Headers:** Put the unit of a metric in its header, such as p99 (ms). Keep the token on each amount, because one table can mix assets.
1124
- * **Missing values:** Show a missing value as a word, such as None or Never, instead of an empty cell.
1125
- * **Dates:** Format dates the same way in every row, as [Blockchain Values](blockchain-values.md#timestamps) describes, and keep each date on one line.
1126
-
1127
- ## Accessibility
1128
-
1129
- * **Native Table (scope=col):** A native table with column headers. Pass `scope="row"` for a row header. Do not use it for layout.
1130
- * **Clickable Rows (interactive):** Adds hover and focus styles only. Put a link or button in each clickable row.
1131
- * **Live Counts (status):** Announce the selection count and loaded batches through an always-rendered status region.
1132
- * **Status Text (status):** Colors text only. The text must state the status, such as Failed.
1133
-
1134
- ## Related
1135
-
1136
- [Table](../components/table.md)
1137
-
1138
- Use for tabular data.
1139
-
1140
- [ListGroup](../components/list-group.md)
1141
-
1142
- Use for details, settings, and stacked items.
1143
-
1144
- [Pagination](../components/pagination.md)
1145
-
1146
- Use for paged lists.
1147
-
1148
- [Checkbox](../components/checkbox.md)
1149
-
1150
- Use for row selection.
1151
-
1152
- [Responsive Layout](responsive-layout.md)
1153
-
1154
- Covers the shared breakpoints.
1155
-
1156
- [Loading](loading.md)
1157
-
1158
- Covers skeletons and spinners.
1159
-
1160
- [Empty States](empty-states.md)
1161
-
1162
- Covers first use and no results.
1163
-
1164
- [Forms](forms.md)
1165
-
1166
- Covers fields, labels, and errors in a form.
1167
-
1168
- [Destructive Actions](destructive-actions.md)
1169
-
1170
- Covers confirming bulk actions.