@tempoxyz/ds 0.3.14 → 0.3.16

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 (209) hide show
  1. package/dist/docs/AGENTS.md +75 -10
  2. package/dist/docs/arsenal.md +44 -0
  3. package/dist/docs/{marketing/introduction/getting-started.md → marketing.md} +32 -24
  4. package/dist/docs/product/components/actions.md +2110 -0
  5. package/dist/docs/product/components/blockchain.md +3969 -0
  6. package/dist/docs/product/components/data-display.md +5901 -0
  7. package/dist/docs/product/components/feedback-and-status.md +4138 -0
  8. package/dist/docs/product/components/forms-and-inputs.md +10543 -0
  9. package/dist/docs/product/components/layout.md +3339 -0
  10. package/dist/docs/product/components/navigation.md +2914 -0
  11. package/dist/docs/product/components/overlays.md +4917 -0
  12. package/dist/docs/product/components.md +125 -125
  13. package/dist/docs/product/foundations.md +4597 -0
  14. package/dist/docs/product/patterns.md +10110 -0
  15. package/dist/marketing/index.js.zyzz.json +1 -1
  16. package/dist/marketing/vars.d.ts +618 -758
  17. package/dist/marketing/vars.d.ts.map +1 -1
  18. package/dist/marketing/vars.js +8 -5
  19. package/dist/marketing/vars.js.map +1 -1
  20. package/dist/marketing/vars.js.zyzz.json +1 -1
  21. package/dist/marketing/zyzz.config.d.ts +3042 -3757
  22. package/dist/marketing/zyzz.config.d.ts.map +1 -1
  23. package/dist/marketing/zyzz.config.js +1 -1
  24. package/dist/marketing/zyzz.config.js.map +1 -1
  25. package/dist/marketing/zyzz.config.js.zyzz.json +1 -1
  26. package/dist/mobile/components/Button.d.ts +115 -15
  27. package/dist/mobile/components/Button.d.ts.map +1 -1
  28. package/dist/mobile/components/Button.js +85 -14
  29. package/dist/mobile/components/Button.js.map +1 -1
  30. package/dist/mobile/components/IconButton.d.ts +129 -40
  31. package/dist/mobile/components/IconButton.d.ts.map +1 -1
  32. package/dist/mobile/components/IconButton.js +97 -28
  33. package/dist/mobile/components/IconButton.js.map +1 -1
  34. package/dist/mobile/components/TextInput.d.ts +132 -11
  35. package/dist/mobile/components/TextInput.d.ts.map +1 -1
  36. package/dist/mobile/components/TextInput.js +115 -14
  37. package/dist/mobile/components/TextInput.js.map +1 -1
  38. package/dist/mobile/index.d.ts +1 -0
  39. package/dist/mobile/index.d.ts.map +1 -1
  40. package/dist/mobile/index.js +1 -0
  41. package/dist/mobile/index.js.map +1 -1
  42. package/dist/mobile/vars.d.ts +103 -0
  43. package/dist/mobile/vars.d.ts.map +1 -1
  44. package/dist/mobile/vars.js +74 -0
  45. package/dist/mobile/vars.js.map +1 -1
  46. package/dist/mobile/zyzz.config.d.ts +408 -0
  47. package/dist/mobile/zyzz.config.d.ts.map +1 -1
  48. package/dist/web/components/AddressCard.js.zyzz.json +1 -1
  49. package/dist/web/components/Amount.css +1 -1
  50. package/dist/web/components/Amount.d.ts +9 -0
  51. package/dist/web/components/Amount.d.ts.map +1 -1
  52. package/dist/web/components/Amount.js +8 -5
  53. package/dist/web/components/Amount.js.map +1 -1
  54. package/dist/web/components/Amount.js.zyzz.json +1 -1
  55. package/dist/web/components/CopyButton.d.ts +6 -0
  56. package/dist/web/components/CopyButton.d.ts.map +1 -1
  57. package/dist/web/components/CopyButton.js +4 -1
  58. package/dist/web/components/CopyButton.js.map +1 -1
  59. package/dist/web/components/CopyButton.js.zyzz.json +1 -1
  60. package/dist/web/components/Hex.css +1 -1
  61. package/dist/web/components/Hex.d.ts +84 -3
  62. package/dist/web/components/Hex.d.ts.map +1 -1
  63. package/dist/web/components/Hex.js +20 -13
  64. package/dist/web/components/Hex.js.map +1 -1
  65. package/dist/web/components/Hex.js.zyzz.json +1 -1
  66. package/dist/web/components/Progress.css +1 -1
  67. package/dist/web/components/Progress.d.ts +12 -2
  68. package/dist/web/components/Progress.d.ts.map +1 -1
  69. package/dist/web/components/Progress.js +9 -5
  70. package/dist/web/components/Progress.js.map +1 -1
  71. package/dist/web/components/Progress.js.zyzz.json +1 -1
  72. package/dist/web/components/SecretValue.js.zyzz.json +1 -1
  73. package/dist/web/components/SidebarMenu.d.ts +4 -4
  74. package/dist/web/components/SidebarMenu.js +6 -6
  75. package/dist/web/components/SidebarMenu.js.map +1 -1
  76. package/dist/web/components/Snippet.js.zyzz.json +1 -1
  77. package/dist/web/index.js.zyzz.json +1 -1
  78. package/package.json +1 -1
  79. package/src/marketing/README.md +1 -1
  80. package/src/marketing/vars.ts +526 -604
  81. package/src/marketing/zyzz.config.ts +5 -4
  82. package/src/mobile/README.md +19 -6
  83. package/src/mobile/components/Button.tsx +94 -17
  84. package/src/mobile/components/IconButton.tsx +122 -30
  85. package/src/mobile/components/TextInput.tsx +139 -24
  86. package/src/mobile/index.ts +1 -0
  87. package/src/mobile/vars.ts +74 -0
  88. package/src/web/components/Amount.tsx +37 -3
  89. package/src/web/components/CopyButton.tsx +8 -0
  90. package/src/web/components/Hex.tsx +79 -13
  91. package/src/web/components/Progress.tsx +8 -2
  92. package/src/web/components/SidebarMenu.tsx +6 -6
  93. package/dist/docs/index.md +0 -145
  94. package/dist/docs/product/components/accordion.md +0 -489
  95. package/dist/docs/product/components/address-card.md +0 -147
  96. package/dist/docs/product/components/agent-logo.md +0 -194
  97. package/dist/docs/product/components/alert-dialog.md +0 -631
  98. package/dist/docs/product/components/alert.md +0 -448
  99. package/dist/docs/product/components/amount-input.md +0 -305
  100. package/dist/docs/product/components/amount.md +0 -794
  101. package/dist/docs/product/components/app-shell.md +0 -559
  102. package/dist/docs/product/components/asset-chip.md +0 -294
  103. package/dist/docs/product/components/autocomplete.md +0 -620
  104. package/dist/docs/product/components/avatar.md +0 -321
  105. package/dist/docs/product/components/badge.md +0 -339
  106. package/dist/docs/product/components/badged-logo.md +0 -116
  107. package/dist/docs/product/components/banner.md +0 -379
  108. package/dist/docs/product/components/bar-chart.md +0 -208
  109. package/dist/docs/product/components/breadcrumbs.md +0 -380
  110. package/dist/docs/product/components/button-group.md +0 -286
  111. package/dist/docs/product/components/button.md +0 -650
  112. package/dist/docs/product/components/calendar.md +0 -375
  113. package/dist/docs/product/components/callout.md +0 -96
  114. package/dist/docs/product/components/checkbox-group.md +0 -521
  115. package/dist/docs/product/components/checkbox.md +0 -467
  116. package/dist/docs/product/components/choice-group.md +0 -516
  117. package/dist/docs/product/components/choicebox.md +0 -641
  118. package/dist/docs/product/components/code.md +0 -100
  119. package/dist/docs/product/components/combobox.md +0 -939
  120. package/dist/docs/product/components/container.md +0 -257
  121. package/dist/docs/product/components/copy-button.md +0 -642
  122. package/dist/docs/product/components/date-picker.md +0 -514
  123. package/dist/docs/product/components/dialog.md +0 -1332
  124. package/dist/docs/product/components/drawer.md +0 -966
  125. package/dist/docs/product/components/empty.md +0 -340
  126. package/dist/docs/product/components/field.md +0 -570
  127. package/dist/docs/product/components/fieldset.md +0 -398
  128. package/dist/docs/product/components/frame.md +0 -434
  129. package/dist/docs/product/components/gauge.md +0 -299
  130. package/dist/docs/product/components/get-started-visual.md +0 -117
  131. package/dist/docs/product/components/grid.md +0 -288
  132. package/dist/docs/product/components/hero-visual.md +0 -155
  133. package/dist/docs/product/components/hex.md +0 -487
  134. package/dist/docs/product/components/icon-tile.md +0 -292
  135. package/dist/docs/product/components/identicon.md +0 -371
  136. package/dist/docs/product/components/inline.md +0 -233
  137. package/dist/docs/product/components/inset.md +0 -225
  138. package/dist/docs/product/components/kbd.md +0 -423
  139. package/dist/docs/product/components/list-group.md +0 -981
  140. package/dist/docs/product/components/loading-dots.md +0 -237
  141. package/dist/docs/product/components/menu.md +0 -934
  142. package/dist/docs/product/components/native-select.md +0 -204
  143. package/dist/docs/product/components/network-logo.md +0 -248
  144. package/dist/docs/product/components/number-field.md +0 -543
  145. package/dist/docs/product/components/otp-field.md +0 -616
  146. package/dist/docs/product/components/pagination.md +0 -516
  147. package/dist/docs/product/components/popover.md +0 -544
  148. package/dist/docs/product/components/progress.md +0 -388
  149. package/dist/docs/product/components/qr.md +0 -314
  150. package/dist/docs/product/components/radio-group.md +0 -528
  151. package/dist/docs/product/components/secret-value.md +0 -406
  152. package/dist/docs/product/components/select.md +0 -751
  153. package/dist/docs/product/components/separator.md +0 -379
  154. package/dist/docs/product/components/sidebar-menu.md +0 -922
  155. package/dist/docs/product/components/skeleton.md +0 -517
  156. package/dist/docs/product/components/slider.md +0 -539
  157. package/dist/docs/product/components/snippet.md +0 -424
  158. package/dist/docs/product/components/spinner.md +0 -216
  159. package/dist/docs/product/components/split-bar.md +0 -139
  160. package/dist/docs/product/components/split-button.md +0 -464
  161. package/dist/docs/product/components/stack.md +0 -299
  162. package/dist/docs/product/components/status-chip.md +0 -226
  163. package/dist/docs/product/components/status-indicator.md +0 -119
  164. package/dist/docs/product/components/status-row.md +0 -174
  165. package/dist/docs/product/components/stepper.md +0 -451
  166. package/dist/docs/product/components/success-hero.md +0 -157
  167. package/dist/docs/product/components/surface.md +0 -639
  168. package/dist/docs/product/components/switch.md +0 -472
  169. package/dist/docs/product/components/table.md +0 -968
  170. package/dist/docs/product/components/tabs.md +0 -627
  171. package/dist/docs/product/components/tempo-logo.md +0 -185
  172. package/dist/docs/product/components/text-input.md +0 -624
  173. package/dist/docs/product/components/textarea.md +0 -352
  174. package/dist/docs/product/components/toast.md +0 -535
  175. package/dist/docs/product/components/token-logo.md +0 -371
  176. package/dist/docs/product/components/token.md +0 -247
  177. package/dist/docs/product/components/tooltip.md +0 -490
  178. package/dist/docs/product/components/verification-code.md +0 -116
  179. package/dist/docs/product/components/visual.md +0 -249
  180. package/dist/docs/product/foundations/accessibility.md +0 -377
  181. package/dist/docs/product/foundations/agents.md +0 -159
  182. package/dist/docs/product/foundations/color.md +0 -522
  183. package/dist/docs/product/foundations/content/tone.md +0 -194
  184. package/dist/docs/product/foundations/content/voice.md +0 -194
  185. package/dist/docs/product/foundations/content/writing-style.md +0 -406
  186. package/dist/docs/product/foundations/iconography.md +0 -282
  187. package/dist/docs/product/foundations/intent.md +0 -360
  188. package/dist/docs/product/foundations/layout.md +0 -508
  189. package/dist/docs/product/foundations/linter.md +0 -523
  190. package/dist/docs/product/foundations/motion.md +0 -151
  191. package/dist/docs/product/foundations/radius-and-padding.md +0 -86
  192. package/dist/docs/product/foundations/typography.md +0 -331
  193. package/dist/docs/product/introduction/faq.md +0 -133
  194. package/dist/docs/product/introduction/getting-started.md +0 -377
  195. package/dist/docs/product/patterns/blockchain-values.md +0 -709
  196. package/dist/docs/product/patterns/dashboards.md +0 -638
  197. package/dist/docs/product/patterns/destructive-actions.md +0 -626
  198. package/dist/docs/product/patterns/empty-states.md +0 -612
  199. package/dist/docs/product/patterns/errors-and-validation.md +0 -808
  200. package/dist/docs/product/patterns/feedback-and-status.md +0 -518
  201. package/dist/docs/product/patterns/forms.md +0 -679
  202. package/dist/docs/product/patterns/loading.md +0 -630
  203. package/dist/docs/product/patterns/navigation.md +0 -397
  204. package/dist/docs/product/patterns/payments.md +0 -765
  205. package/dist/docs/product/patterns/responsive-layout.md +0 -997
  206. package/dist/docs/product/patterns/tables-and-lists.md +0 -1170
  207. package/dist/docs/product/products/tempo-console.md +0 -671
  208. package/dist/docs/product/products/tempo-performance.md +0 -435
  209. 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.