@antadesign/anta 0.3.19 → 0.3.20
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/README.md +1 -1
- package/dist/anta_helpers.d.ts +2 -2
- package/dist/components/Banner.d.ts +3 -3
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Calendar.d.ts +11 -12
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/Card.js +1 -1
- package/dist/components/Checkbox.d.ts +8 -9
- package/dist/components/Dialog.d.ts +1 -1
- package/dist/components/Expander.d.ts +5 -6
- package/dist/components/Input.d.ts +2 -2
- package/dist/components/Input.js +1 -1
- package/dist/components/InputAutocomplete.d.ts +8 -8
- package/dist/components/InputTime.d.ts +3 -3
- package/dist/components/InputTime.js +1 -1
- package/dist/components/Menu.d.ts +2 -2
- package/dist/components/MenuItem.d.ts +1 -1
- package/dist/components/MenuItem.js +1 -1
- package/dist/components/Progress.d.ts +1 -1
- package/dist/components/RadioGroup.d.ts +12 -13
- package/dist/components/Select.d.ts +31 -38
- package/dist/components/Select.js +1 -1
- package/dist/components/SelectFaceted.d.ts +27 -33
- package/dist/components/Slider.d.ts +5 -5
- package/dist/components/Switch.d.ts +4 -4
- package/dist/components/Tabs.d.ts +7 -7
- package/dist/components/Title.d.ts +1 -1
- package/dist/components/Toaster.d.ts +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.d.ts +1 -0
- package/dist/elements/a-expander.js +12 -2
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +1 -1
- package/dist/elements/a-tooltip.js +1 -1
- package/dist/elements/index.d.ts +1 -1
- package/dist/general_types.d.ts +22 -22
- package/dist/index.d.ts +3 -3
- package/docs/accessibility.md +4 -4
- package/docs/changelog.md +23 -13
- package/docs/comparison.md +1 -1
- package/docs/components/banner.md +17 -17
- package/docs/components/button.md +6 -6
- package/docs/components/card.md +5 -6
- package/docs/components/checkbox.md +17 -18
- package/docs/components/dialog.md +2 -2
- package/docs/components/expander.md +27 -30
- package/docs/components/icon.md +1 -1
- package/docs/components/input-autocomplete.md +15 -16
- package/docs/components/input-date.md +54 -59
- package/docs/components/input-time.md +7 -7
- package/docs/components/input.md +14 -14
- package/docs/components/menu.md +72 -8
- package/docs/components/progress.md +2 -2
- package/docs/components/radio.md +24 -25
- package/docs/components/select-faceted.md +95 -100
- package/docs/components/select.md +110 -115
- package/docs/components/slider.md +15 -10
- package/docs/components/switch.md +13 -13
- package/docs/components/tabs.md +23 -23
- package/docs/components/tag.md +5 -5
- package/docs/components/text.md +4 -4
- package/docs/components/title.md +1 -1
- package/docs/components/toaster.md +4 -4
- package/docs/components/tooltip.md +2 -2
- package/docs/credits.md +0 -4
- package/docs/index.md +1 -1
- package/docs/install-config.md +7 -7
- package/docs/normalization.md +6 -9
- package/docs/overview.md +1 -1
- package/docs/packages/stickers.md +1 -1
- package/package.json +1 -1
package/docs/components/menu.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Menu
|
|
2
2
|
|
|
3
|
-
A dropdown or context menu that anchors to
|
|
3
|
+
A dropdown or context menu that anchors to a target. Place
|
|
4
4
|
`<Menu>` immediately after the trigger — a button, an icon, a whole region —
|
|
5
5
|
and it opens on click, positions itself with room-aware flipping, and dismisses
|
|
6
6
|
on outside-click, `Escape`, or scroll. Rows are dedicated **`MenuItem`s** (not
|
|
@@ -12,7 +12,7 @@ Open state is uncontrolled by default — pass **`onStateChange`** (event-first:
|
|
|
12
12
|
observe it, or pass **`open`** to control it, applying `detail.next` to `open`
|
|
13
13
|
from your `onStateChange` handler (submenus stay uncontrolled). `statechange` is
|
|
14
14
|
**cancelable** and fires before the menu moves, so uncontrolled you can keep it
|
|
15
|
-
open with `event.preventDefault()`. You can also
|
|
15
|
+
open with `event.preventDefault()`. You can also keep a `ref` and call
|
|
16
16
|
`.open()` / `.close()` / `.toggle()`.
|
|
17
17
|
|
|
18
18
|
## Dropdown from a button
|
|
@@ -92,7 +92,7 @@ instead of its full border box. Anta's `Input` does this — it reports its fiel
|
|
|
92
92
|
box — so a `Menu` placed after an `<Input>` (as in `Select`) lines up with the
|
|
93
93
|
field, not the whole component (whose box also spans the label and hint).
|
|
94
94
|
|
|
95
|
-
##
|
|
95
|
+
## Open at the pointer
|
|
96
96
|
|
|
97
97
|
Pass `context` to open on right-click (the `contextmenu` event) of the region
|
|
98
98
|
the menu follows, positioned at the pointer — ideal for content surfaces like a
|
|
@@ -203,7 +203,7 @@ empty-state message (what `Select`'s `renderEmpty` uses).
|
|
|
203
203
|
</Menu>
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
-
## Pinned header
|
|
206
|
+
## Pinned header and footer
|
|
207
207
|
|
|
208
208
|
`a-menu-header` and `a-menu-footer` name fixed regions around the scrolling
|
|
209
209
|
items. Put `a-select-header` or `a-select-footer` in the same slots when a
|
|
@@ -225,7 +225,7 @@ footer stays the menu's divider.
|
|
|
225
225
|
</Menu>
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
-
## Custom content
|
|
228
|
+
## Custom content and the close behavior
|
|
229
229
|
|
|
230
230
|
The close decision is read straight from the DOM on click — never from whether a
|
|
231
231
|
handler called `preventDefault` — so it's safe in runtimes where event handlers
|
|
@@ -241,7 +241,7 @@ run off the UI thread. Walking out from the click, the nearest marker wins:
|
|
|
241
241
|
menu without being a `MenuItem`.
|
|
242
242
|
|
|
243
243
|
For programmatic open/close from app state, drive the `open` prop (the `state`
|
|
244
|
-
attribute, `"open"` / `"closed"`) and react via `onStateChange`, or
|
|
244
|
+
attribute, `"open"` / `"closed"`) and react via `onStateChange`, or keep a `ref`
|
|
245
245
|
and call `.open()` / `.close()` / `.toggle()`.
|
|
246
246
|
|
|
247
247
|
```tsx
|
|
@@ -313,7 +313,7 @@ a checkable menu.
|
|
|
313
313
|
<MenuItem selectionIndicator="checkbox" label="Show archived" selected data-menu-open />
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
-
## Badges, counters
|
|
316
|
+
## Badges, counters, and hints
|
|
317
317
|
|
|
318
318
|
Drop a `<Tag>` (or any element) as a **child** of a `MenuItem` for a trailing
|
|
319
319
|
counter or badge. Children render after the label but before the `kbd` hint and
|
|
@@ -356,6 +356,8 @@ navigating links.
|
|
|
356
356
|
|
|
357
357
|
| Prop | Type | Default | Description |
|
|
358
358
|
|------|------|---------|-------------|
|
|
359
|
+
| `children?` | ReactNode | — | Item content. With `label` set, children are extra content — most
|
|
360
|
+
notably the nested `<Menu>` for a submenu parent. |
|
|
359
361
|
| `copy?` | string | — | Text copied to the clipboard on activation. |
|
|
360
362
|
| `copyNode?` | boolean \| string | — | Copy a DOM node as rich text (`text/html`) + plain text. `true` copies
|
|
361
363
|
the nearest ancestor marked `data-copy-source`; a string is a CSS
|
|
@@ -363,11 +365,73 @@ navigating links.
|
|
|
363
365
|
from the copied output. |
|
|
364
366
|
| `copyUrl?` | true | — | Copy the current page URL (`location.href`). |
|
|
365
367
|
| `copyWithUrl?` | boolean | — | Prefix the copied text with `// URL: <current page URL>`. |
|
|
368
|
+
| `disabled?` | boolean | — | Disable the item: greyed out, not focusable for activation, no close. A
|
|
369
|
+
disabled link also drops its `href`, so it can't navigate. |
|
|
370
|
+
| `hint?` | ReactNode | — | Secondary text under the label — explanatory copy, like `RadioGroup`'s
|
|
371
|
+
option `hint`. Requires `label` (it stacks in a column beneath it). Muted
|
|
372
|
+
(`--text-3`) and tracks the row's `tone`. A string, or any node. |
|
|
373
|
+
| `icon?` | IconShape | — | Leading icon shape. |
|
|
374
|
+
| `iconTrailing?` | IconShape | — | A trailing icon. On a `submenu` item this **overrides** the default
|
|
375
|
+
chevron (omit it to keep the chevron); on a normal item it's the trailing
|
|
376
|
+
glyph (omit for none). |
|
|
377
|
+
| `indeterminate?` | boolean | — | Only meaningful with `selectionIndicator="checkbox"`: render the box in the
|
|
378
|
+
mixed state (`aria-checked="mixed"`) — e.g. a "Select all" row when some but
|
|
379
|
+
not all of its options are selected. |
|
|
380
|
+
| `indicator?` | React.ReactNode | — | Replace the built-in selection-indicator *visual* with your own node,
|
|
381
|
+
rendered at the **leading** edge (where the checkbox / radio sit). Pair with
|
|
382
|
+
`selectionIndicator` to keep the semantics — the row stays the control and
|
|
383
|
+
carries `role` + `aria-checked`; only the drawn mark changes. Suppresses the
|
|
384
|
+
built-in checkbox / radio and the trailing `check` glyph. The node is made
|
|
385
|
+
passive (aria-hidden, no pointer events) so the row receives the click. |
|
|
386
|
+
| `kbd?` | string | — | A trailing keyboard-shortcut hint, e.g. `"⌘E"`. |
|
|
387
|
+
| `label?` | ReactNode | — | The item's text. Usually a string, but any node is accepted — e.g. a filtered
|
|
388
|
+
`Select` bolds the matched substring. Omit and pass `children` for richer
|
|
389
|
+
content. |
|
|
366
390
|
| `onCopied?` | (ok) => void | — | Fires after the copy attempt with whether it succeeded. |
|
|
367
391
|
| `onCopyRequest?` | () => void | — | Compute the copy content lazily. Fires on pointerdown / keydown; update
|
|
368
392
|
`copy` (a state change) here and the activation copies the latest value.
|
|
369
393
|
The gap lets the update land even off the UI thread — only the
|
|
370
394
|
serializable `copy` string crosses. |
|
|
395
|
+
| `onMouseDown?` | (event) => void | — | Raw `mousedown` on the row. Mainly to `preventDefault()` so the row doesn't
|
|
396
|
+
take focus on a mouse press — e.g. a combobox option keeping focus in its
|
|
397
|
+
input field while the click still selects. |
|
|
398
|
+
| `onSelect?` | (event, detail) => void | — | Activation handler — fires when *this* item is chosen (click / Enter /
|
|
399
|
+
Space), unless it's `disabled`. It does **not** fire for a submenu parent
|
|
400
|
+
(clicking that opens the flyout, which isn't a selection) nor for a
|
|
401
|
+
selection bubbling up from a nested submenu. On a link item it fires
|
|
402
|
+
alongside the navigation. Receives the event plus a `{ value, label }`
|
|
403
|
+
detail. |
|
|
404
|
+
| `role?` | string | — | ARIA role override. Defaults to the role implied by `selectionIndicator`
|
|
405
|
+
(`menuitem` / `menuitemcheckbox` / `menuitemradio`); set it to reparent the
|
|
406
|
+
row under a different container role — e.g. `option` inside a `listbox`. |
|
|
407
|
+
| `selected?` | boolean | — | Mark the item as selected. On a plain row (no `selectionIndicator`) this is
|
|
408
|
+
a persistent background tint, the same resting fill a pressed row shows —
|
|
409
|
+
also the way to flag the current page on a link item. On a checkable row
|
|
410
|
+
(`selectionIndicator` set) it instead drives the leading `checkbox` / `radio`
|
|
411
|
+
indicator and the row's `aria-checked`. |
|
|
412
|
+
| `selectionIndicator?` | 'checkbox' \| 'radio' \| 'check' | — | Turn the row into a checkable item, driven by `selected` (the row stays the
|
|
413
|
+
control and carries `aria-checked`):
|
|
414
|
+
- `'checkbox'` → `role="menuitemcheckbox"`, a leading passive `<a-checkbox>`
|
|
415
|
+
(before `icon`); the tint is dropped (the box carries state).
|
|
416
|
+
- `'radio'` → `role="menuitemradio"`, a leading passive `<a-radio>`; tint dropped.
|
|
417
|
+
- `'check'` → `role="menuitemradio"`, a trailing check glyph on the selected
|
|
418
|
+
row *and* the background tint (the canonical single-select look).
|
|
419
|
+
Omit for a plain row (the default). |
|
|
420
|
+
| `submenu?` | boolean | — | Marks this item as a submenu parent: adds the trailing chevron and
|
|
421
|
+
`aria-haspopup="menu"`. Nest the flyout as a `<Menu>` child. |
|
|
422
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone — colors the label, icon, and hover/selected tint (and the
|
|
423
|
+
`checkbox`/`radio` indicator, which adopts it). A named tone, or any literal
|
|
424
|
+
CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone whose
|
|
425
|
+
hue + chroma are kept while the lightness is pinned to match the brand text.
|
|
426
|
+
`critical` is the destructive action; `neutral` (the default) is the standard
|
|
427
|
+
gray. |
|
|
428
|
+
| `toneSelected?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Like `tone`, but applied only while the row is `selected` — an unselected row
|
|
429
|
+
stays neutral. The whole selected row (label, icon, tint, and the `checkbox` /
|
|
430
|
+
`radio` indicator) takes the tone. Same value set as `tone`; on a selected row
|
|
431
|
+
`toneSelected` wins over `tone` when both are set. |
|
|
432
|
+
| `value?` | string \| number | — | An opaque value identifying this item, handed back in `onSelect`'s detail
|
|
433
|
+
so a shared handler can tell which row was chosen without a per-item
|
|
434
|
+
closure. |
|
|
371
435
|
|
|
372
436
|
## Keyboard
|
|
373
437
|
|
|
@@ -401,7 +465,7 @@ call `event.preventDefault()` to keep the menu as-is (e.g. block a dismiss).
|
|
|
401
465
|
Controlled, the menu never self-moves — apply `detail.next` to `open` to accept,
|
|
402
466
|
or do nothing to reject. (Submenus are always uncontrolled, regardless of `open`.)
|
|
403
467
|
|
|
404
|
-
Use
|
|
468
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
405
469
|
|
|
406
470
|
Put a focusable trigger immediately before `<a-menu>` and omit `state` for an
|
|
407
471
|
uncontrolled menu. Its light-DOM `<a-menu-item>` rows need their own `tabindex`
|
|
@@ -106,7 +106,7 @@ radius.
|
|
|
106
106
|
| `round?` | boolean \| number \| string | — | Fully-round track (`border-radius: 999px`); the fill is clipped to it. Pass a
|
|
107
107
|
`number` (px) or a CSS length string for a custom radius. |
|
|
108
108
|
| `size?` | 'small' \| 'medium' \| 'large' | medium | Size variant. Scales the track and the default label row together. |
|
|
109
|
-
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' |
|
|
109
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Color variant, or any literal CSS color for a one-off custom tone (the
|
|
110
110
|
surface / indicator / text are derived from it in oklch). Named tones track
|
|
111
111
|
light/dark automatically. |
|
|
112
112
|
| `value?` | number \| false | — | Current progress value. Omit this prop, or pass `false`, to show
|
|
@@ -171,7 +171,7 @@ a-progress.fancy::part(indicator) {
|
|
|
171
171
|
}
|
|
172
172
|
a-progress.fancy::part(indicator)::after { background: none; } /* hard right edge */
|
|
173
173
|
|
|
174
|
-
/* the percentage / label / hint are light-DOM children —
|
|
174
|
+
/* the percentage / label / hint are light-DOM children — recolor for the bar */
|
|
175
175
|
a-progress.fancy a-progress-number,
|
|
176
176
|
a-progress.fancy a-progress-text { color: #fff; }
|
|
177
177
|
a-progress.fancy a-progress-hint { color: var(--text-2); }
|
package/docs/components/radio.md
CHANGED
|
@@ -5,7 +5,7 @@ A single-select control. `RadioGroup` is the whole component — you pass it an
|
|
|
5
5
|
navigation, and the form value. There's no separate `Radio` component: options
|
|
6
6
|
are data, not markup.
|
|
7
7
|
|
|
8
|
-
## Options, label
|
|
8
|
+
## Options, label, and hint
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
11
|
<RadioGroup
|
|
@@ -42,12 +42,12 @@ The group's own `label` and `hint` form a header **above** the options: the
|
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Six named tones — `neutral` (default), `brand`, `info`, `success`, `warning`,
|
|
45
|
-
`critical`. `tone`
|
|
45
|
+
`critical`. `tone` colors the **mark** in every state — the selected-ring fill + dot
|
|
46
46
|
and (for a tinted tone) the unselected ring border (a light shade of the fill that
|
|
47
47
|
darkens on hover and active; `neutral` keeps a grey ring). The label and hint stay
|
|
48
|
-
neutral —
|
|
49
|
-
the `RadioGroup` to
|
|
50
|
-
one. Any literal CSS
|
|
48
|
+
neutral — color them in plain CSS with the `--text-N-{tone}` tokens. Set `tone` on
|
|
49
|
+
the `RadioGroup` to color every option, or on a single option to override just that
|
|
50
|
+
one. Any literal CSS color works too, for a one-off custom tone.
|
|
51
51
|
|
|
52
52
|
## Selected-only tone
|
|
53
53
|
|
|
@@ -67,7 +67,7 @@ neutral grey. Reach for it instead of `tone` when a resting tinted border would
|
|
|
67
67
|
as a validation error. Same tone set; set it on the group, or on a single option to
|
|
68
68
|
override one.
|
|
69
69
|
|
|
70
|
-
To
|
|
70
|
+
To color the **label and hint**, there's no prop — add a `color` rule on the
|
|
71
71
|
option's `a-radio-label` / `a-radio-hint` with a `--text-N-{tone}` value.
|
|
72
72
|
|
|
73
73
|
## Size
|
|
@@ -89,7 +89,7 @@ Three sizes scale the control circle **and** the label + hint type together:
|
|
|
89
89
|
`large` (18px / 17px). Set it on the `RadioGroup`, or on a single option to
|
|
90
90
|
override one.
|
|
91
91
|
|
|
92
|
-
## Orientation
|
|
92
|
+
## Orientation and layout
|
|
93
93
|
|
|
94
94
|
```tsx
|
|
95
95
|
<RadioGroup
|
|
@@ -145,11 +145,11 @@ navigation and dropped from the tab order.
|
|
|
145
145
|
/>
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
`status`
|
|
148
|
+
`status` recolors the group `hint` for feedback — the same tone set as
|
|
149
149
|
[`Input`](./input.md): `critical`, `warning`, `success`, `info`, `brand`
|
|
150
150
|
(omit for neutral). It styles the message only; drive it from your own validation.
|
|
151
151
|
|
|
152
|
-
## Keyboard
|
|
152
|
+
## Keyboard and accessibility
|
|
153
153
|
|
|
154
154
|
The group is one Tab stop: `Tab` moves into the selected option (or the first
|
|
155
155
|
enabled one), the arrow keys (`↑`/`↓`/`←`/`→`) move the selection between enabled
|
|
@@ -250,8 +250,7 @@ element — `Input`, and the composed `Select` — skip it and expose only
|
|
|
250
250
|
|------|------|---------|-------------|
|
|
251
251
|
| `options` | RadioOption[] | — | The options. The wrapper renders one `<a-radio>` per entry and computes its
|
|
252
252
|
`selected` / roving `tabindex` / `role` declaratively. |
|
|
253
|
-
| `defaultValue?` | string | — | Initial selected value for
|
|
254
|
-
selection in local state). |
|
|
253
|
+
| `defaultValue?` | string | — | Initial selected value for uncontrolled use. |
|
|
255
254
|
| `disabled?` | boolean | — | Disable the whole group. |
|
|
256
255
|
| `hint?` | string | — | Plain-text description for the group, rendered directly under `label` (above
|
|
257
256
|
the options) — typically instructional copy. Per-option helper text goes on
|
|
@@ -272,27 +271,27 @@ element — `Input`, and the composed `Select` — skip it and expose only
|
|
|
272
271
|
(uncontrolled), or in controlled mode answer by updating `value` (reject by
|
|
273
272
|
doing nothing). `'reset'` (form reset) and `'restore'` (bfcache / autofill) are
|
|
274
273
|
not cancelable — filter on `reason` if you only track user picks. |
|
|
275
|
-
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ value, name }` snapshot as the
|
|
276
|
-
|
|
274
|
+
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ value, name }` snapshot as the second argument,
|
|
275
|
+
matching `Input`. |
|
|
277
276
|
| `orientation?` | 'vertical' \| 'horizontal' | 'vertical' | Layout + arrow-key axis. |
|
|
278
277
|
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size applied to every option (an option's own `size` wins). |
|
|
279
|
-
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | 'neutral' | Validation/feedback tone for the group `hint` —
|
|
278
|
+
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | 'neutral' | Validation/feedback tone for the group `hint` — recolors it (same tone set
|
|
280
279
|
as `Input`'s `status`). Use `critical` for an error message, etc.; omit for
|
|
281
280
|
the neutral default. |
|
|
282
281
|
| `tone?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Mark tone applied to every option (an option's own `tone` wins), or any literal
|
|
283
|
-
CSS color for a one-off custom tone.
|
|
282
|
+
CSS color for a one-off custom tone. Colors the selected-ring fill + dot *and*
|
|
284
283
|
the unselected ring border. Named tones track light/dark mode. Use `toneSelected`
|
|
285
284
|
instead to tone only the selected option and leave the rest neutral. The option
|
|
286
|
-
text stays neutral —
|
|
287
|
-
| `toneSelected?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Like `tone`, but
|
|
285
|
+
text stays neutral — recolor it in plain CSS via the `--text-N-{tone}` tokens. |
|
|
286
|
+
| `toneSelected?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Like `tone`, but colored onto the **selected option only** — every unselected
|
|
288
287
|
ring stays neutral grey. Applied to every option (an option's own `toneSelected`
|
|
289
288
|
wins). Prefer this over `tone` when a resting tinted border would read as a
|
|
290
289
|
validation state. |
|
|
291
|
-
| `value?` | string | — | Controlled selected value.
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
| `value?` | string | — | Controlled selected value. The group follows this prop and reports a
|
|
291
|
+
requested change through `onStateChange`. Leave it undefined for
|
|
292
|
+
uncontrolled use. |
|
|
294
293
|
|
|
295
|
-
Use
|
|
294
|
+
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
296
295
|
|
|
297
296
|
The group owns selection and the single tab stop. Put options in `<a-radio-list>`.
|
|
298
297
|
|
|
@@ -323,8 +322,8 @@ treatments.
|
|
|
323
322
|
</div>
|
|
324
323
|
```
|
|
325
324
|
|
|
326
|
-
Reach for the props first: **`tone`**
|
|
327
|
-
**`toneSelected`** only the selected option (any CSS
|
|
325
|
+
Reach for the props first: **`tone`** colors the mark in every state,
|
|
326
|
+
**`toneSelected`** only the selected option (any CSS color for a custom tone, set on
|
|
328
327
|
the group or a single option — derives the full curve in oklch), **`size`** the
|
|
329
328
|
dimensions + type. To tint the label + hint, add a `color` rule on the option's
|
|
330
329
|
`a-radio-label` / `a-radio-hint` with the `--text-N-{tone}` values — there's no
|
|
@@ -343,7 +342,7 @@ masked — same heart as the checkbox):
|
|
|
343
342
|
|
|
344
343
|
```css
|
|
345
344
|
/* Outlined — an unfilled selected ring: keep the ring background and paint the
|
|
346
|
-
border + dot in the tone
|
|
345
|
+
border + dot in the tone color (light-dark() tunes both themes at once). */
|
|
347
346
|
a-radio-group.outlined a-radio:state(selected)::before {
|
|
348
347
|
background: var(--radio-bg);
|
|
349
348
|
border-color: light-dark(#5f4bc3, #7460d7);
|
|
@@ -357,7 +356,7 @@ a-radio-group.square a-radio:state(selected)::before { background: light-dark(#0
|
|
|
357
356
|
a-radio-group.square a-radio:state(selected)::after { background: light-dark(#fff, #000); } /* contrasting dot */
|
|
358
357
|
|
|
359
358
|
/* Heart — a bigger ring with a heart mark (the dot ::after, masked) on a pink fill.
|
|
360
|
-
Same heart SVG as the checkbox; mask-size: contain
|
|
359
|
+
Same heart SVG as the checkbox; mask-size: contain centers it in the bigger ring. */
|
|
361
360
|
a-radio-group.heart a-radio::before { inline-size: 22px; block-size: 22px; } /* bigger ring */
|
|
362
361
|
a-radio-group.heart a-radio::after {
|
|
363
362
|
inline-size: 13px; block-size: 13px; border-radius: 0;
|