@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,528 +0,0 @@
1
- # RadioGroup
2
-
3
- Lets you pick a single option from a short list.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/RadioGroup.tsx)
6
-
7
- Figma: [Radio Group](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=3506-3363) (`RadioGroup.Root`)
8
-
9
- ## Overview
10
-
11
- Arrow keys move focus and selection together.
12
-
13
- ## Examples
14
-
15
- ### Basic
16
-
17
- ```tsx
18
- import { Field, RadioGroup } from '@tempoxyz/ds'
19
-
20
- function Choice(props: { label: string; value: string }) {
21
- return (
22
- <Field.Root>
23
- <Field.Item>
24
- <RadioGroup.Item value={props.value} />
25
- <Field.Label>{props.label}</Field.Label>
26
- </Field.Item>
27
- </Field.Root>
28
- )
29
- }
30
-
31
- export function Demo() {
32
- return (
33
- <RadioGroup.Root aria-label="Plan" defaultValue="pro">
34
- <Choice label="Free" value="free" />
35
- <Choice label="Pro" value="pro" />
36
- <Choice label="Team" value="team" />
37
- </RadioGroup.Root>
38
- )
39
- }
40
- ```
41
-
42
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/RadioGroup/Basic.tsx)
43
-
44
- ### Size
45
-
46
- Set `size` on `RadioGroup.Root` to `small`, `medium` (default), or `large`.
47
-
48
- ```tsx
49
- import { Field, RadioGroup, style } from '@tempoxyz/ds'
50
-
51
- function Choice(props: { label: string; value: string }) {
52
- return (
53
- <Field.Root>
54
- <Field.Item>
55
- <RadioGroup.Item value={props.value} />
56
- <Field.Label>{props.label}</Field.Label>
57
- </Field.Item>
58
- </Field.Root>
59
- )
60
- }
61
-
62
- export function Demo() {
63
- return (
64
- <div {...styles.row()}>
65
- {(['small', 'medium', 'large'] as const).map((size) => (
66
- <RadioGroup.Root aria-label={`Plan ${size}`} defaultValue="pro" key={size} size={size}>
67
- <Choice label={`Free (${size})`} value="free" />
68
- <Choice label={`Pro (${size})`} value="pro" />
69
- </RadioGroup.Root>
70
- ))}
71
- </div>
72
- )
73
- }
74
-
75
- namespace styles {
76
- export const row = style({ display: 'flex', flexWrap: 'wrap', gap: '48' })
77
- }
78
- ```
79
-
80
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/RadioGroup/Size.tsx)
81
-
82
- ### Disabled
83
-
84
- Set `disabled` on a `RadioGroup.Item` to disable one option, or on `RadioGroup.Root` to disable the group.
85
-
86
- ```tsx
87
- import { Field, RadioGroup, style } from '@tempoxyz/ds'
88
-
89
- function Choice(props: { disabled?: boolean; label: string; value: string }) {
90
- return (
91
- <Field.Root>
92
- <Field.Item>
93
- <RadioGroup.Item disabled={props.disabled} value={props.value} />
94
- <Field.Label>{props.label}</Field.Label>
95
- </Field.Item>
96
- </Field.Root>
97
- )
98
- }
99
-
100
- export function Demo() {
101
- return (
102
- <div {...styles.row()}>
103
- <RadioGroup.Root aria-label="Plan" defaultValue="pro">
104
- <Choice label="Free" value="free" />
105
- <Choice label="Pro" value="pro" />
106
- <Choice disabled label="Team" value="team" />
107
- </RadioGroup.Root>
108
- <RadioGroup.Root aria-label="Disabled plan" defaultValue="pro" disabled>
109
- <Choice label="Free" value="free" />
110
- <Choice label="Pro" value="pro" />
111
- </RadioGroup.Root>
112
- </div>
113
- )
114
- }
115
-
116
- namespace styles {
117
- export const row = style({ display: 'flex', flexWrap: 'wrap', gap: '48' })
118
- }
119
- ```
120
-
121
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/RadioGroup/Disabled.tsx)
122
-
123
- ## Anatomy
124
-
125
- Import the component and assemble its parts.
126
-
127
- ```tsx
128
- import { Field, RadioGroup } from '@tempoxyz/ds'
129
-
130
- <RadioGroup.Root>
131
- <Field.Root>
132
- <Field.Item>
133
- <RadioGroup.Item />
134
- <Field.Label />
135
- </Field.Item>
136
- </Field.Root>
137
- </RadioGroup.Root>
138
- ```
139
-
140
- ## Guidelines
141
-
142
- ### When to Use
143
-
144
- * Pick one of two to five options that people compare side by side.
145
- * Choose a setting with a few fixed values, such as a payout schedule or API key permissions.
146
-
147
- ### When Not to Use
148
-
149
- * Use [Checkbox](checkbox.md) or [CheckboxGroup](checkbox-group.md) for several picks, or for a single yes or no.
150
- * Use [Select](select.md) for more than five options, or when space is tight.
151
- * Use [ChoiceGroup](choice-group.md) to switch a view or mode, such as 24H and 7D.
152
- * Use [Choicebox](choicebox.md) when each option needs an icon or a description.
153
- * Use [Switch](switch.md) for a single setting that applies immediately.
154
-
155
- ### Ask One Question
156
-
157
- Name the group with its question: point `aria-labelledby` at visible text, set `aria-label`, or use a `Fieldset.Legend`.
158
-
159
- **Do:** Make every option answer the group's question.
160
-
161
- ```tsx
162
- /**
163
- * Do example for "Ask One Question" on the RadioGroup page.
164
- * Make every option answer the group's question.
165
- * @module
166
- */
167
- import { Field, Fieldset, RadioGroup } from '@tempoxyz/ds'
168
-
169
- const options = ['Read only', 'Read and write', 'Admin']
170
-
171
- /** Renders the static preview, which the guideline card shows inert. */
172
- export function Demo() {
173
- return (
174
- <Fieldset.Root>
175
- <Fieldset.Legend>Who can use this key?</Fieldset.Legend>
176
- <RadioGroup.Root defaultValue="Read only">
177
- {options.map((option) => (
178
- <Field.Root key={option}>
179
- <Field.Item>
180
- <RadioGroup.Item value={option} />
181
- <Field.Label>{option}</Field.Label>
182
- </Field.Item>
183
- </Field.Root>
184
- ))}
185
- </RadioGroup.Root>
186
- </Fieldset.Root>
187
- )
188
- }
189
- ```
190
-
191
- **Don't:** Mix in an option that answers a different question.
192
-
193
- ```tsx
194
- /**
195
- * Don't example for "Ask One Question" on the RadioGroup page.
196
- * Don't mix in an option that answers a different question.
197
- * @module
198
- */
199
- import { Field, Fieldset, RadioGroup } from '@tempoxyz/ds'
200
-
201
- const options = ['Read only', 'Expires in 30 days', 'Admin']
202
-
203
- /** Renders the static preview, which the guideline card shows inert. */
204
- export function Demo() {
205
- return (
206
- <Fieldset.Root>
207
- <Fieldset.Legend>Who can use this key?</Fieldset.Legend>
208
- <RadioGroup.Root defaultValue="Read only">
209
- {options.map((option) => (
210
- <Field.Root key={option}>
211
- <Field.Item>
212
- <RadioGroup.Item value={option} />
213
- <Field.Label>{option}</Field.Label>
214
- </Field.Item>
215
- </Field.Root>
216
- ))}
217
- </RadioGroup.Root>
218
- </Fieldset.Root>
219
- )
220
- }
221
- ```
222
-
223
- ### Preselect Only a Safe Default
224
-
225
- **Do:** Preselect the option with the least access, such as Read only.
226
-
227
- ```tsx
228
- /**
229
- * Do example for "Preselect Only a Safe Default" on the RadioGroup page.
230
- * Preselect the option with the least access, such as Read only.
231
- * @module
232
- */
233
- import { Field, RadioGroup } from '@tempoxyz/ds'
234
-
235
- /** Renders the static preview, which the guideline card shows inert. */
236
- export function Demo() {
237
- return (
238
- <RadioGroup.Root aria-label="Key permissions" defaultValue="read">
239
- <Field.Root>
240
- <Field.Item>
241
- <RadioGroup.Item value="read" />
242
- <Field.Label>Read only</Field.Label>
243
- </Field.Item>
244
- </Field.Root>
245
- <Field.Root>
246
- <Field.Item>
247
- <RadioGroup.Item value="write" />
248
- <Field.Label>Read and write</Field.Label>
249
- </Field.Item>
250
- </Field.Root>
251
- </RadioGroup.Root>
252
- )
253
- }
254
- ```
255
-
256
- **Don't:** Preselect an option that grants more access or moves funds.
257
-
258
- ```tsx
259
- /**
260
- * Don't example for "Preselect Only a Safe Default" on the RadioGroup page.
261
- * Don't preselect an option that grants more access or moves funds.
262
- * @module
263
- */
264
- import { Field, RadioGroup } from '@tempoxyz/ds'
265
-
266
- /** Renders the static preview, which the guideline card shows inert. */
267
- export function Demo() {
268
- return (
269
- <RadioGroup.Root aria-label="Key permissions" defaultValue="write">
270
- <Field.Root>
271
- <Field.Item>
272
- <RadioGroup.Item value="read" />
273
- <Field.Label>Read only</Field.Label>
274
- </Field.Item>
275
- </Field.Root>
276
- <Field.Root>
277
- <Field.Item>
278
- <RadioGroup.Item value="write" />
279
- <Field.Label>Read and write</Field.Label>
280
- </Field.Item>
281
- </Field.Root>
282
- </RadioGroup.Root>
283
- )
284
- }
285
- ```
286
-
287
- If no option is safe, leave the group empty, set `required`, and ask for a choice on submit. A group cannot return to empty after a pick. If no choice is a valid answer, add an option such as None.
288
-
289
- ### Order Options Logically
290
-
291
- With no natural order, list the most common option first. Keep the same order wherever the question appears.
292
-
293
- **Do:** List time periods in order, from Daily to Monthly.
294
-
295
- ```tsx
296
- /**
297
- * Do example for "Order Options Logically" on the RadioGroup page.
298
- * List time periods in order, from Daily to Monthly.
299
- * @module
300
- */
301
- import { Field, RadioGroup } from '@tempoxyz/ds'
302
-
303
- /** Renders the static preview, which the guideline card shows inert. */
304
- export function Demo() {
305
- return (
306
- <RadioGroup.Root aria-label="Payout schedule" defaultValue="weekly">
307
- {['Daily', 'Weekly', 'Monthly'].map((label) => (
308
- <Field.Root key={label}>
309
- <Field.Item>
310
- <RadioGroup.Item value={label.toLowerCase()} />
311
- <Field.Label>{label}</Field.Label>
312
- </Field.Item>
313
- </Field.Root>
314
- ))}
315
- </RadioGroup.Root>
316
- )
317
- }
318
- ```
319
-
320
- **Don't:** Mix the order of options that have a sequence.
321
-
322
- ```tsx
323
- /**
324
- * Don't example for "Order Options Logically" on the RadioGroup page.
325
- * Don't mix the order of options that have a sequence.
326
- * @module
327
- */
328
- import { Field, RadioGroup } from '@tempoxyz/ds'
329
-
330
- /** Renders the static preview, which the guideline card shows inert. */
331
- export function Demo() {
332
- return (
333
- <RadioGroup.Root aria-label="Payout schedule" defaultValue="weekly">
334
- {['Monthly', 'Daily', 'Weekly'].map((label) => (
335
- <Field.Root key={label}>
336
- <Field.Item>
337
- <RadioGroup.Item value={label.toLowerCase()} />
338
- <Field.Label>{label}</Field.Label>
339
- </Field.Item>
340
- </Field.Root>
341
- ))}
342
- </RadioGroup.Root>
343
- )
344
- }
345
- ```
346
-
347
- ### Keep Options in a Column
348
-
349
- **Do:** Keep the default column, so each radio lines up with its label.
350
-
351
- ```tsx
352
- /**
353
- * Do example for "Keep Options in a Column" on the RadioGroup page.
354
- * Keep the default column, so each radio lines up with its label.
355
- * @module
356
- */
357
- import { Field, RadioGroup } from '@tempoxyz/ds'
358
-
359
- const options = ['Read only', 'Read and write', 'Admin']
360
-
361
- /** Renders the static preview, which the guideline card shows inert. */
362
- export function Demo() {
363
- return (
364
- <RadioGroup.Root aria-label="Key permissions" defaultValue="Read only">
365
- {options.map((option) => (
366
- <Field.Root key={option}>
367
- <Field.Item>
368
- <RadioGroup.Item value={option} />
369
- <Field.Label>{option}</Field.Label>
370
- </Field.Item>
371
- </Field.Root>
372
- ))}
373
- </RadioGroup.Root>
374
- )
375
- }
376
- ```
377
-
378
- **Don't:** Lay radios out in a wrapping row.
379
-
380
- ```tsx
381
- /**
382
- * Don't example for "Keep Options in a Column" on the RadioGroup page.
383
- * Don't lay radios out in a wrapping row.
384
- * @module
385
- */
386
- import { Field, RadioGroup, style } from '@tempoxyz/ds'
387
-
388
- const options = ['Read only', 'Read and write', 'Admin']
389
-
390
- /** Renders the static preview, which the guideline card shows inert. */
391
- export function Demo() {
392
- return (
393
- <RadioGroup.Root aria-label="Key permissions" defaultValue="Read only" {...styles.row()}>
394
- {options.map((option) => (
395
- <Field.Root key={option}>
396
- <Field.Item>
397
- <RadioGroup.Item value={option} />
398
- <Field.Label>{option}</Field.Label>
399
- </Field.Item>
400
- </Field.Root>
401
- ))}
402
- </RadioGroup.Root>
403
- )
404
- }
405
-
406
- namespace styles {
407
- export const row = style({ columnGap: '12', flexDirection: 'row', flexWrap: 'wrap', rowGap: '8' })
408
- }
409
- ```
410
-
411
- ### Label Every Option
412
-
413
- Set `disabled` on an item only with a nearby reason, such as Requires a verified domain.
414
-
415
- **Do:** Wrap each radio in a `Field.Item` with a `Field.Label`, and add a `Field.Description` after it.
416
-
417
- ```tsx
418
- /**
419
- * Do example for "Label Every Option" on the RadioGroup page.
420
- * Wrap each radio in a `Field.Item` with a `Field.Label`, and add a `Field.Description` after it.
421
- * @module
422
- */
423
- import { Field, RadioGroup } from '@tempoxyz/ds'
424
-
425
- /** Renders the static preview, which the guideline card shows inert. */
426
- export function Demo() {
427
- return (
428
- <RadioGroup.Root aria-label="Payout schedule" defaultValue="weekly">
429
- <Field.Root>
430
- <Field.Item>
431
- <RadioGroup.Item value="weekly" />
432
- <Field.Label>Weekly</Field.Label>
433
- </Field.Item>
434
- <Field.Description>Every Monday in USDC.</Field.Description>
435
- </Field.Root>
436
- <Field.Root>
437
- <Field.Item>
438
- <RadioGroup.Item value="monthly" />
439
- <Field.Label>Monthly</Field.Label>
440
- </Field.Item>
441
- <Field.Description>On the first day of each month.</Field.Description>
442
- </Field.Root>
443
- </RadioGroup.Root>
444
- )
445
- }
446
- ```
447
-
448
- **Don't:** Place plain text beside a radio. A press on it selects nothing.
449
-
450
- ```tsx
451
- /**
452
- * Don't example for "Label Every Option" on the RadioGroup page.
453
- * Don't place plain text beside a radio. A press on it selects nothing.
454
- * @module
455
- */
456
- import { RadioGroup, style } from '@tempoxyz/ds'
457
-
458
- /** Renders the static preview, which the guideline card shows inert. */
459
- export function Demo() {
460
- return (
461
- <RadioGroup.Root aria-label="Payout schedule" defaultValue="weekly">
462
- <div {...styles.option()}>
463
- <RadioGroup.Item value="weekly" />
464
- <span>Weekly: every Monday in USDC.</span>
465
- </div>
466
- <div {...styles.option()}>
467
- <RadioGroup.Item value="monthly" />
468
- <span>Monthly: on the first day of each month.</span>
469
- </div>
470
- </RadioGroup.Root>
471
- )
472
- }
473
-
474
- namespace styles {
475
- export const option = style({ alignItems: 'center', display: 'flex', gap: '8' })
476
- }
477
- ```
478
-
479
- ## Content
480
-
481
- * **Option labels:** Keep them short and parallel, such as Read only and Read and write. Don't repeat words from the question in every option.
482
-
483
- ## Accessibility
484
-
485
- RadioGroup follows the [WAI-ARIA Authoring Practices radio group pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
486
-
487
- ### Semantics
488
-
489
- * **RadioGroup.Root (radiogroup):** Groups the radios. Screen readers announce them as one set.
490
- * **RadioGroup.Item (radio):** Announced with its checked state. A hidden native input submits the value under the group's `name`.
491
- * **Disabled Items (aria-disabled):** A disabled item, or every item in a disabled group, stays visible but dimmed.
492
- * **Checked State (dot):** The checked radio fills in and shows a mark, so selection does not rely on color alone.
493
- * **Target Size (16, 20, 24px):** The hit area reaches 10px past each radio, and a label in `Field.Item` adds to it.
494
-
495
- ### Keyboard
496
-
497
- * **Enter the Group (Tab):** Moves focus into the group, onto the checked radio. The group is one Tab stop.
498
- * **Leave the Group (Shift+Tab):** Moves focus out of the group.
499
- * **Select the Next Radio (Down or Right Arrow):** Moves focus to the next radio and selects it, wrapping from last to first.
500
- * **Select the Previous Radio (Up or Left Arrow):** Moves focus to the previous radio and selects it, wrapping from first to last.
501
-
502
- Arrow keys skip disabled radios.
503
-
504
- ### Your Responsibilities
505
-
506
- * **Keep Changes Cheap (onValueChange):** Arrow keys select as they move. Avoid costly work on each change.
507
-
508
- ## Related
509
-
510
- [ChoiceGroup](choice-group.md)
511
-
512
- Use for switching views and modes.
513
-
514
- [Choicebox](choicebox.md)
515
-
516
- Use for options with icons or descriptions.
517
-
518
- [Select](select.md)
519
-
520
- Use for longer lists.
521
-
522
- [Checkbox](checkbox.md)
523
-
524
- Use for independent choices.
525
-
526
- [Fieldset](fieldset.md)
527
-
528
- Use for naming a group with a legend.