@tempoxyz/ds 0.3.10 → 0.3.11
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.
- package/dist/docs/AGENTS.md +9 -0
- package/dist/docs/components/accordion.md +489 -0
- package/dist/docs/components/address-card.md +147 -0
- package/dist/docs/components/agent-logo.md +194 -0
- package/dist/docs/components/alert-dialog.md +631 -0
- package/dist/docs/components/alert.md +448 -0
- package/dist/docs/components/amount-input.md +305 -0
- package/dist/docs/components/amount.md +794 -0
- package/dist/docs/components/app-shell.md +559 -0
- package/dist/docs/components/asset-chip.md +294 -0
- package/dist/docs/components/autocomplete.md +619 -0
- package/dist/docs/components/avatar.md +321 -0
- package/dist/docs/components/badge.md +339 -0
- package/dist/docs/components/badged-logo.md +116 -0
- package/dist/docs/components/banner.md +379 -0
- package/dist/docs/components/bar-chart.md +208 -0
- package/dist/docs/components/breadcrumbs.md +380 -0
- package/dist/docs/components/button-group.md +286 -0
- package/dist/docs/components/button.md +650 -0
- package/dist/docs/components/calendar.md +375 -0
- package/dist/docs/components/callout.md +96 -0
- package/dist/docs/components/checkbox-group.md +521 -0
- package/dist/docs/components/checkbox.md +467 -0
- package/dist/docs/components/choice-group.md +516 -0
- package/dist/docs/components/choicebox.md +641 -0
- package/dist/docs/components/code.md +100 -0
- package/dist/docs/components/combobox.md +939 -0
- package/dist/docs/components/container.md +257 -0
- package/dist/docs/components/copy-button.md +642 -0
- package/dist/docs/components/date-picker.md +514 -0
- package/dist/docs/components/dialog.md +1332 -0
- package/dist/docs/components/drawer.md +966 -0
- package/dist/docs/components/empty.md +340 -0
- package/dist/docs/components/field.md +570 -0
- package/dist/docs/components/fieldset.md +398 -0
- package/dist/docs/components/frame.md +434 -0
- package/dist/docs/components/gauge.md +299 -0
- package/dist/docs/components/get-started-visual.md +117 -0
- package/dist/docs/components/grid.md +288 -0
- package/dist/docs/components/hero-visual.md +155 -0
- package/dist/docs/components/hex.md +487 -0
- package/dist/docs/components/icon-tile.md +292 -0
- package/dist/docs/components/identicon.md +371 -0
- package/dist/docs/components/inline.md +233 -0
- package/dist/docs/components/inset.md +225 -0
- package/dist/docs/components/kbd.md +423 -0
- package/dist/docs/components/list-group.md +981 -0
- package/dist/docs/components/loading-dots.md +237 -0
- package/dist/docs/components/menu.md +934 -0
- package/dist/docs/components/native-select.md +204 -0
- package/dist/docs/components/network-logo.md +248 -0
- package/dist/docs/components/number-field.md +543 -0
- package/dist/docs/components/otp-field.md +616 -0
- package/dist/docs/components/pagination.md +516 -0
- package/dist/docs/components/popover.md +544 -0
- package/dist/docs/components/progress.md +388 -0
- package/dist/docs/components/qr.md +314 -0
- package/dist/docs/components/radio-group.md +528 -0
- package/dist/docs/components/secret-value.md +406 -0
- package/dist/docs/components/select.md +751 -0
- package/dist/docs/components/separator.md +379 -0
- package/dist/docs/components/sidebar-menu.md +922 -0
- package/dist/docs/components/skeleton.md +517 -0
- package/dist/docs/components/slider.md +539 -0
- package/dist/docs/components/snippet.md +424 -0
- package/dist/docs/components/spinner.md +216 -0
- package/dist/docs/components/split-bar.md +139 -0
- package/dist/docs/components/split-button.md +464 -0
- package/dist/docs/components/stack.md +299 -0
- package/dist/docs/components/status-chip.md +226 -0
- package/dist/docs/components/status-indicator.md +119 -0
- package/dist/docs/components/status-row.md +174 -0
- package/dist/docs/components/stepper.md +451 -0
- package/dist/docs/components/success-hero.md +157 -0
- package/dist/docs/components/surface.md +639 -0
- package/dist/docs/components/switch.md +472 -0
- package/dist/docs/components/table.md +967 -0
- package/dist/docs/components/tabs.md +627 -0
- package/dist/docs/components/tempo-logo.md +185 -0
- package/dist/docs/components/text-input.md +624 -0
- package/dist/docs/components/textarea.md +352 -0
- package/dist/docs/components/toast.md +535 -0
- package/dist/docs/components/token-logo.md +371 -0
- package/dist/docs/components/token.md +247 -0
- package/dist/docs/components/tooltip.md +490 -0
- package/dist/docs/components/verification-code.md +116 -0
- package/dist/docs/components/visual.md +249 -0
- package/dist/docs/components.md +203 -0
- package/dist/docs/foundations/accessibility.md +377 -0
- package/dist/docs/foundations/agents.md +150 -0
- package/dist/docs/foundations/color.md +522 -0
- package/dist/docs/foundations/content/tone.md +194 -0
- package/dist/docs/foundations/content/voice.md +194 -0
- package/dist/docs/foundations/content/writing-style.md +406 -0
- package/dist/docs/foundations/iconography.md +282 -0
- package/dist/docs/foundations/intent.md +360 -0
- package/dist/docs/foundations/layout.md +508 -0
- package/dist/docs/foundations/linter.md +296 -0
- package/dist/docs/foundations/motion.md +151 -0
- package/dist/docs/foundations/radius-and-padding.md +86 -0
- package/dist/docs/foundations/typography.md +266 -0
- package/dist/docs/index.md +137 -0
- package/dist/docs/introduction/faq.md +132 -0
- package/dist/docs/introduction/getting-started.md +377 -0
- package/dist/docs/patterns/blockchain-values.md +709 -0
- package/dist/docs/patterns/dashboards.md +638 -0
- package/dist/docs/patterns/destructive-actions.md +626 -0
- package/dist/docs/patterns/empty-states.md +612 -0
- package/dist/docs/patterns/errors-and-validation.md +808 -0
- package/dist/docs/patterns/feedback-and-status.md +518 -0
- package/dist/docs/patterns/forms.md +679 -0
- package/dist/docs/patterns/loading.md +630 -0
- package/dist/docs/patterns/navigation.md +397 -0
- package/dist/docs/patterns/payments.md +765 -0
- package/dist/docs/patterns/responsive-layout.md +997 -0
- package/dist/docs/patterns/tables-and-lists.md +964 -0
- package/dist/docs/products/tempo-console.md +671 -0
- package/dist/docs/products/tempo-performance.md +437 -0
- package/dist/docs/products/tempo-wallet.md +438 -0
- package/package.json +1 -1
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
# Choicebox
|
|
2
|
+
|
|
3
|
+
A selectable tile with an optional icon, title, and description.
|
|
4
|
+
|
|
5
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Choicebox.tsx)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
A tile form of a radio, checkbox, or button. Pressing anywhere on the tile operates its control.
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Choicebox } from '@tempoxyz/ds'
|
|
17
|
+
|
|
18
|
+
export function Demo() {
|
|
19
|
+
return (
|
|
20
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="instant">
|
|
21
|
+
<Choicebox.Radio value="standard">
|
|
22
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
23
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
24
|
+
</Choicebox.Radio>
|
|
25
|
+
<Choicebox.Radio value="instant">
|
|
26
|
+
<Choicebox.Title>Instant</Choicebox.Title>
|
|
27
|
+
<Choicebox.Description>Settles in seconds for a small fee</Choicebox.Description>
|
|
28
|
+
</Choicebox.Radio>
|
|
29
|
+
</Choicebox.RadioGroup>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Choicebox/Basic.tsx)
|
|
35
|
+
|
|
36
|
+
### Size
|
|
37
|
+
|
|
38
|
+
Set `size` on the group to `small`, `medium` (default), or `large`.
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
42
|
+
|
|
43
|
+
export function Demo() {
|
|
44
|
+
return (
|
|
45
|
+
<div {...styles.row()}>
|
|
46
|
+
{(['small', 'large'] as const).map((size) => (
|
|
47
|
+
<Choicebox.RadioGroup
|
|
48
|
+
aria-label={`Settlement ${size}`}
|
|
49
|
+
defaultValue="instant"
|
|
50
|
+
key={size}
|
|
51
|
+
size={size}
|
|
52
|
+
>
|
|
53
|
+
<Choicebox.Radio value="standard">
|
|
54
|
+
<Choicebox.Title>Standard ({size})</Choicebox.Title>
|
|
55
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
56
|
+
</Choicebox.Radio>
|
|
57
|
+
<Choicebox.Radio value="instant">
|
|
58
|
+
<Choicebox.Title>Instant ({size})</Choicebox.Title>
|
|
59
|
+
<Choicebox.Description>Settles in seconds for a small fee</Choicebox.Description>
|
|
60
|
+
</Choicebox.Radio>
|
|
61
|
+
</Choicebox.RadioGroup>
|
|
62
|
+
))}
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
namespace styles {
|
|
68
|
+
export const row = style({
|
|
69
|
+
alignItems: 'flex-start',
|
|
70
|
+
display: 'grid',
|
|
71
|
+
gap: '24',
|
|
72
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 360px)) !custom',
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Choicebox/Size.tsx)
|
|
78
|
+
|
|
79
|
+
### Disabled
|
|
80
|
+
|
|
81
|
+
Set `disabled` on a tile to make one option unavailable.
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import { Choicebox } from '@tempoxyz/ds'
|
|
85
|
+
|
|
86
|
+
export function Demo() {
|
|
87
|
+
return (
|
|
88
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="instant">
|
|
89
|
+
<Choicebox.Radio value="standard">
|
|
90
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
91
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
92
|
+
</Choicebox.Radio>
|
|
93
|
+
<Choicebox.Radio value="instant">
|
|
94
|
+
<Choicebox.Title>Instant</Choicebox.Title>
|
|
95
|
+
<Choicebox.Description>Settles in seconds for a small fee</Choicebox.Description>
|
|
96
|
+
</Choicebox.Radio>
|
|
97
|
+
<Choicebox.Radio disabled value="wire">
|
|
98
|
+
<Choicebox.Title>Wire</Choicebox.Title>
|
|
99
|
+
<Choicebox.Description>Unavailable in your region</Choicebox.Description>
|
|
100
|
+
</Choicebox.Radio>
|
|
101
|
+
</Choicebox.RadioGroup>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Choicebox/Disabled.tsx)
|
|
107
|
+
|
|
108
|
+
### Icon
|
|
109
|
+
|
|
110
|
+
Add a `Choicebox.Icon` before the title.
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { Choicebox } from '@tempoxyz/ds'
|
|
114
|
+
import { Bank, CreditCard } from '@tempoxyz/ds/icons'
|
|
115
|
+
|
|
116
|
+
export function Demo() {
|
|
117
|
+
return (
|
|
118
|
+
<Choicebox.RadioGroup aria-label="Method" defaultValue="bank">
|
|
119
|
+
<Choicebox.Radio value="bank">
|
|
120
|
+
<Choicebox.Icon>
|
|
121
|
+
<Bank />
|
|
122
|
+
</Choicebox.Icon>
|
|
123
|
+
<Choicebox.Title>Bank transfer</Choicebox.Title>
|
|
124
|
+
<Choicebox.Description>One to two business days</Choicebox.Description>
|
|
125
|
+
</Choicebox.Radio>
|
|
126
|
+
<Choicebox.Radio value="card">
|
|
127
|
+
<Choicebox.Icon>
|
|
128
|
+
<CreditCard />
|
|
129
|
+
</Choicebox.Icon>
|
|
130
|
+
<Choicebox.Title>Card</Choicebox.Title>
|
|
131
|
+
<Choicebox.Description>Instant, 2.9% fee</Choicebox.Description>
|
|
132
|
+
</Choicebox.Radio>
|
|
133
|
+
</Choicebox.RadioGroup>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Choicebox/Icon.tsx)
|
|
139
|
+
|
|
140
|
+
### ButtonGroup
|
|
141
|
+
|
|
142
|
+
Use `Choicebox.ButtonGroup` and `Choicebox.Button` for tiles that run an action and hold no value.
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
import { Choicebox } from '@tempoxyz/ds'
|
|
146
|
+
import { Bank, Wallet } from '@tempoxyz/ds/icons'
|
|
147
|
+
|
|
148
|
+
export function Demo() {
|
|
149
|
+
return (
|
|
150
|
+
<Choicebox.ButtonGroup aria-label="Add funds">
|
|
151
|
+
<Choicebox.Button onClick={() => alert('Bank transfer')}>
|
|
152
|
+
<Choicebox.Icon>
|
|
153
|
+
<Bank />
|
|
154
|
+
</Choicebox.Icon>
|
|
155
|
+
<Choicebox.Title>Bank transfer</Choicebox.Title>
|
|
156
|
+
<Choicebox.Description>Opens your deposit details</Choicebox.Description>
|
|
157
|
+
</Choicebox.Button>
|
|
158
|
+
<Choicebox.Button onClick={() => alert('Wallet')}>
|
|
159
|
+
<Choicebox.Icon>
|
|
160
|
+
<Wallet />
|
|
161
|
+
</Choicebox.Icon>
|
|
162
|
+
<Choicebox.Title>From a wallet</Choicebox.Title>
|
|
163
|
+
</Choicebox.Button>
|
|
164
|
+
</Choicebox.ButtonGroup>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Choicebox/ButtonGroup.tsx)
|
|
170
|
+
|
|
171
|
+
### CheckboxGroup
|
|
172
|
+
|
|
173
|
+
Use `Choicebox.CheckboxGroup` and `Choicebox.Checkbox` for tiles that allow several selections.
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { Choicebox } from '@tempoxyz/ds'
|
|
177
|
+
|
|
178
|
+
export function Demo() {
|
|
179
|
+
return (
|
|
180
|
+
<Choicebox.CheckboxGroup aria-label="Alerts" defaultValue={['email']}>
|
|
181
|
+
<Choicebox.Checkbox value="email">
|
|
182
|
+
<Choicebox.Title>Email</Choicebox.Title>
|
|
183
|
+
<Choicebox.Description>Receipts and weekly summaries</Choicebox.Description>
|
|
184
|
+
</Choicebox.Checkbox>
|
|
185
|
+
<Choicebox.Checkbox value="push">
|
|
186
|
+
<Choicebox.Title>Push</Choicebox.Title>
|
|
187
|
+
<Choicebox.Description>Transfers and security events</Choicebox.Description>
|
|
188
|
+
</Choicebox.Checkbox>
|
|
189
|
+
</Choicebox.CheckboxGroup>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Choicebox/CheckboxGroup.tsx)
|
|
195
|
+
|
|
196
|
+
## Anatomy
|
|
197
|
+
|
|
198
|
+
Import the component and assemble its parts.
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { Choicebox } from '@tempoxyz/ds'
|
|
202
|
+
|
|
203
|
+
<Choicebox.RadioGroup>
|
|
204
|
+
<Choicebox.Radio>
|
|
205
|
+
<Choicebox.Icon />
|
|
206
|
+
<Choicebox.Title />
|
|
207
|
+
<Choicebox.Description />
|
|
208
|
+
</Choicebox.Radio>
|
|
209
|
+
</Choicebox.RadioGroup>
|
|
210
|
+
|
|
211
|
+
<Choicebox.CheckboxGroup>
|
|
212
|
+
<Choicebox.Checkbox>
|
|
213
|
+
<Choicebox.Icon />
|
|
214
|
+
<Choicebox.Title />
|
|
215
|
+
<Choicebox.Description />
|
|
216
|
+
</Choicebox.Checkbox>
|
|
217
|
+
</Choicebox.CheckboxGroup>
|
|
218
|
+
|
|
219
|
+
<Choicebox.ButtonGroup>
|
|
220
|
+
<Choicebox.Button>
|
|
221
|
+
<Choicebox.Icon />
|
|
222
|
+
<Choicebox.Title />
|
|
223
|
+
<Choicebox.Description />
|
|
224
|
+
</Choicebox.Button>
|
|
225
|
+
</Choicebox.ButtonGroup>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Guidelines
|
|
229
|
+
|
|
230
|
+
### When to Use
|
|
231
|
+
|
|
232
|
+
* Choose between a few options that each need a description, such as Standard or Instant settlement with time and fee.
|
|
233
|
+
* Choose how to start a flow with `Choicebox.ButtonGroup`, such as Bank transfer or From a wallet.
|
|
234
|
+
* Choose several described options with `Choicebox.CheckboxGroup`, such as alert channels.
|
|
235
|
+
|
|
236
|
+
### When Not to Use
|
|
237
|
+
|
|
238
|
+
* If a label alone tells the options apart, use [RadioGroup](/docs/components/radio-group).
|
|
239
|
+
* Use [ChoiceGroup](/docs/components/choice-group) for a short mode switch, such as a chart's time range.
|
|
240
|
+
* Use [Select](/docs/components/select) for more options than fit on screen.
|
|
241
|
+
* Use [Button](/docs/components/button) for a single action, and [Menu](/docs/components/menu) for actions that need no description.
|
|
242
|
+
|
|
243
|
+
### Pick the Group by What a Tile Does
|
|
244
|
+
|
|
245
|
+
* **Radio Tiles (Choicebox.RadioGroup):** Hold one value, such as a settlement speed.
|
|
246
|
+
* **Checkbox Tiles (Choicebox.CheckboxGroup):** Hold several values, such as alert channels.
|
|
247
|
+
* **Button Tiles (Choicebox.ButtonGroup):** Run an action, such as opening the next step.
|
|
248
|
+
|
|
249
|
+
### Keep Tile Text Short
|
|
250
|
+
|
|
251
|
+
The whole tile's text becomes the accessible name, so long text slows every option for screen reader users.
|
|
252
|
+
|
|
253
|
+
**Do:** Give each tile a title of one to three words and a one-line description.
|
|
254
|
+
|
|
255
|
+
```tsx
|
|
256
|
+
/**
|
|
257
|
+
* Do example for "Keep Tile Text Short" on the Choicebox page.
|
|
258
|
+
* Give each tile a title of one to three words and a one-line description.
|
|
259
|
+
* @module
|
|
260
|
+
*/
|
|
261
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
262
|
+
|
|
263
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
264
|
+
export function Demo() {
|
|
265
|
+
return (
|
|
266
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="standard" {...styles.group()}>
|
|
267
|
+
<Choicebox.Radio value="standard">
|
|
268
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
269
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
270
|
+
</Choicebox.Radio>
|
|
271
|
+
<Choicebox.Radio value="instant">
|
|
272
|
+
<Choicebox.Title>Instant</Choicebox.Title>
|
|
273
|
+
<Choicebox.Description>Settles in seconds for a 1% fee</Choicebox.Description>
|
|
274
|
+
</Choicebox.Radio>
|
|
275
|
+
</Choicebox.RadioGroup>
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
namespace styles {
|
|
280
|
+
export const group = style({ width: '100% !custom' })
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Don't:** Repeat the question in each title or write paragraphs in the description.
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
/**
|
|
288
|
+
* Don't example for "Keep Tile Text Short" on the Choicebox page.
|
|
289
|
+
* Don't repeat the question in each title or write paragraphs in the description.
|
|
290
|
+
* @module
|
|
291
|
+
*/
|
|
292
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
293
|
+
|
|
294
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
295
|
+
export function Demo() {
|
|
296
|
+
return (
|
|
297
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="standard" {...styles.group()}>
|
|
298
|
+
<Choicebox.Radio value="standard">
|
|
299
|
+
<Choicebox.Title>Standard settlement for this payment</Choicebox.Title>
|
|
300
|
+
<Choicebox.Description>
|
|
301
|
+
Your payment is processed with our standard settlement option, which usually takes about
|
|
302
|
+
one business day depending on your bank.
|
|
303
|
+
</Choicebox.Description>
|
|
304
|
+
</Choicebox.Radio>
|
|
305
|
+
<Choicebox.Radio value="instant">
|
|
306
|
+
<Choicebox.Title>Instant settlement for this payment</Choicebox.Title>
|
|
307
|
+
<Choicebox.Description>
|
|
308
|
+
Your payment settles in seconds. A fee applies, shown on the review screen.
|
|
309
|
+
</Choicebox.Description>
|
|
310
|
+
</Choicebox.Radio>
|
|
311
|
+
</Choicebox.RadioGroup>
|
|
312
|
+
)
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
namespace styles {
|
|
316
|
+
export const group = style({ width: '100% !custom' })
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Describe What Sets Each Option Apart
|
|
321
|
+
|
|
322
|
+
**Do:** Put the deciding difference, such as time or fee, in the same place on every tile.
|
|
323
|
+
|
|
324
|
+
```tsx
|
|
325
|
+
/**
|
|
326
|
+
* Do example for "Keep Tile Text Short" on the Choicebox page.
|
|
327
|
+
* Give each tile a title of one to three words and a one-line description.
|
|
328
|
+
* @module
|
|
329
|
+
*/
|
|
330
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
331
|
+
|
|
332
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
333
|
+
export function Demo() {
|
|
334
|
+
return (
|
|
335
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="standard" {...styles.group()}>
|
|
336
|
+
<Choicebox.Radio value="standard">
|
|
337
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
338
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
339
|
+
</Choicebox.Radio>
|
|
340
|
+
<Choicebox.Radio value="instant">
|
|
341
|
+
<Choicebox.Title>Instant</Choicebox.Title>
|
|
342
|
+
<Choicebox.Description>Settles in seconds for a 1% fee</Choicebox.Description>
|
|
343
|
+
</Choicebox.Radio>
|
|
344
|
+
</Choicebox.RadioGroup>
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
namespace styles {
|
|
349
|
+
export const group = style({ width: '100% !custom' })
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Don't:** Write descriptions that vary in structure or leave out the difference.
|
|
354
|
+
|
|
355
|
+
```tsx
|
|
356
|
+
/**
|
|
357
|
+
* Don't example for "Describe What Sets Each Option Apart" on the Choicebox page.
|
|
358
|
+
* Don't write descriptions that vary in structure or leave out the difference.
|
|
359
|
+
* @module
|
|
360
|
+
*/
|
|
361
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
362
|
+
|
|
363
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
364
|
+
export function Demo() {
|
|
365
|
+
return (
|
|
366
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="standard" {...styles.group()}>
|
|
367
|
+
<Choicebox.Radio value="standard">
|
|
368
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
369
|
+
<Choicebox.Description>Our most popular option</Choicebox.Description>
|
|
370
|
+
</Choicebox.Radio>
|
|
371
|
+
<Choicebox.Radio value="instant">
|
|
372
|
+
<Choicebox.Title>Instant</Choicebox.Title>
|
|
373
|
+
<Choicebox.Description>For a 1% fee, settles in seconds</Choicebox.Description>
|
|
374
|
+
</Choicebox.Radio>
|
|
375
|
+
</Choicebox.RadioGroup>
|
|
376
|
+
)
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
namespace styles {
|
|
380
|
+
export const group = style({ width: '100% !custom' })
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Use Icons on Every Tile or None
|
|
385
|
+
|
|
386
|
+
**Do:** Add a `Choicebox.Icon` from one icon set to every tile.
|
|
387
|
+
|
|
388
|
+
```tsx
|
|
389
|
+
/**
|
|
390
|
+
* Do example for "Use Icons on Every Tile or None" on the Choicebox page.
|
|
391
|
+
* Add a `Choicebox.Icon` from one icon set to every tile.
|
|
392
|
+
* @module
|
|
393
|
+
*/
|
|
394
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
395
|
+
import { Bank, Wallet } from '@tempoxyz/ds/icons'
|
|
396
|
+
|
|
397
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
398
|
+
export function Demo() {
|
|
399
|
+
return (
|
|
400
|
+
<Choicebox.ButtonGroup aria-label="Add funds" {...styles.group()}>
|
|
401
|
+
<Choicebox.Button>
|
|
402
|
+
<Choicebox.Icon>
|
|
403
|
+
<Bank />
|
|
404
|
+
</Choicebox.Icon>
|
|
405
|
+
<Choicebox.Title>Bank transfer</Choicebox.Title>
|
|
406
|
+
<Choicebox.Description>Arrives in one business day</Choicebox.Description>
|
|
407
|
+
</Choicebox.Button>
|
|
408
|
+
<Choicebox.Button>
|
|
409
|
+
<Choicebox.Icon>
|
|
410
|
+
<Wallet />
|
|
411
|
+
</Choicebox.Icon>
|
|
412
|
+
<Choicebox.Title>From a wallet</Choicebox.Title>
|
|
413
|
+
<Choicebox.Description>Send USDC from any address</Choicebox.Description>
|
|
414
|
+
</Choicebox.Button>
|
|
415
|
+
</Choicebox.ButtonGroup>
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
namespace styles {
|
|
420
|
+
export const group = style({ width: '100% !custom' })
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**Don't:** Give icons to only some tiles in a group.
|
|
425
|
+
|
|
426
|
+
```tsx
|
|
427
|
+
/**
|
|
428
|
+
* Don't example for "Use Icons on Every Tile or None" on the Choicebox page.
|
|
429
|
+
* Don't give icons to only some tiles in a group.
|
|
430
|
+
* @module
|
|
431
|
+
*/
|
|
432
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
433
|
+
import { Bank } from '@tempoxyz/ds/icons'
|
|
434
|
+
|
|
435
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
436
|
+
export function Demo() {
|
|
437
|
+
return (
|
|
438
|
+
<Choicebox.ButtonGroup aria-label="Add funds" {...styles.group()}>
|
|
439
|
+
<Choicebox.Button>
|
|
440
|
+
<Choicebox.Icon>
|
|
441
|
+
<Bank />
|
|
442
|
+
</Choicebox.Icon>
|
|
443
|
+
<Choicebox.Title>Bank transfer</Choicebox.Title>
|
|
444
|
+
<Choicebox.Description>Arrives in one business day</Choicebox.Description>
|
|
445
|
+
</Choicebox.Button>
|
|
446
|
+
<Choicebox.Button>
|
|
447
|
+
<Choicebox.Title>From a wallet</Choicebox.Title>
|
|
448
|
+
<Choicebox.Description>Send USDC from any address</Choicebox.Description>
|
|
449
|
+
</Choicebox.Button>
|
|
450
|
+
</Choicebox.ButtonGroup>
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
namespace styles {
|
|
455
|
+
export const group = style({ width: '100% !custom' })
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Preselect a Safe Default
|
|
460
|
+
|
|
461
|
+
**Do:** Preselect an option only if it costs nothing extra, such as Standard settlement.
|
|
462
|
+
|
|
463
|
+
```tsx
|
|
464
|
+
/**
|
|
465
|
+
* Do example for "Keep Tile Text Short" on the Choicebox page.
|
|
466
|
+
* Give each tile a title of one to three words and a one-line description.
|
|
467
|
+
* @module
|
|
468
|
+
*/
|
|
469
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
470
|
+
|
|
471
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
472
|
+
export function Demo() {
|
|
473
|
+
return (
|
|
474
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="standard" {...styles.group()}>
|
|
475
|
+
<Choicebox.Radio value="standard">
|
|
476
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
477
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
478
|
+
</Choicebox.Radio>
|
|
479
|
+
<Choicebox.Radio value="instant">
|
|
480
|
+
<Choicebox.Title>Instant</Choicebox.Title>
|
|
481
|
+
<Choicebox.Description>Settles in seconds for a 1% fee</Choicebox.Description>
|
|
482
|
+
</Choicebox.Radio>
|
|
483
|
+
</Choicebox.RadioGroup>
|
|
484
|
+
)
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
namespace styles {
|
|
488
|
+
export const group = style({ width: '100% !custom' })
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
**Don't:** Preselect an option with a fee.
|
|
493
|
+
|
|
494
|
+
```tsx
|
|
495
|
+
/**
|
|
496
|
+
* Don't example for "Preselect a Safe Default" on the Choicebox page.
|
|
497
|
+
* Don't preselect an option with a fee.
|
|
498
|
+
* @module
|
|
499
|
+
*/
|
|
500
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
501
|
+
|
|
502
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
503
|
+
export function Demo() {
|
|
504
|
+
return (
|
|
505
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="instant" {...styles.group()}>
|
|
506
|
+
<Choicebox.Radio value="standard">
|
|
507
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
508
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
509
|
+
</Choicebox.Radio>
|
|
510
|
+
<Choicebox.Radio value="instant">
|
|
511
|
+
<Choicebox.Title>Instant</Choicebox.Title>
|
|
512
|
+
<Choicebox.Description>Settles in seconds for a 1% fee</Choicebox.Description>
|
|
513
|
+
</Choicebox.Radio>
|
|
514
|
+
</Choicebox.RadioGroup>
|
|
515
|
+
)
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
namespace styles {
|
|
519
|
+
export const group = style({ width: '100% !custom' })
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### Explain Unavailable Options
|
|
524
|
+
|
|
525
|
+
Leave out options that never apply to the account.
|
|
526
|
+
|
|
527
|
+
**Do:** If a tile is `disabled`, say why in its description.
|
|
528
|
+
|
|
529
|
+
```tsx
|
|
530
|
+
/**
|
|
531
|
+
* Do example for "Explain Unavailable Options" on the Choicebox page.
|
|
532
|
+
* If a tile is `disabled`, say why in its description.
|
|
533
|
+
* @module
|
|
534
|
+
*/
|
|
535
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
536
|
+
|
|
537
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
538
|
+
export function Demo() {
|
|
539
|
+
return (
|
|
540
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="standard" {...styles.group()}>
|
|
541
|
+
<Choicebox.Radio value="standard">
|
|
542
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
543
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
544
|
+
</Choicebox.Radio>
|
|
545
|
+
<Choicebox.Radio disabled value="wire">
|
|
546
|
+
<Choicebox.Title>Wire</Choicebox.Title>
|
|
547
|
+
<Choicebox.Description>Unavailable in your region</Choicebox.Description>
|
|
548
|
+
</Choicebox.Radio>
|
|
549
|
+
</Choicebox.RadioGroup>
|
|
550
|
+
)
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
namespace styles {
|
|
554
|
+
export const group = style({ width: '100% !custom' })
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
**Don't:** Disable a tile without a reason.
|
|
559
|
+
|
|
560
|
+
```tsx
|
|
561
|
+
/**
|
|
562
|
+
* Don't example for "Explain Unavailable Options" on the Choicebox page.
|
|
563
|
+
* Don't disable a tile without a reason.
|
|
564
|
+
* @module
|
|
565
|
+
*/
|
|
566
|
+
import { Choicebox, style } from '@tempoxyz/ds'
|
|
567
|
+
|
|
568
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
569
|
+
export function Demo() {
|
|
570
|
+
return (
|
|
571
|
+
<Choicebox.RadioGroup aria-label="Settlement" defaultValue="standard" {...styles.group()}>
|
|
572
|
+
<Choicebox.Radio value="standard">
|
|
573
|
+
<Choicebox.Title>Standard</Choicebox.Title>
|
|
574
|
+
<Choicebox.Description>Settles in one business day</Choicebox.Description>
|
|
575
|
+
</Choicebox.Radio>
|
|
576
|
+
<Choicebox.Radio disabled value="wire">
|
|
577
|
+
<Choicebox.Title>Wire</Choicebox.Title>
|
|
578
|
+
<Choicebox.Description>Settles the same day for a $15 fee</Choicebox.Description>
|
|
579
|
+
</Choicebox.Radio>
|
|
580
|
+
</Choicebox.RadioGroup>
|
|
581
|
+
)
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
namespace styles {
|
|
585
|
+
export const group = style({ width: '100% !custom' })
|
|
586
|
+
}
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
## Content
|
|
590
|
+
|
|
591
|
+
* **Descriptions:** Fragments without a trailing period, such as Settles in one business day.
|
|
592
|
+
* **Numbers:** Exact fees and times, such as 1% fee, not a small fee.
|
|
593
|
+
|
|
594
|
+
## Accessibility
|
|
595
|
+
|
|
596
|
+
Radio tiles follow the [WAI-ARIA radio group pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/), and checkbox tiles the [checkbox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).
|
|
597
|
+
|
|
598
|
+
### Semantics
|
|
599
|
+
|
|
600
|
+
* **Choicebox.RadioGroup (radiogroup):** Pressing anywhere on a tile selects it.
|
|
601
|
+
* **Choicebox.CheckboxGroup (group):** Pressing anywhere on a tile toggles it.
|
|
602
|
+
* **Choicebox.ButtonGroup (group):** Each tile is a native button. Enter and Space run it.
|
|
603
|
+
* **Name (aria-labelledby):** The tile's title and description together name its control.
|
|
604
|
+
* **Icon and Disabled Tiles (aria-disabled):** Icons are hidden from screen readers. A disabled tile marks its control disabled.
|
|
605
|
+
|
|
606
|
+
### Keyboard
|
|
607
|
+
|
|
608
|
+
* **Move to a Tile (Tab):** Focuses the checked tile in a radio group. In other groups, each tile is a tab stop.
|
|
609
|
+
* **Select the Next or Previous Tile (Arrow keys):** In a radio group, selects the next or previous enabled tile.
|
|
610
|
+
* **Toggle a Checkbox Tile (Space):** Toggles a checkbox tile.
|
|
611
|
+
* **Activate a Button Tile (Enter or Space):** Activates a button tile.
|
|
612
|
+
|
|
613
|
+
### Motion
|
|
614
|
+
|
|
615
|
+
Pressed tiles scale to `scale.press` (0.98), except under `prefers-reduced-motion: reduce`.
|
|
616
|
+
|
|
617
|
+
### Your Responsibilities
|
|
618
|
+
|
|
619
|
+
* **Name Each Group (aria-label):** Phrase it as a question, such as "How should this payment settle?"
|
|
620
|
+
|
|
621
|
+
## Related
|
|
622
|
+
|
|
623
|
+
[RadioGroup](/docs/components/radio-group)
|
|
624
|
+
|
|
625
|
+
Use for one choice with short labels.
|
|
626
|
+
|
|
627
|
+
[CheckboxGroup](/docs/components/checkbox-group)
|
|
628
|
+
|
|
629
|
+
Use for several choices with short labels.
|
|
630
|
+
|
|
631
|
+
[ChoiceGroup](/docs/components/choice-group)
|
|
632
|
+
|
|
633
|
+
Use for switching a view or mode.
|
|
634
|
+
|
|
635
|
+
[Fieldset](/docs/components/fieldset)
|
|
636
|
+
|
|
637
|
+
Use for naming a group with a legend.
|
|
638
|
+
|
|
639
|
+
[Payments](/docs/patterns/payments)
|
|
640
|
+
|
|
641
|
+
Covers choosing a funding or settlement method.
|