@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,679 +0,0 @@
1
- # Forms
2
-
3
- Order fields, labels, and actions so a person completes a form in one pass.
4
-
5
- ## Overview
6
-
7
- Ask only for the values the task needs. Remove every field you can derive, default, or ask for later.
8
-
9
- This page covers layout, labels, save models, and actions. [Errors and Validation](errors-and-validation.md) covers checking values and reporting problems.
10
-
11
- ## Choosing a Control
12
-
13
- Choose the control from the shape of the value, not from its look.
14
-
15
- * **Free Text (TextInput):** For a name or address. Use a [Textarea](../components/textarea.md) for a longer memo.
16
- * **An Amount of Money (AmountInput):** [AmountInput](../components/amount-input.md) sets a decimal keyboard and rejects anything that is not a number.
17
- * **Five or Fewer Options (RadioGroup):** A [RadioGroup](../components/radio-group.md) keeps every choice visible.
18
- * **Many Options (Select):** A [Select](../components/select.md). If people need to search, use a [Combobox](../components/combobox.md).
19
-
20
- **Do:** Show a short set of exclusive options in a [RadioGroup](../components/radio-group.md).
21
-
22
- ```tsx
23
- <Fieldset.Root>
24
- <Fieldset.Legend>Network fee</Fieldset.Legend>
25
- <RadioGroup.Root aria-label="Network fee" defaultValue="standard">
26
- <Field.Root>
27
- <Field.Item>
28
- <RadioGroup.Item value="standard" />
29
- <Field.Label>Standard</Field.Label>
30
- </Field.Item>
31
- </Field.Root>
32
- <Field.Root>
33
- <Field.Item>
34
- <RadioGroup.Item value="fast" />
35
- <Field.Label>Fast</Field.Label>
36
- </Field.Item>
37
- </Field.Root>
38
- </RadioGroup.Root>
39
- </Fieldset.Root>
40
- ```
41
-
42
- **Don't:** Use a [Checkbox](../components/checkbox.md) for options that exclude each other.
43
-
44
- ```tsx
45
- <Fieldset.Root>
46
- <Fieldset.Legend>Network fee</Fieldset.Legend>
47
- <Field.Root>
48
- <Field.Item>
49
- <Checkbox defaultChecked />
50
- <Field.Label>Standard</Field.Label>
51
- </Field.Item>
52
- </Field.Root>
53
- <Field.Root>
54
- <Field.Item>
55
- <Checkbox />
56
- <Field.Label>Fast</Field.Label>
57
- </Field.Item>
58
- </Field.Root>
59
- </Fieldset.Root>
60
- ```
61
-
62
- ### Help Browsers Fill Values
63
-
64
- Set `type`, `inputMode`, and `autoComplete` on each `TextInput.Control`, so browsers suggest saved values and phones show the matching keyboard.
65
-
66
- * **Personal Data (autoComplete):** Name each value, such as `autoComplete="email"`, as WCAG 2.2 requires for personal data.
67
- * **Machine Values (spellCheck):** Turn off spell check and set `autoComplete="off"` for addresses, API keys, and other machine values.
68
-
69
- ## Structure
70
-
71
- 1. **Title:** Names the task, such as New webhook, and states the result of submit.
72
- 2. **Fields:** One column, in answer order, with related fields grouped.
73
- 3. **Each field:** Label, control, then a description or an error.
74
- 4. **Actions:** After the last field, in the [action order](#order-actions).
75
-
76
- ```tsx
77
- import { Button, Checkbox, Field, Fieldset, Frame, Stack, style, Surface, Textarea, TextInput, Toast } from '@tempoxyz/ds'
78
- import { useState } from 'react'
79
-
80
- export const fill = true
81
- const events = [
82
- ['payment.received', 'Payment received'],
83
- ['payment.sent', 'Payment sent'],
84
- ['transfer.failed', 'Transfer failed'],
85
- ] as const
86
-
87
- function valid(url: string) {
88
- return /^https:\/\/[^\s/]+\.[^\s]+$/.test(url)
89
- }
90
-
91
- function WebhookForm() {
92
- const toast = Toast.useToast()
93
- const [invalid, setInvalid] = useState(false)
94
- const [pending, setPending] = useState(false)
95
- const [submitted, setSubmitted] = useState(false)
96
- const [url, setUrl] = useState('')
97
-
98
- return (
99
- <Surface
100
- {...styles.form()}
101
- render={
102
- <form
103
- noValidate
104
- onSubmit={(event) => {
105
- event.preventDefault()
106
- setSubmitted(true)
107
-
108
- if (!valid(url)) {
109
- setInvalid(true)
110
- event.currentTarget.querySelector<HTMLInputElement>('input[name="url"]')?.focus()
111
- return
112
- }
113
-
114
- setPending(true)
115
- setTimeout(() => {
116
- setPending(false)
117
- toast.add({ description: url, intent: 'positive', title: 'Webhook created' })
118
- }, 1200)
119
- }}
120
- />
121
- }
122
- >
123
- <Frame.Root>
124
- <Frame.Header>
125
- <Frame.Title>New webhook</Frame.Title>
126
- <Frame.Description>
127
- Tempo sends a POST request to your endpoint for each event you choose.
128
- </Frame.Description>
129
- </Frame.Header>
130
- <Fieldset.Root disabled={pending}>
131
- <Fieldset.Legend>Endpoint</Fieldset.Legend>
132
- <Field.Root invalid={invalid}>
133
- <Field.Label>Endpoint URL</Field.Label>
134
- <TextInput.Group>
135
- <TextInput.Control
136
- autoComplete="off"
137
- name="url"
138
- onValueChange={(value) => {
139
- setUrl(value)
140
- // After the first submit, the error clears as soon as the value is fixed.
141
- if (submitted) setInvalid(!valid(value))
142
- }}
143
- placeholder="https://api.example.com/tempo"
144
- required
145
- spellCheck={false}
146
- type="url"
147
- value={url}
148
- />
149
- </TextInput.Group>
150
- <Field.Description>Use an HTTPS URL on a server you control.</Field.Description>
151
- <Field.Error match={invalid}>Enter a URL that starts with https://.</Field.Error>
152
- </Field.Root>
153
- <Field.Root>
154
- <Field.Label>Description (optional)</Field.Label>
155
- <Textarea name="description" placeholder="Order fulfillment" rows={2} />
156
- </Field.Root>
157
- </Fieldset.Root>
158
- <Fieldset.Root disabled={pending}>
159
- <Fieldset.Legend>Events</Fieldset.Legend>
160
- <Stack gap="12">
161
- {events.map(([value, label]) => (
162
- <Field.Root key={value}>
163
- <Field.Item>
164
- <Checkbox defaultChecked={value === 'payment.received'} name={value} />
165
- <Field.Label>{label}</Field.Label>
166
- </Field.Item>
167
- </Field.Root>
168
- ))}
169
- </Stack>
170
- </Fieldset.Root>
171
- <Frame.Footer>
172
- <Frame.Actions {...styles.actions()}>
173
- <Button type="button" variant="secondary">
174
- Cancel
175
- </Button>
176
- <Button loading={pending} type="submit">
177
- Create webhook
178
- </Button>
179
- </Frame.Actions>
180
- </Frame.Footer>
181
- </Frame.Root>
182
- </Surface>
183
- )
184
- }
185
-
186
- export function Demo() {
187
- return (
188
- <div {...styles.page()}>
189
- <Toast.Provider>
190
- <WebhookForm />
191
- <Toast.Viewport />
192
- </Toast.Provider>
193
- </div>
194
- )
195
- }
196
-
197
- namespace styles {
198
- // Below 640px the actions stack at full width with the primary action on top. From 640px they sit
199
- // at the end at their content width.
200
- export const actions = style({
201
- flexDirection: 'column-reverse',
202
- rowGap: '8',
203
- selectors: { '& > *': { flexBasis: 'auto !custom', width: '100% !custom' } },
204
- '@media (min-width: 40rem)': {
205
- flexDirection: 'row',
206
- justifyContent: 'flex-end',
207
- selectors: { '& > *': { flexGrow: '0 !custom', width: 'auto !custom' } },
208
- },
209
- })
210
-
211
- export const form = style({
212
- boxSizing: 'border-box',
213
- maxWidth: '30rem !custom',
214
- width: '100% !custom',
215
- })
216
-
217
- export const page = style({
218
- backgroundColor: 'background.primary',
219
- display: 'grid',
220
- justifyItems: 'center',
221
- padding: '16',
222
- })
223
- }
224
- ```
225
-
226
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/WebhookForm.tsx)
227
-
228
- This reference layout uses [Surface](../components/surface.md), [Frame](../components/frame.md), [Fieldset](../components/fieldset.md), and [Field](../components/field.md). Submit an empty URL to show the error, then fix the URL to clear it.
229
-
230
- ### Use One Column
231
-
232
- Stack fields in a single column, in the order a person expects, such as recipient, then amount, then memo. Put two fields on one row only if they form one short value, such as a month and a year. If people enter several records with the same fields, such as batch payout recipients, use an [editable table](tables-and-lists.md#edit-rows-in-place).
233
-
234
- **Do:** Stack fields in one column, in the order you answer them.
235
-
236
- ```tsx
237
- /**
238
- * Do example for "Use One Column" on the Forms page.
239
- * Stack fields in one column, in the order you answer them.
240
- * @module
241
- */
242
- import { Field, Stack, style, TextInput } from '@tempoxyz/ds'
243
-
244
- /** Renders the static preview, which the guideline card shows inert. */
245
- export function Demo() {
246
- return (
247
- <Stack gap="24" {...styles.fill()}>
248
- <Field.Root>
249
- <Field.Label>Recipient</Field.Label>
250
- <TextInput.Group>
251
- <TextInput.Control placeholder="0x…" />
252
- </TextInput.Group>
253
- </Field.Root>
254
- <Field.Root>
255
- <Field.Label>Amount</Field.Label>
256
- <TextInput.Group>
257
- <TextInput.Control inputMode="decimal" placeholder="0.00" />
258
- <TextInput.Suffix>USDC</TextInput.Suffix>
259
- </TextInput.Group>
260
- </Field.Root>
261
- </Stack>
262
- )
263
- }
264
-
265
- namespace styles {
266
- export const fill = style({ width: '100% !custom' })
267
- }
268
- ```
269
-
270
- **Don't:** Arrange unrelated fields in a grid, where the reading order is unclear.
271
-
272
- ```tsx
273
- /**
274
- * Don't example for "Use One Column" on the Forms page.
275
- * Don't arrange unrelated fields in a grid, where the reading order is unclear.
276
- * @module
277
- */
278
- import { Field, style, TextInput } from '@tempoxyz/ds'
279
-
280
- /** Renders the static preview, which the guideline card shows inert. */
281
- export function Demo() {
282
- return (
283
- <div {...styles.grid()}>
284
- <Field.Root>
285
- <Field.Label>Recipient</Field.Label>
286
- <TextInput.Group>
287
- <TextInput.Control placeholder="0x…" />
288
- </TextInput.Group>
289
- </Field.Root>
290
- <Field.Root>
291
- <Field.Label>Amount</Field.Label>
292
- <TextInput.Group>
293
- <TextInput.Control inputMode="decimal" placeholder="0.00" />
294
- </TextInput.Group>
295
- </Field.Root>
296
- <Field.Root>
297
- <Field.Label>Memo</Field.Label>
298
- <TextInput.Group>
299
- <TextInput.Control placeholder="Invoice 1042" />
300
- </TextInput.Group>
301
- </Field.Root>
302
- <Field.Root>
303
- <Field.Label>Fee token</Field.Label>
304
- <TextInput.Group>
305
- <TextInput.Control placeholder="PathUSD" />
306
- </TextInput.Group>
307
- </Field.Root>
308
- </div>
309
- )
310
- }
311
-
312
- namespace styles {
313
- export const grid = style({
314
- display: 'grid',
315
- gap: '16',
316
- gridTemplateColumns: 'repeat(2, minmax(0, 1fr)) !custom',
317
- width: '100% !custom',
318
- })
319
- }
320
- ```
321
-
322
- ### Group Related Fields
323
-
324
- Wrap the parts of one idea, such as an address, in a [Fieldset](../components/fieldset.md) with a `Fieldset.Legend`. Set `variant` once on the fieldset, which passes it to every nested `Field.Root`. If a form outgrows two or three groups, split it into steps with a [Stepper](../components/stepper.md).
325
-
326
- **Do:** Group related fields under one legend and one variant.
327
-
328
- ```tsx
329
- <Fieldset.Root>
330
- <Fieldset.Legend>Recipient</Fieldset.Legend>
331
- <Field.Root>
332
- <Field.Label>Name</Field.Label>
333
- <TextInput.Group>
334
- <TextInput.Control />
335
- </TextInput.Group>
336
- </Field.Root>
337
- <Field.Root>
338
- <Field.Label>Email</Field.Label>
339
- <TextInput.Group>
340
- <TextInput.Control type="email" />
341
- </TextInput.Group>
342
- </Field.Root>
343
- </Fieldset.Root>
344
- ```
345
-
346
- **Don't:** Mix field variants within one group.
347
-
348
- ```tsx
349
- <Fieldset.Root>
350
- <Fieldset.Legend>Recipient</Fieldset.Legend>
351
- <Field.Root>
352
- <Field.Label>Name</Field.Label>
353
- <TextInput.Group>
354
- <TextInput.Control />
355
- </TextInput.Group>
356
- </Field.Root>
357
- <Field.Root>
358
- <Field.Label>Email</Field.Label>
359
- <TextInput.Group>
360
- <TextInput.Control type="email" />
361
- </TextInput.Group>
362
- </Field.Root>
363
- </Fieldset.Root>
364
- ```
365
-
366
- ## Labels and Help Text
367
-
368
- Every control needs a visible `Field.Label`, written as a short noun. Put format hints in `Field.Description`. A placeholder holds only an example value, such as `0x…` or `https://`.
369
-
370
- ### Put Labels Above Fields
371
-
372
- [Field](../components/field.md) puts the label 12px above every control. The label stays visible during input, and long labels wrap without narrowing the control.
373
-
374
- * **Text Field (TextInput):** The label sits above the field, and the message below it.
375
- * **Switch (Switch):** The label sits above the switch, as it does above a text field.
376
-
377
- **Do:** Give every control a visible `Field.Label`, with format hints in `Field.Description`.
378
-
379
- ```tsx
380
- /**
381
- * Do example for "Put Labels Above Fields" on the Forms page.
382
- * Give every control a visible `Field.Label`, with format hints in `Field.Description`.
383
- * @module
384
- */
385
- import { Field, style, TextInput } from '@tempoxyz/ds'
386
-
387
- /** Renders the static preview, which the guideline card shows inert. */
388
- export function Demo() {
389
- return (
390
- <Field.Root {...styles.fill()}>
391
- <Field.Label>Recipient address</Field.Label>
392
- <TextInput.Group>
393
- <TextInput.Control placeholder="0x…" />
394
- </TextInput.Group>
395
- <Field.Description>A Tempo address that starts with 0x.</Field.Description>
396
- </Field.Root>
397
- )
398
- }
399
-
400
- namespace styles {
401
- export const fill = style({ width: '100% !custom' })
402
- }
403
- ```
404
-
405
- **Don't:** Use a placeholder as the label. It disappears on input.
406
-
407
- ```tsx
408
- /**
409
- * Don't example for "Put Labels Above Fields" on the Forms page.
410
- * Don't use a placeholder as the label. It disappears on input.
411
- * @module
412
- */
413
- import { style, TextInput } from '@tempoxyz/ds'
414
-
415
- /** Renders the static preview, which the guideline card shows inert. */
416
- export function Demo() {
417
- return (
418
- <TextInput.Group {...styles.fill()}>
419
- <TextInput.Control aria-label="Recipient address" placeholder="Recipient address" />
420
- </TextInput.Group>
421
- )
422
- }
423
-
424
- namespace styles {
425
- export const fill = style({ width: '100% !custom' })
426
- }
427
- ```
428
-
429
- ### Mark Optional Fields
430
-
431
- Most fields are required, so mark the exceptions. Set `required` on required controls, so assistive technology announces them. Set `noValidate` on the `<form>`, so browser validation popups do not replace `Field.Error`. If every field is optional, such as on a filter form, state this once in the description.
432
-
433
- **Do:** Write (optional) in the label of each optional field.
434
-
435
- ```tsx
436
- /**
437
- * Do example for "Mark Optional Fields" on the Forms page.
438
- * Write (optional) in the label of each optional field.
439
- * @module
440
- */
441
- import { Field, Stack, style, TextInput } from '@tempoxyz/ds'
442
-
443
- /** Renders the static preview, which the guideline card shows inert. */
444
- export function Demo() {
445
- return (
446
- <Stack gap="24" {...styles.fill()}>
447
- <Field.Root>
448
- <Field.Label>Key name</Field.Label>
449
- <TextInput.Group>
450
- <TextInput.Control defaultValue="Production" required />
451
- </TextInput.Group>
452
- </Field.Root>
453
- <Field.Root>
454
- <Field.Label>Expires (optional)</Field.Label>
455
- <TextInput.Group>
456
- <TextInput.Control placeholder="YYYY-MM-DD" />
457
- </TextInput.Group>
458
- </Field.Root>
459
- </Stack>
460
- )
461
- }
462
-
463
- namespace styles {
464
- export const fill = style({ width: '100% !custom' })
465
- }
466
- ```
467
-
468
- **Don't:** Mark required fields with an asterisk and leave optional fields unmarked.
469
-
470
- ```tsx
471
- /**
472
- * Don't example for "Mark Optional Fields" on the Forms page.
473
- * Don't mark required fields with an asterisk and leave optional fields unmarked.
474
- * @module
475
- */
476
- import { Field, Stack, style, TextInput } from '@tempoxyz/ds'
477
-
478
- /** Renders the static preview, which the guideline card shows inert. */
479
- export function Demo() {
480
- return (
481
- <Stack gap="24" {...styles.fill()}>
482
- <Field.Root>
483
- <Field.Label>Key name *</Field.Label>
484
- <TextInput.Group>
485
- <TextInput.Control defaultValue="Production" />
486
- </TextInput.Group>
487
- </Field.Root>
488
- <Field.Root>
489
- <Field.Label>Expires</Field.Label>
490
- <TextInput.Group>
491
- <TextInput.Control placeholder="YYYY-MM-DD" />
492
- </TextInput.Group>
493
- </Field.Root>
494
- </Stack>
495
- )
496
- }
497
-
498
- namespace styles {
499
- export const fill = style({ width: '100% !custom' })
500
- }
501
- ```
502
-
503
- ## Settings
504
-
505
- ### Choose a Save Model
506
-
507
- * **Save on Submit (Checkbox):** For values that work together. Nothing changes until you press the primary action.
508
- * **Save on Change (Switch):** For independent settings. Confirm each change with a [Toast](../components/toast.md), and revert it if it fails.
509
-
510
- Do not mix the two in one section. If a person leaves a long form with unsaved changes, confirm the discard (see [Destructive Actions](destructive-actions.md)).
511
-
512
- **Do:** Use a [Switch](../components/switch.md) for a setting that applies immediately.
513
-
514
- ```tsx
515
- <Field.Root>
516
- <Field.Label>Payment alerts</Field.Label>
517
- <Switch defaultChecked />
518
- <Field.Description>Email me when a payment is confirmed.</Field.Description>
519
- </Field.Root>
520
- ```
521
-
522
- **Don't:** Pair a switch with a save button. If a change waits for submit, use a checkbox.
523
-
524
- ```tsx
525
- <Field.Root>
526
- <Field.Label>Payment alerts</Field.Label>
527
- <Switch defaultChecked />
528
- <Field.Description>Email me when a payment is confirmed.</Field.Description>
529
- </Field.Root>
530
- <Button size="small">Save changes</Button>
531
- ```
532
-
533
- ## Submitting
534
-
535
- Keep the submit button enabled and validate on press (see [Errors and Validation](errors-and-validation.md#keep-submit-buttons-enabled)). Set `loading` on it while the request runs, to block a second submit.
536
-
537
- ### Order Actions
538
-
539
- This order applies to every action group, including forms, dialog footers, and toolbars. Keep it the same across every page of a product.
540
-
541
- * **Alignment:** Align the group to the end, after the last field.
542
- * **Order:** Put Cancel or Back before the primary action, so the primary action comes last.
543
- * **Below 640px:** Stack the actions at full width, with the primary action first.
544
-
545
- **Do:** Align actions to the end, with Cancel before the primary action.
546
-
547
- ```tsx
548
- /**
549
- * Do example for "Order Actions" on the Forms page.
550
- * Align actions to the end, with Cancel before the primary action.
551
- * @module
552
- */
553
- import { Button, Field, Stack, style, TextInput } from '@tempoxyz/ds'
554
-
555
- /** Renders the static preview, which the guideline card shows inert. */
556
- export function Demo() {
557
- return (
558
- <Stack gap="24" {...styles.fill()}>
559
- <Field.Root>
560
- <Field.Label>Endpoint URL</Field.Label>
561
- <TextInput.Group>
562
- <TextInput.Control defaultValue="https://api.example.com/tempo" />
563
- </TextInput.Group>
564
- </Field.Root>
565
- <div {...styles.actions()}>
566
- <Button variant="secondary">Cancel</Button>
567
- <Button>Create webhook</Button>
568
- </div>
569
- </Stack>
570
- )
571
- }
572
-
573
- namespace styles {
574
- export const actions = style({ columnGap: '8', display: 'flex', justifyContent: 'flex-end' })
575
-
576
- export const fill = style({ width: '100% !custom' })
577
- }
578
- ```
579
-
580
- **Don't:** Put the primary action first and push Cancel to the far edge.
581
-
582
- ```tsx
583
- /**
584
- * Don't example for "Order Actions" on the Forms page.
585
- * Don't put the primary action first and push Cancel to the far edge.
586
- * @module
587
- */
588
- import { Button, Field, Stack, style, TextInput } from '@tempoxyz/ds'
589
-
590
- /** Renders the static preview, which the guideline card shows inert. */
591
- export function Demo() {
592
- return (
593
- <Stack gap="24" {...styles.fill()}>
594
- <Field.Root>
595
- <Field.Label>Endpoint URL</Field.Label>
596
- <TextInput.Group>
597
- <TextInput.Control defaultValue="https://api.example.com/tempo" />
598
- </TextInput.Group>
599
- </Field.Root>
600
- <div {...styles.actions()}>
601
- <Button>Create webhook</Button>
602
- <Button variant="secondary">Cancel</Button>
603
- </div>
604
- </Stack>
605
- )
606
- }
607
-
608
- namespace styles {
609
- export const actions = style({ display: 'flex', justifyContent: 'space-between' })
610
-
611
- export const fill = style({ width: '100% !custom' })
612
- }
613
- ```
614
-
615
- ### Name the Result in the Button
616
-
617
- Use one primary button, so Enter submits the form. Label it with the result, such as Create webhook.
618
-
619
- **Do:** Name the result of the form in the button.
620
-
621
- ```tsx
622
- <Button>Send payment</Button>
623
- ```
624
-
625
- **Don't:** Use a generic label that hides what happens.
626
-
627
- ```tsx
628
- <Button>Submit</Button>
629
- ```
630
-
631
- ## States
632
-
633
- * **Default:** Prefill a value when it is known, such as the connected address.
634
- * **Loading (Skeleton):** Wrap each control in a [Skeleton](../components/skeleton.md) while saved values load.
635
- * **Error (Field.Error):** An error under each invalid field (see [Errors and Validation](errors-and-validation.md)).
636
- * **Disabled (disabled):** Set it on a fieldset to disable a whole group, and state the reason nearby.
637
- * **Success (success):** Close the form and confirm with a [Toast](../components/toast.md). `success` sets no ARIA state, so confirm in text too.
638
-
639
- ## Content
640
-
641
- * **Nouns and Verbs:** Label fields with nouns and buttons with verbs.
642
- * **One Sentence:** Keep each description to a single sentence.
643
-
644
- ## Accessibility
645
-
646
- * **Visible Labels (label):** Pressing a label focuses its control. A field without a visible label, such as search, needs an `aria-label`.
647
- * **Announced Help (aria-describedby):** Screen readers read the description and any shown error with the control.
648
- * **Named Groups (Fieldset.Legend):** Names the native fieldset. Write it as the topic of the group.
649
- * **Matching Order (Tab):** Keep the visual order the same as the DOM order, so focus moves down one field at a time.
650
-
651
- ## Related
652
-
653
- [Field](../components/field.md)
654
-
655
- Use for labels, descriptions, and errors.
656
-
657
- [Fieldset](../components/fieldset.md)
658
-
659
- Use for grouping fields.
660
-
661
- [TextInput](../components/text-input.md)
662
-
663
- Use for text.
664
-
665
- [AmountInput](../components/amount-input.md)
666
-
667
- Use for amounts of money.
668
-
669
- [Button](../components/button.md)
670
-
671
- Use for submit and cancel actions.
672
-
673
- [Errors and Validation](errors-and-validation.md)
674
-
675
- Covers checking values.
676
-
677
- [Loading](loading.md)
678
-
679
- Covers submit and load states.