@antadesign/anta 0.3.26 → 0.3.27
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 +26 -28
- package/dist/anta_helpers.d.ts +4 -0
- package/dist/anta_helpers.js +14 -0
- package/dist/box-types.d.ts +1 -1
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +25 -25
- package/dist/capture-types.d.ts +156 -0
- package/dist/capture-types.js +0 -0
- package/dist/components/Box.d.ts +15 -0
- package/dist/components/Box.js +3 -11
- package/dist/components/Capture.d.ts +39 -0
- package/dist/components/Capture.js +36 -0
- package/dist/components/capture-props.d.ts +30 -0
- package/dist/components/capture-props.js +44 -0
- package/dist/elements/a-box.d.ts +1 -1
- package/dist/elements/a-box.js +11 -3
- package/dist/elements/a-capture.css +1 -0
- package/dist/elements/a-capture.d.ts +10 -0
- package/dist/elements/a-capture.js +24 -0
- package/dist/elements/a-checkbox.js +4 -4
- package/dist/elements/a-slider.js +6 -6
- package/dist/elements/capture-input.d.ts +5 -0
- package/dist/elements/capture-input.js +609 -0
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/general_types.d.ts +34 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +2 -1
- package/docs/accessibility.md +24 -0
- package/docs/changelog.md +22 -0
- package/docs/colors.md +141 -0
- package/docs/comparison.md +463 -28
- package/docs/components/avatar.md +13 -17
- package/docs/components/banner.md +13 -27
- package/docs/components/box.md +226 -154
- package/docs/components/breadcrumbs.md +7 -6
- package/docs/components/button.md +48 -37
- package/docs/components/capture.md +345 -0
- package/docs/components/card.md +17 -38
- package/docs/components/checkbox.md +16 -39
- package/docs/components/dialog.md +14 -36
- package/docs/components/expander.md +15 -40
- package/docs/components/icon.md +111 -9
- package/docs/components/input-autocomplete.md +9 -11
- package/docs/components/input-date.md +33 -23
- package/docs/components/input-time.md +15 -23
- package/docs/components/input.md +27 -76
- package/docs/components/loader.md +7 -5
- package/docs/components/menu.md +73 -77
- package/docs/components/progress.md +10 -14
- package/docs/components/radio.md +17 -36
- package/docs/components/select-faceted.md +7 -25
- package/docs/components/select.md +24 -97
- package/docs/components/slider.md +16 -21
- package/docs/components/steps.md +38 -8
- package/docs/components/switch.md +11 -14
- package/docs/components/tabs.md +52 -40
- package/docs/components/tag.md +11 -22
- package/docs/components/text.md +10 -23
- package/docs/components/title.md +7 -8
- package/docs/components/toaster.md +6 -3
- package/docs/components/tooltip.md +13 -23
- package/docs/index.md +3 -1
- package/docs/install-config.md +24 -0
- package/docs/normalization.md +45 -0
- package/docs/packages/stickers.md +56 -0
- package/docs/theming.md +270 -0
- package/package.json +3 -1
|
@@ -623,117 +623,40 @@ sections is one pick (dev builds warn).
|
|
|
623
623
|
groups (their label becomes the heading) and drops empty ones, so results read as one
|
|
624
624
|
scannable list instead of hiding matches behind flyouts.
|
|
625
625
|
|
|
626
|
-
|
|
626
|
+
## Component props
|
|
627
627
|
|
|
628
628
|
| Prop | Type | Default | Description |
|
|
629
629
|
|------|------|---------|-------------|
|
|
630
|
-
| `options` | SelectItem[] | — | The options to choose from — bare strings, `SelectOption` objects, `SelectGroup`s
|
|
631
|
-
(
|
|
632
|
-
submenus nest and mix with plain options. Selection stays global (one `value`,
|
|
633
|
-
leaf options only); a filter query flattens the tree into grouped results.
|
|
634
|
-
|
|
635
|
-
`Select` infers its value type `V` from these options: `{ value: 365 }` makes
|
|
636
|
-
`onValueChange` report `number`. A mix of value types widens `V` to the union.
|
|
637
|
-
|
|
638
|
-
Each leaf `value` is the option's identity and must be **unique across the whole
|
|
639
|
-
tree** (selection is value-keyed, so a value repeated in two sections is one logical
|
|
640
|
-
pick: both rows toggle together, the trigger resolves to the last). Values that
|
|
641
|
-
stringify alike (`365` and `"365"`) also collide as row keys; dev builds
|
|
642
|
-
`console.warn` on either. |
|
|
643
|
-
| `clearable?` | boolean | — | Add a "Clear" row pinned in the menu **footer** that empties the selection
|
|
644
|
-
(single → none, multiple → `[]`). Shown only while something is selected, so
|
|
645
|
-
it never scrolls away in a long or filtered list. |
|
|
630
|
+
| `options` | SelectItem[] | — | The options to choose from — bare strings, `SelectOption` objects, `SelectGroup`s (inline titled sections), or `SelectSubmenu`s (flyout branches). Groups and submenus nest and mix with plain options. Selection stays global (one `value`, leaf options only); a filter query flattens the tree into grouped results. `Select` infers its value type `V` from these options: `{ value: 365 }` makes `onValueChange` report `number`. A mix of value types widens `V` to the union. Each leaf `value` is the option's identity and must be **unique across the whole tree** (selection is value-keyed, so a value repeated in two sections is one logical pick: both rows toggle together, the trigger resolves to the last). Values that stringify alike (`365` and `"365"`) also collide as row keys; dev builds `console.warn` on either. |
|
|
631
|
+
| `clearable?` | boolean | — | Add a "Clear" row pinned in the menu **footer** that empties the selection (single → none, multiple → `[]`). Shown only while something is selected, so it never scrolls away in a long or filtered list. |
|
|
646
632
|
| `clearLabel?` | string | Clear | Label for the `clearable` footer row. |
|
|
647
633
|
| `defaultValue?` | V \| V[] | — | Initial selected option value for uncontrolled use. |
|
|
648
634
|
| `disabled?` | boolean | — | Disable the whole select. |
|
|
649
|
-
| `filter?` | boolean \| (option, query) => boolean | — | Add a search field at the top of the menu that filters the options as you
|
|
650
|
-
type. `true` uses the built-in matcher — a case-insensitive substring of the
|
|
651
|
-
option's **value / label / hint**. Pass a **function** `(option, query) =>
|
|
652
|
-
boolean` for custom matching (called per option; return `true` to keep it). |
|
|
635
|
+
| `filter?` | boolean \| (option, query) => boolean | — | Add a search field at the top of the menu that filters the options as you type. `true` uses the built-in matcher — a case-insensitive substring of the option's **value / label / hint**. Pass a **function** `(option, query) => boolean` for custom matching (called per option; return `true` to keep it). |
|
|
653
636
|
| `hint?` | string | — | Helper text under the field (Input's `hint`). |
|
|
654
|
-
| `icon?` | IconShape | — | Leading icon shown at the left of the field (the default trigger's `Input`
|
|
655
|
-
`
|
|
656
|
-
`state.icon` instead — the consumer places it. |
|
|
657
|
-
| `indicator?` | 'none' \| 'check' \| 'radio' | none | The per-row mark for **single**-select: `'none'` (a tint-only highlight),
|
|
658
|
-
`'check'` (a trailing checkmark on the selected row, keeping the tint — the
|
|
659
|
-
canonical Select look), or `'radio'` (a leading radio on every row).
|
|
660
|
-
Multi-select always uses checkboxes. |
|
|
637
|
+
| `icon?` | IconShape | — | Leading icon shown at the left of the field (the default trigger's `Input` `leading` slot). With a custom `renderTrigger`, it's passed through as `state.icon` instead — the consumer places it. |
|
|
638
|
+
| `indicator?` | 'none' \| 'check' \| 'radio' | none | The per-row mark for **single**-select: `'none'` (a tint-only highlight), `'check'` (a trailing checkmark on the selected row, keeping the tint — the canonical Select look), or `'radio'` (a leading radio on every row). Multi-select always uses checkboxes. |
|
|
661
639
|
| `label?` | string | — | Field label, above the trigger (Input's `label`). |
|
|
662
|
-
| `leading?` | ReactNode | — | Content for the default trigger's `leading` slot, such as a key prefix
|
|
663
|
-
before the value. It replaces the icon derived from `icon`. Include an
|
|
664
|
-
`<Icon>` in this content when both are needed. Ignored by `renderTrigger`. |
|
|
640
|
+
| `leading?` | ReactNode | — | Content for the default trigger's `leading` slot, such as a key prefix before the value. It replaces the icon derived from `icon`. Include an `<Icon>` in this content when both are needed. Ignored by `renderTrigger`. |
|
|
665
641
|
| `offset?` | number | 4 | Gap in pixels between the trigger and the options menu. |
|
|
666
|
-
| `onValueChange?` | (value, attrs) => void | — | Fires after the selection changes, with the new value and a
|
|
667
|
-
`{ value, option }` snapshot. Select has no discrete element state, so
|
|
668
|
-
there is no cancelable `onStateChange` (see the Input event-model note). |
|
|
642
|
+
| `onValueChange?` | (value, attrs) => void | — | Fires after the selection changes, with the new value and a `{ value, option }` snapshot. Select has no discrete element state, so there is no cancelable `onStateChange` (see the Input event-model note). |
|
|
669
643
|
| `placeholder?` | string | — | Text shown when nothing is selected. |
|
|
670
|
-
| `placement?` | 'left' \| 'right' \| 'bottom' \| 'top' \| 'bottom-start' \| 'bottom-end' \| 'top-start' \| 'top-end' \| 'right-start' \| 'right-end' \| 'left-start' \| 'left-end' | bottom-start | Preferred placement of the options menu relative to the trigger. The menu
|
|
671
|
-
|
|
672
|
-
| `
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
list renders nothing. Whatever you return goes where the option rows would —
|
|
677
|
-
a plain node is inert; return a `MenuItem` (e.g. a "Create" row) to make it
|
|
678
|
-
focusable and selectable. |
|
|
679
|
-
| `renderIndicator?` | (state) => ReactNode | — | Replace each row's selection **mark** with your own node, drawn at the
|
|
680
|
-
leading edge. The row stays the control (`role` + `aria-checked` from
|
|
681
|
-
`indicator` / `selection`); only the drawn mark changes, so pair it with an
|
|
682
|
-
`indicator` (`'check'` / `'radio'`) or `selection="multiple"` for the
|
|
683
|
-
semantics. Composes with `renderOption`. |
|
|
684
|
-
| `renderOption?` | (option, state) => ReactNode | — | Replaces the built-in `label`, `hint`, and `icon` layout for each option row.
|
|
685
|
-
Select still supplies the row container, click handling, ARIA attributes, and
|
|
686
|
-
selection indicator. Read extra option fields through `SelectOption`'s index
|
|
687
|
-
signature. `state` contains `value`, `selected`, and `disabled`. Filtering
|
|
688
|
-
still matches the option's `value`, `label`, and `hint`, but Select cannot
|
|
689
|
-
highlight matches within the returned content. |
|
|
690
|
-
| `renderSummary?` | (selected) => string \| undefined | — | `multiple` only: build the trigger's selection summary text yourself,
|
|
691
|
-
replacing the built-in "`All` / one label / `N selected`" logic. Receives
|
|
692
|
-
the resolved selected options (`selected.length` is the count) and runs only
|
|
693
|
-
while something is selected — an empty selection still shows the
|
|
694
|
-
`placeholder`. Return a **string**: it flows into the default trigger's
|
|
695
|
-
read-only field, so a long summary ellipsizes at the field's width just
|
|
696
|
-
like a long value (`Engineering, Design, … `). Return `undefined` to fall
|
|
697
|
-
back to the default for that case (e.g. customize only the count, keeping
|
|
698
|
-
the single-label case built-in). For rich content (chips, multiple nodes)
|
|
699
|
-
use `renderTrigger`, which replaces the whole field. |
|
|
700
|
-
| `renderTrigger?` | (state) => ReactNode | — | Replaces the default field with a trigger returned from this function.
|
|
701
|
-
Receives `open`, `value`, `selected`, `disabled`, and `icon`. Return exactly
|
|
702
|
-
one focusable element, such as an Anta `Button`. The menu is positioned
|
|
703
|
-
relative to that element and opens when it is clicked. Do not return a
|
|
704
|
-
fragment, multiple siblings, or a non-focusable wrapper. Add
|
|
705
|
-
`aria-haspopup="menu"` and `aria-expanded={state.open}` to the element, on a
|
|
706
|
-
role that supports them (an Anta `Button` already carries `role="button"`;
|
|
707
|
-
otherwise add `role="combobox"`).
|
|
708
|
-
Field props (`label`, `hint`, `size`, `status`, `placeholder`, and `round`) and
|
|
709
|
-
`className` / `style` apply only to the default field. Add styling and
|
|
710
|
-
attributes to the returned element instead. |
|
|
644
|
+
| `placement?` | 'left' \| 'right' \| 'bottom' \| 'top' \| 'bottom-start' \| 'bottom-end' \| 'top-start' \| 'top-end' \| 'right-start' \| 'right-end' \| 'left-start' \| 'left-end' | bottom-start | Preferred placement of the options menu relative to the trigger. The menu auto-flips vertically and clamps horizontally when needed. |
|
|
645
|
+
| `renderEmpty?` | (state) => ReactNode | — | Render content in the menu body when the (filtered) option list is empty — a "no results" message, a loading indicator (gated on your own external loading state), or a "create from the query" row. Receives an `EmptyState` (`query`, trimmed). There is no built-in empty message: when omitted, an empty list renders nothing. Whatever you return goes where the option rows would — a plain node is inert; return a `MenuItem` (e.g. a "Create" row) to make it focusable and selectable. |
|
|
646
|
+
| `renderIndicator?` | (state) => ReactNode | — | Replace each row's selection **mark** with your own node, drawn at the leading edge. The row stays the control (`role` + `aria-checked` from `indicator` / `selection`); only the drawn mark changes, so pair it with an `indicator` (`'check'` / `'radio'`) or `selection="multiple"` for the semantics. Composes with `renderOption`. |
|
|
647
|
+
| `renderOption?` | (option, state) => ReactNode | — | Replaces the built-in `label`, `hint`, and `icon` layout for each option row. Select still supplies the row container, click handling, ARIA attributes, and selection indicator. Read extra option fields through `SelectOption`'s index signature. `state` contains `value`, `selected`, and `disabled`. Filtering still matches the option's `value`, `label`, and `hint`, but Select cannot highlight matches within the returned content. |
|
|
648
|
+
| `renderSummary?` | (selected) => string \| undefined | — | `multiple` only: build the trigger's selection summary text yourself, replacing the built-in "`All` / one label / `N selected`" logic. Receives the resolved selected options (`selected.length` is the count) and runs only while something is selected — an empty selection still shows the `placeholder`. Return a **string**: it flows into the default trigger's read-only field, so a long summary ellipsizes at the field's width just like a long value (`Engineering, Design, … `). Return `undefined` to fall back to the default for that case (e.g. customize only the count, keeping the single-label case built-in). For rich content (chips, multiple nodes) use `renderTrigger`, which replaces the whole field. |
|
|
649
|
+
| `renderTrigger?` | (state) => ReactNode | — | Replaces the default field with a trigger returned from this function. Receives `open`, `value`, `selected`, `disabled`, and `icon`. Return exactly one focusable element, such as an Anta `Button`. The menu is positioned relative to that element and opens when it is clicked. Do not return a fragment, multiple siblings, or a non-focusable wrapper. Add `aria-haspopup="menu"` and `aria-expanded={state.open}` to the element, on a role that supports them (an Anta `Button` already carries `role="button"`; otherwise add `role="combobox"`). Field props (`label`, `hint`, `size`, `status`, `placeholder`, and `round`) and `className` / `style` apply only to the default field. Add styling and attributes to the returned element instead. |
|
|
711
650
|
| `round?` | boolean \| number \| string | — | Round the field corners — `true` for fully round, or a number / CSS length. |
|
|
712
|
-
| `selectAll?` | boolean | true | `multiple` only: shows a "Select all" row that toggles every enabled option,
|
|
713
|
-
or only the visible options when a filter query is active. Its checkbox is
|
|
714
|
-
mixed when some options are selected. It is on by default. Set it to `false`
|
|
715
|
-
to remove the row and the Alt/Option-click shortcut that selects only one row. |
|
|
651
|
+
| `selectAll?` | boolean | true | `multiple` only: shows a "Select all" row that toggles every enabled option, or only the visible options when a filter query is active. Its checkbox is mixed when some options are selected. It is on by default. Set it to `false` to remove the row and the Alt/Option-click shortcut that selects only one row. |
|
|
716
652
|
| `selectAllLabel?` | string | Select all | Label for the `selectAll` row. |
|
|
717
|
-
| `selection?` | 'single' \| 'multiple' | single | Selection mode. `'single'` (the default) keeps `value` a single value and
|
|
718
|
-
closes the menu on pick. Switch to `'multiple'` for checkboxes + an
|
|
719
|
-
array value. |
|
|
653
|
+
| `selection?` | 'single' \| 'multiple' | single | Selection mode. `'single'` (the default) keeps `value` a single value and closes the menu on pick. Switch to `'multiple'` for checkboxes + an array value. |
|
|
720
654
|
| `size?` | 'small' \| 'medium' \| 'large' | medium | Field size. |
|
|
721
655
|
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | neutral | Validation/feedback tone for the field (Input's `status`). |
|
|
722
|
-
| `statusIcon?` | (string & {}) \| false \| IconShape | — | Glyph shown before the `hint` when `status` is set (Input's `statusIcon`).
|
|
723
|
-
|
|
724
|
-
| `
|
|
725
|
-
|
|
726
|
-
the chosen option. A named tone or a custom CSS color. Most visible with the
|
|
727
|
-
tint-based marks (`indicator` `'none'` / `'check'`); with `'radio'` /
|
|
728
|
-
`'checkbox'` it tones the label + indicator (those modes have no row tint). |
|
|
729
|
-
| `value?` | V \| V[] | — | Controlled value: the selected option's `value`. Update it through
|
|
730
|
-
`onValueChange`. Leave it undefined for uncontrolled use. |
|
|
731
|
-
| `verbose?` | boolean | — | `multiple` only: spell the picks out in the count summary — `3 selected:
|
|
732
|
-
A, B, C` (labels comma-joined) in place of the bare `3 selected`. Applies
|
|
733
|
-
to the multi-count case only: `All` stays `All`, a single pick stays its
|
|
734
|
-
own label, and an empty selection stays the `placeholder`. The list flows
|
|
735
|
-
into the read-only field, so it ellipsizes at the field's width when long
|
|
736
|
-
(`3 selected: Engineering, Des… `). `renderSummary` overrides this. |
|
|
656
|
+
| `statusIcon?` | (string & {}) \| false \| IconShape | — | Glyph shown before the `hint` when `status` is set (Input's `statusIcon`). Each status has a default; pass a shape to override, or `false` to drop it. |
|
|
657
|
+
| `toneSelected?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | — | Tone applied to the **selected** row(s) — the whole row takes this tone (label, icon, indicator, and the background tint), like passing `tone` to just the chosen option. A named tone or a custom CSS color. Most visible with the tint-based marks (`indicator` `'none'` / `'check'`); with `'radio'` / `'checkbox'` it tones the label + indicator (those modes have no row tint). |
|
|
658
|
+
| `value?` | V \| V[] | — | Controlled value: the selected option's `value`. Update it through `onValueChange`. Leave it undefined for uncontrolled use. |
|
|
659
|
+
| `verbose?` | boolean | — | `multiple` only: spell the picks out in the count summary — `3 selected: A, B, C` (labels comma-joined) in place of the bare `3 selected`. Applies to the multi-count case only: `All` stays `All`, a single pick stays its own label, and an empty selection stays the `placeholder`. The list flows into the read-only field, so it ellipsizes at the field's width when long (`3 selected: Engineering, Des… `). `renderSummary` overrides this. |
|
|
737
660
|
|
|
738
661
|
### The `SelectItem` type
|
|
739
662
|
|
|
@@ -829,6 +752,8 @@ inline `SelectGroup`, and a flyout `SelectSubmenu` (whose items are themselves
|
|
|
829
752
|
/>
|
|
830
753
|
```
|
|
831
754
|
|
|
755
|
+
## Web Component
|
|
756
|
+
|
|
832
757
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
833
758
|
|
|
834
759
|
`Select` has no host element. Compose a read-only `<a-input>` trigger with an
|
|
@@ -896,6 +821,8 @@ corners.
|
|
|
896
821
|
</select>
|
|
897
822
|
```
|
|
898
823
|
|
|
824
|
+
## Styling
|
|
825
|
+
|
|
899
826
|
Select is an [Input](./input.md) plus a [Menu](./menu.md), so it
|
|
900
827
|
inherits both surfaces' hooks. Reach for props first, then plain CSS or `::part` for
|
|
901
828
|
the rest. Don't override an element's internal `--*` output tokens.
|
|
@@ -13,6 +13,9 @@ decreases it. The thumb does not move to the point where the rail was pressed.
|
|
|
13
13
|
Set `trackClick="jump"` to move the thumb to the pressed position before
|
|
14
14
|
dragging, as a native range input does.
|
|
15
15
|
|
|
16
|
+
Releasing the pointer or losing pointer capture ends the drag. Moving back over
|
|
17
|
+
the slider without pressing leaves its value unchanged.
|
|
18
|
+
|
|
16
19
|
Arrow keys change by `step`. Home and End set the minimum and maximum. PageUp and PageDown move by one tenth of the range.
|
|
17
20
|
|
|
18
21
|
```tsx
|
|
@@ -59,43 +62,35 @@ Arrow keys change by `step`. Home and End set the minimum and maximum. PageUp an
|
|
|
59
62
|
/>
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
## Component props
|
|
63
66
|
|
|
64
67
|
| Prop | Type | Default | Description |
|
|
65
68
|
|------|------|---------|-------------|
|
|
66
69
|
| `defaultValue?` | number | 0 | Initial uncontrolled value. |
|
|
67
70
|
| `disabled?` | boolean | — | Disables pointer and keyboard interaction. |
|
|
68
|
-
| `label?` | ReactNode | — | Visible field label, shown above the rail. A string supplies the slider's
|
|
69
|
-
|
|
70
|
-
| `markers?` | SliderMarker[] | — | Compact text labels positioned below the rail. They do not add dots or
|
|
71
|
-
ticks to the rail. |
|
|
71
|
+
| `label?` | ReactNode | — | Visible field label, shown above the rail. A string supplies the slider's accessible name; give a rich label an explicit `aria-label`. |
|
|
72
|
+
| `markers?` | SliderMarker[] | — | Compact text labels positioned below the rail. They do not add dots or ticks to the rail. |
|
|
72
73
|
| `max?` | number | 100 | Highest permitted value. |
|
|
73
74
|
| `min?` | number | 0 | Lowest permitted value. |
|
|
74
75
|
| `name?` | string | — | Form field name. The current numeric value submits under this name. |
|
|
75
76
|
| `onValueChange?` | (event, attrs) => void | — | Fires on every keyboard or pointer value change. |
|
|
76
77
|
| `onValueCommit?` | (event, attrs) => void | — | Fires after a drag ends and after each keyboard value change. |
|
|
77
|
-
| `round?` | boolean \| number \| string | — | Fully round the rail and thumb. Pass a number (px) or CSS length string
|
|
78
|
-
for a shared custom radius. |
|
|
78
|
+
| `round?` | boolean \| number \| string | — | Fully round the rail and thumb. Pass a number (px) or CSS length string for a shared custom radius. |
|
|
79
79
|
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size variant. small=24px, medium=28px, large=32px tall. |
|
|
80
80
|
| `step?` | number | 1 | Smallest keyboard and drag increment. |
|
|
81
|
-
| `thumbFill?` | boolean | false | Fill the thumb with its resolved border color. This follows `thumbTone`
|
|
82
|
-
|
|
83
|
-
| `
|
|
84
|
-
|
|
85
|
-
| `
|
|
86
|
-
|
|
87
|
-
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Color of the filled rail. Pass a named tone or a literal CSS color for a
|
|
88
|
-
one-off custom tone. The unfilled rail stays neutral. |
|
|
89
|
-
| `trackClick?` | 'drag-only' \| 'jump' | 'drag-only' | Controls what happens when the rail is pressed. `drag-only` starts dragging
|
|
90
|
-
from the current value. `jump` first moves to the pressed position. |
|
|
91
|
-
| `trackSize?` | number \| string | 2 | Thickness of both rail segments. Numbers use pixels; strings are CSS
|
|
92
|
-
lengths. Keep it no larger than the thumb diameter. |
|
|
81
|
+
| `thumbFill?` | boolean | false | Fill the thumb with its resolved border color. This follows `thumbTone` and interactive states. |
|
|
82
|
+
| `thumbSize?` | number \| string | 16 | Diameter of the thumb. Numbers use pixels; strings are CSS lengths. Keep it at least as large as `trackSize`. |
|
|
83
|
+
| `thumbTone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Color of the thumb stroke. Pass a named tone or a literal CSS color for a one-off custom tone. Omit it to keep the thumb neutral. |
|
|
84
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Color of the filled rail. Pass a named tone or a literal CSS color for a one-off custom tone. The unfilled rail stays neutral. |
|
|
85
|
+
| `trackClick?` | 'drag-only' \| 'jump' | 'drag-only' | Controls what happens when the rail is pressed. `drag-only` starts dragging from the current value. `jump` first moves to the pressed position. |
|
|
86
|
+
| `trackSize?` | number \| string | 2 | Thickness of both rail segments. Numbers use pixels; strings are CSS lengths. Keep it no larger than the thumb diameter. |
|
|
93
87
|
| `value?` | number | — | Controlled value. Update it from `onValueChange`. |
|
|
94
|
-
| `valueDisplay?` | 'end' \| 'inline' \| 'thumb' \| 'none' | 'end' | Where the live value appears. `end` puts it at the right edge of the label
|
|
95
|
-
row. `inline` renders `Label: value`. `thumb` keeps it above the thumb. |
|
|
88
|
+
| `valueDisplay?` | 'end' \| 'inline' \| 'thumb' \| 'none' | 'end' | Where the live value appears. `end` puts it at the right edge of the label row. `inline` renders `Label: value`. `thumb` keeps it above the thumb. |
|
|
96
89
|
| `valuePrefix?` | string | — | Text inserted before the live numeric value, such as `$`. |
|
|
97
90
|
| `valueSuffix?` | string | — | Text inserted after the live numeric value, such as `%` or `°C`. |
|
|
98
91
|
|
|
92
|
+
## Web Component
|
|
93
|
+
|
|
99
94
|
Use `<a-slider>` when you are not using React or Preact. Add its `role` and accessible name yourself, then register it from `@antadesign/anta/elements`.
|
|
100
95
|
|
|
101
96
|
```html
|
package/docs/components/steps.md
CHANGED
|
@@ -225,6 +225,8 @@ the next step.
|
|
|
225
225
|
</Steps>
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
+
## Keyboard and accessibility
|
|
229
|
+
|
|
228
230
|
Pass `label` to name the tablist. Arrow keys follow the orientation; `Home` and
|
|
229
231
|
`End` move to the edges; `Enter` and `Space` activate a focused step. Disabled
|
|
230
232
|
steps are skipped.
|
|
@@ -242,17 +244,43 @@ Events match [`Tabs`](./tabs.md#events).
|
|
|
242
244
|
| `onChange(event)` | After selection | No | Native `change` event |
|
|
243
245
|
| `onValueChange(event, { value })` | After selection | No | Selected value |
|
|
244
246
|
|
|
247
|
+
## Steps props
|
|
248
|
+
|
|
245
249
|
| Prop | Type | Default | Description |
|
|
246
250
|
|------|------|---------|-------------|
|
|
247
251
|
| `options` | StepOption[] | — | Ordered process phases. |
|
|
248
|
-
| `
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
| `
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
| `
|
|
255
|
-
|
|
252
|
+
| `children?` | ReactNode | — | Optional `<TabPanel value="…">` panels, one per tab value. Each is a self-managing `<a-tabpanel>` that shows itself when its `value` is the active tab. Omit them to use `Tabs` as a bare selectable strip. To place panels in a different layout region, or to unmount an inactive panel, drive selection with a controlled `value` and render the content yourself (see the docs). |
|
|
253
|
+
| `defaultValue?` | string | — | Initial active value for the uncontrolled case. After first render `Tabs` owns selection itself. |
|
|
254
|
+
| `disabled?` | boolean | — | Disable the whole strip. |
|
|
255
|
+
| `fill?` | boolean | false | Makes horizontal tabs share the available inline space equally. |
|
|
256
|
+
| `label?` | string | — | Accessible name for the tablist (`aria-label`). |
|
|
257
|
+
| `onBlur?` | (event) => void | — | Focus left the strip entirely — wired to `focusout`. |
|
|
258
|
+
| `onChange?` | (event) => void | — | Fired *after* the active tab changes — a native `change` event. |
|
|
259
|
+
| `onFocus?` | (event) => void | — | Focus entered the strip (any tab) — wired to `focusin` (focus lands on a tab, not the tablist). |
|
|
260
|
+
| `onStateChange?` | (event, detail) => void | — | Fired whenever the active tab changes — event-first. `detail` is `{ next, prev }` (values; `null` = none). Cancelable: `event.preventDefault()` vetoes it (uncontrolled), or in controlled mode answer by updating `value`. |
|
|
261
|
+
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ value }` snapshot as the 2nd argument. |
|
|
262
|
+
| `orientation?` | 'horizontal' \| 'vertical' | 'horizontal' | Layout + arrow-key axis. Horizontal ellipsizes labels when tabs overflow (scroll is opt-in via CSS); vertical stacks them. |
|
|
263
|
+
| `priority?` | StepPriority | 'secondary' | Visual emphasis. Primary uses a solid selected marker and a stronger completed connector; secondary is the outlined default; tertiary is compact and borderless. |
|
|
264
|
+
| `renderMarker?` | (option, state) => ReactNode | — | Builds a custom marker from a step and its current state. A returned node replaces `marker` and the built-in state marker; return `undefined` to use those fallbacks, or `null` for an empty ring. |
|
|
265
|
+
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size — small 24px · medium 28px · large 32px tall, matching Button's scale (the tab's label leading runs a touch tighter, offset by 1px more block padding per side). |
|
|
266
|
+
| `tone?` | StepTone \| '' | 'neutral' | Tone applied to every step without its own `tone`. Error steps stay critical and disabled steps stay neutral. |
|
|
267
|
+
| `value?` | string | — | Controlled active value — the tab `value` to mark selected (and, when a `<TabPanel value="…">` shares it, the panel to reveal). When set, you own selection: the strip renders exactly what this says, and a user pick only *requests* a change via `onStateChange` — apply it by updating this prop. Leave undefined (and use `defaultValue`) for uncontrolled. |
|
|
268
|
+
|
|
269
|
+
## Step option props
|
|
270
|
+
|
|
271
|
+
| Prop | Type | Default | Description |
|
|
272
|
+
|------|------|---------|-------------|
|
|
273
|
+
| `label` | ReactNode | — | Visible phase label. It ellipsizes in a constrained step; its full content is available in a tooltip only when clipped. |
|
|
274
|
+
| `state` | StepState | — | Application-owned process state. Selection and availability are separate; `error` keeps a critical icon and outline, and selection adds the fill. |
|
|
275
|
+
| `value` | string | — | Stable phase identity. Values must be unique within the sequence. |
|
|
276
|
+
| `className?` | string | — | CSS class on the option's rendered row. |
|
|
277
|
+
| `disabled?` | boolean | — | Disables this phase. A custom `marker` or `renderMarker` result is kept; otherwise it uses the incomplete marker. |
|
|
278
|
+
| `hint?` | ReactNode | — | Secondary text shown below the label. It ellipsizes in a constrained step; its full content is available in a tooltip only when clipped. |
|
|
279
|
+
| `marker?` | StepMarker | — | Replaces the marker derived from `state`. A number is shown directly; an Anta icon shape is rendered as an `<Icon>`. |
|
|
280
|
+
| `style?` | CSSProperties | — | Inline styles on the option's rendered row. |
|
|
281
|
+
| `tone?` | StepTone \| '' | inherits Steps `tone | Tone for this phase. It colors the label, hint, marker, and completed connector. Overrides the Steps `tone`; error steps stay critical and disabled steps stay neutral. |
|
|
282
|
+
|
|
283
|
+
## Web Component
|
|
256
284
|
|
|
257
285
|
For framework-free use, compose the same light DOM that `Steps` emits.
|
|
258
286
|
`a-steps` and its `a-step-*` children are structural elements styled by the
|
|
@@ -288,6 +316,8 @@ import '@antadesign/anta/components/Steps.css'
|
|
|
288
316
|
</div>
|
|
289
317
|
```
|
|
290
318
|
|
|
319
|
+
## Styling
|
|
320
|
+
|
|
291
321
|
Use `priority`, `size`, and `orientation` first. Set `tone` on each option. Each
|
|
292
322
|
option also accepts `className`, `style`, and `data-*` attributes. Markers are
|
|
293
323
|
light DOM; connectors are pseudo-elements.
|
|
@@ -123,33 +123,28 @@ The wrapper sets `role="switch"` and keeps `aria-checked` in sync with the curre
|
|
|
123
123
|
|
|
124
124
|
Space toggles the switch. It follows the [WAI-ARIA switch pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/).
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
## Component props
|
|
127
127
|
|
|
128
128
|
| Prop | Type | Default | Description |
|
|
129
129
|
|------|------|---------|-------------|
|
|
130
130
|
| `checked?` | boolean | — | Controlled checked value. In controlled mode, update this in `onStateChange`. |
|
|
131
131
|
| `defaultChecked?` | boolean | false | Initial checked value for an uncontrolled switch. |
|
|
132
132
|
| `disabled?` | boolean | — | Disables interaction and removes the switch from the tab order. |
|
|
133
|
-
| `hint?` | ReactNode | — | Secondary text rendered under the label. It does not become part of the
|
|
134
|
-
accessible name. |
|
|
133
|
+
| `hint?` | ReactNode | — | Secondary text rendered under the label. It does not become part of the accessible name. |
|
|
135
134
|
| `label?` | string | — | Visible, stable label for the setting. Use `children` for richer label content. |
|
|
136
|
-
| `labelPosition?` | 'start' \| 'end' | 'end' | Put the visible label before or after the control. Grid layout changes only
|
|
137
|
-
the visual order, preserving DOM/source order for assistive technologies. |
|
|
135
|
+
| `labelPosition?` | 'start' \| 'end' | 'end' | Put the visible label before or after the control. Grid layout changes only the visual order, preserving DOM/source order for assistive technologies. |
|
|
138
136
|
| `name?` | string | — | Form field name. A checked switch submits `value` under this name. |
|
|
139
137
|
| `onChange?` | (event) => void | — | Native post-apply `change` event. |
|
|
140
|
-
| `onStateChange?` | (event, detail) => void | — | Fired before a user toggle applies. Call `event.preventDefault()` to veto an
|
|
141
|
-
uncontrolled change; controlled consumers accept by updating `checked`. |
|
|
138
|
+
| `onStateChange?` | (event, detail) => void | — | Fired before a user toggle applies. Call `event.preventDefault()` to veto an uncontrolled change; controlled consumers accept by updating `checked`. |
|
|
142
139
|
| `onValueChange?` | (event, attrs) => void | — | Post-apply callback with the new form-relevant value snapshot. |
|
|
143
|
-
| `round?` | boolean \| number \| string | — | Fully round the thumb and track. Pass a `number` (px) or CSS length string
|
|
144
|
-
for a custom track radius; the thumb radius is 3px smaller. |
|
|
140
|
+
| `round?` | boolean \| number \| string | — | Fully round the thumb and track. Pass a `number` (px) or CSS length string for a custom track radius; the thumb radius is 3px smaller. |
|
|
145
141
|
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size variant. small=26×16px, medium=30×18px, large=34×20px. |
|
|
146
|
-
| `tone?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'brand' | Color of the track and thumb. A tinted tone also colors the unchecked
|
|
147
|
-
track
|
|
148
|
-
| `toneSelected?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'brand' | Like `tone`, but applies only while the switch is checked. The unchecked
|
|
149
|
-
track and thumb stay neutral. If both are set, `tone` colors the unchecked
|
|
150
|
-
state and `toneSelected` colors the checked track. |
|
|
142
|
+
| `tone?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'brand' | Color of the track and thumb. A tinted tone also colors the unchecked track border and thumb; use `toneSelected` to color only the checked track. |
|
|
143
|
+
| `toneSelected?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'brand' | Like `tone`, but applies only while the switch is checked. The unchecked track and thumb stay neutral. If both are set, `tone` colors the unchecked state and `toneSelected` colors the checked track. |
|
|
151
144
|
| `value?` | string | "on" | Value submitted while checked. |
|
|
152
145
|
|
|
146
|
+
## Web Component
|
|
147
|
+
|
|
153
148
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
154
149
|
|
|
155
150
|
The focusable host carries the state. Label and hint are light-DOM children.
|
|
@@ -161,6 +156,8 @@ The focusable host carries the state. Label and hint are light-DOM children.
|
|
|
161
156
|
</a-switch>
|
|
162
157
|
```
|
|
163
158
|
|
|
159
|
+
## Styling
|
|
160
|
+
|
|
164
161
|
Reach for the props first: **`tone`** colors the checked track plus the unchecked chrome, while **`toneSelected`** colors only the checked track. Both accept any CSS color; **`size`** scales the control, label, and hint. The focus ring is the global [`--focus-ring`](../colors.md#focus-ring).
|
|
165
162
|
|
|
166
163
|
```tsx
|
package/docs/components/tabs.md
CHANGED
|
@@ -166,6 +166,8 @@ its value is active. The panel names its tab as its accessible label
|
|
|
166
166
|
Panels are **optional**. Without panels, `Tabs` renders the strip. Listen to
|
|
167
167
|
`onStateChange` / `onValueChange` and render the content yourself.
|
|
168
168
|
|
|
169
|
+
### JSX vs DOM
|
|
170
|
+
|
|
169
171
|
The strip renders from the `options` array; each `<TabPanel>` renders a
|
|
170
172
|
self-managing `<a-tabpanel>`. `Tabs` **never reads or toggles the panels**: there's
|
|
171
173
|
no child introspection, so it renders the same in static SSR and works with any
|
|
@@ -196,6 +198,8 @@ and shows/hides **itself** via its own off-DOM `:state(active)`; nothing writes
|
|
|
196
198
|
writes the light DOM, only your JSX does, which keeps a worker-thread reactive engine
|
|
197
199
|
in sync.
|
|
198
200
|
|
|
201
|
+
### Hiding an inactive panel
|
|
202
|
+
|
|
199
203
|
A `<TabPanel>` stays mounted while inactive (its DOM, form values, and scroll
|
|
200
204
|
survive tab switches); `hideMode` picks how it hides:
|
|
201
205
|
|
|
@@ -265,6 +269,8 @@ const [tab, setTab] = useState('overview')
|
|
|
265
269
|
/>
|
|
266
270
|
```
|
|
267
271
|
|
|
272
|
+
## Keyboard & accessibility
|
|
273
|
+
|
|
268
274
|
Every enabled tab is in the tab order; `Tab` / `Shift`+`Tab` step through them.
|
|
269
275
|
The arrow keys also move between enabled tabs (wrapping at the ends), `Home` /
|
|
270
276
|
`End` jump to the first / last, and `Space` / `Enter` activate the focused tab;
|
|
@@ -275,6 +281,8 @@ Pass `label` for the tablist's accessible name. Each `<TabPanel>` names its tab
|
|
|
275
281
|
its accessible label (`aria-labelledby`), set off-DOM so nothing writes the panel's
|
|
276
282
|
attributes.
|
|
277
283
|
|
|
284
|
+
## Routing
|
|
285
|
+
|
|
278
286
|
`Tabs` reports the picked value and leaves navigation to the app, so a strip can
|
|
279
287
|
switch routes as readily as panels. Treat each `value` as a path: control `value`
|
|
280
288
|
from the current location and navigate in `onStateChange` (the pick fires *on click*;
|
|
@@ -319,54 +327,56 @@ so those suit an uncontrolled strip reacting to its own pick. **`onFocus`** /
|
|
|
319
327
|
<Tabs defaultValue="a" onValueChange={(_e, { value }) => route(value)}>…</Tabs>
|
|
320
328
|
```
|
|
321
329
|
|
|
330
|
+
## Tabs props
|
|
331
|
+
|
|
322
332
|
| Prop | Type | Default | Description |
|
|
323
333
|
|------|------|---------|-------------|
|
|
324
|
-
| `children?` | ReactNode | — | Optional `<TabPanel value="…">` panels, one per tab value. Each is a
|
|
325
|
-
|
|
326
|
-
tab. Omit them to use `Tabs` as a bare selectable strip. To place panels in a
|
|
327
|
-
different layout region, or to unmount an inactive panel, drive selection with
|
|
328
|
-
a controlled `value` and render the content yourself (see the docs). |
|
|
329
|
-
| `defaultValue?` | string | — | Initial active value for the uncontrolled case. After first render `Tabs`
|
|
330
|
-
owns selection itself. |
|
|
334
|
+
| `children?` | ReactNode | — | Optional `<TabPanel value="…">` panels, one per tab value. Each is a self-managing `<a-tabpanel>` that shows itself when its `value` is the active tab. Omit them to use `Tabs` as a bare selectable strip. To place panels in a different layout region, or to unmount an inactive panel, drive selection with a controlled `value` and render the content yourself (see the docs). |
|
|
335
|
+
| `defaultValue?` | string | — | Initial active value for the uncontrolled case. After first render `Tabs` owns selection itself. |
|
|
331
336
|
| `disabled?` | boolean | — | Disable the whole strip. |
|
|
332
337
|
| `fill?` | boolean | false | Makes horizontal tabs share the available inline space equally. |
|
|
333
338
|
| `label?` | string | — | Accessible name for the tablist (`aria-label`). |
|
|
334
|
-
| `noslide?` | boolean | — | Disable the sliding indicator. By default the selected-tab indicator animates
|
|
335
|
-
between tabs (a single rectangle, via CSS anchor positioning); `noslide` paints it
|
|
336
|
-
per tab so it snaps with no movement. (Browsers without anchor positioning get that
|
|
337
|
-
per-tab paint automatically — `noslide` is the explicit opt-out.) |
|
|
339
|
+
| `noslide?` | boolean | — | Disable the sliding indicator. By default the selected-tab indicator animates between tabs (a single rectangle, via CSS anchor positioning); `noslide` paints it per tab so it snaps with no movement. (Browsers without anchor positioning get that per-tab paint automatically — `noslide` is the explicit opt-out.) |
|
|
338
340
|
| `onBlur?` | (event) => void | — | Focus left the strip entirely — wired to `focusout`. |
|
|
339
341
|
| `onChange?` | (event) => void | — | Fired *after* the active tab changes — a native `change` event. |
|
|
340
|
-
| `onFocus?` | (event) => void | — | Focus entered the strip (any tab) — wired to `focusin` (focus lands on a tab,
|
|
341
|
-
|
|
342
|
-
| `onStateChange?` | (event, detail) => void | — | Fired whenever the active tab changes — event-first. `detail` is
|
|
343
|
-
`{ next, prev }` (values; `null` = none). Cancelable: `event.preventDefault()`
|
|
344
|
-
vetoes it (uncontrolled), or in controlled mode answer by updating `value`. |
|
|
342
|
+
| `onFocus?` | (event) => void | — | Focus entered the strip (any tab) — wired to `focusin` (focus lands on a tab, not the tablist). |
|
|
343
|
+
| `onStateChange?` | (event, detail) => void | — | Fired whenever the active tab changes — event-first. `detail` is `{ next, prev }` (values; `null` = none). Cancelable: `event.preventDefault()` vetoes it (uncontrolled), or in controlled mode answer by updating `value`. |
|
|
345
344
|
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ value }` snapshot as the 2nd argument. |
|
|
346
|
-
| `options?` | TabOption[] | — | The tabs, as a data array (the strip's single source). Each entry is a
|
|
347
|
-
`
|
|
348
|
-
`
|
|
349
|
-
|
|
350
|
-
| `
|
|
351
|
-
|
|
352
|
-
| `
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
`
|
|
360
|
-
|
|
361
|
-
| `
|
|
362
|
-
|
|
363
|
-
| `
|
|
364
|
-
|
|
365
|
-
| `
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
345
|
+
| `options?` | TabOption[] | — | The tabs, as a data array (the strip's single source). Each entry is a `TabOption` (`value`, `label` or `children`, `icon`, `iconTrailing`, `tone`, `disabled`, `round`, `className`, `style`). `className` and `style` land on that option's individual `<a-tab>`, not on the strip. |
|
|
346
|
+
| `orientation?` | 'horizontal' \| 'vertical' | 'horizontal' | Layout + arrow-key axis. Horizontal ellipsizes labels when tabs overflow (scroll is opt-in via CSS); vertical stacks them. |
|
|
347
|
+
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'primary' | Visual priority. `primary` is the raised pill on a recessed track (the segmented-control look); `secondary` keeps that sizing but drops the track, marking the selected tab with a subtle active background fill; `tertiary` is a bottom-underline indicator under the selected tab (no track, no rest line). `tone` colors `secondary` + `tertiary`; `primary` stays neutral. |
|
|
348
|
+
| `round?` | boolean \| number \| string | — | Fully-round the tabs and the sliding indicator (and the primary track well). Applies strip-wide; a single tab's `round` rounds just that tab. A `number` (px) or CSS length string sets a custom radius on the top-level track well only — the tab pills + indicator stay fully round. |
|
|
349
|
+
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size — small 24px · medium 28px · large 32px tall, matching Button's scale (the tab's label leading runs a touch tighter, offset by 1px more block padding per side). |
|
|
350
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Tone applied to the selected indicator/label, or any literal CSS color for a one-off custom tone (derived in oklch). Named tones track light/dark. |
|
|
351
|
+
| `value?` | string | — | Controlled active value — the tab `value` to mark selected (and, when a `<TabPanel value="…">` shares it, the panel to reveal). When set, you own selection: the strip renders exactly what this says, and a user pick only *requests* a change via `onStateChange` — apply it by updating this prop. Leave undefined (and use `defaultValue`) for uncontrolled. |
|
|
352
|
+
|
|
353
|
+
## Tab option props
|
|
354
|
+
|
|
355
|
+
| Prop | Type | Default | Description |
|
|
356
|
+
|------|------|---------|-------------|
|
|
357
|
+
| `value` | string | — | This tab's identity — pairs it with the `<TabPanel value="…">` of the same value, and the value reported by `onStateChange` / `onChange`. Unique per strip. |
|
|
358
|
+
| `children?` | ReactNode | — | Tab content when you need more than a string — used if `label` is omitted. |
|
|
359
|
+
| `className?` | string | — | CSS class on the option's rendered row. |
|
|
360
|
+
| `disabled?` | boolean | — | Disable just this tab — skipped by keyboard nav and dropped from the tab order (a disabled-but-selected tab stays reachable, per the ARIA pattern). |
|
|
361
|
+
| `icon?` | IconShape | — | Leading icon shape, rendered before the label. |
|
|
362
|
+
| `iconTrailing?` | IconShape | — | Trailing icon shape, rendered after the label. |
|
|
363
|
+
| `label?` | ReactNode | — | Visible label. The string shorthand for the tab's content; for richer content pass `children` instead (`label` wins when both are set). |
|
|
364
|
+
| `round?` | boolean | — | Fully-round just this tab's box. `<Tabs round>` rounds the whole strip (tabs + sliding indicator) instead. |
|
|
365
|
+
| `style?` | CSSProperties | — | Inline styles on the option's rendered row. |
|
|
366
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | inherits the strip's `tone | Per-tab tone override, same vocabulary as `<Tabs tone>` — colors this one tab's label + icons (all priorities/modes, named or custom color) and, when it's the active tab, its indicator. For a **custom literal color** the sliding indicator can't adopt it (the shared moving element can't read a descendant's color), so a custom tone colors the label everywhere and the indicator only in `noslide`; the six **named** tones color both in every mode. Overrides the strip's `tone` for this tab. |
|
|
367
|
+
| `tooltip?` | ReactNode | — | Tooltip for this tab — a string or any node — shown **only when one of the tab's ellipsizing label parts is truncated** (tabs ellipsize when the strip overflows), so clipped content reveals its full text on hover while a tab that fits shows nothing. Rendered as a `truncatedOnly` `<Tooltip>` anchored to the tab. For an always-visible tooltip or other custom trigger content, use `children` with your own `<Tooltip>` instead. |
|
|
368
|
+
|
|
369
|
+
## TabPanel props
|
|
370
|
+
|
|
371
|
+
| Prop | Type | Default | Description |
|
|
372
|
+
|------|------|---------|-------------|
|
|
373
|
+
| `value` | string | — | Pairs this panel with the tab (`options` entry) of the same `value`. |
|
|
374
|
+
| `children?` | ReactNode | — | Panel content — arbitrary React/Preact. |
|
|
375
|
+
| `className?` | string | — | CSS class on the rendered `<a-tabpanel>`. |
|
|
376
|
+
| `hideMode?` | 'display' \| 'visibility' | display | How this panel hides while inactive: `display` (default — removed from layout and the a11y tree) or `visibility` (keeps its layout box, to measure it or avoid reflow). Both stay mounted; to *not render* an inactive panel, render it conditionally off a controlled `value` (see the Tabs docs). |
|
|
377
|
+
| `style?` | CSSProperties | — | Inline style on the rendered `<a-tabpanel>`. |
|
|
378
|
+
|
|
379
|
+
## Web Component
|
|
370
380
|
|
|
371
381
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
372
382
|
|
|
@@ -386,6 +396,8 @@ Add `fill` to make horizontal tabs share the available width equally.
|
|
|
386
396
|
</div>
|
|
387
397
|
```
|
|
388
398
|
|
|
399
|
+
## Styling
|
|
400
|
+
|
|
389
401
|
Reach for the props first: **`tone`**, **`size`**, **`priority`**. The focus ring is
|
|
390
402
|
the global `--focus-ring` (see [Colors](../colors.md#focus-ring)).
|
|
391
403
|
|
package/docs/components/tag.md
CHANGED
|
@@ -117,33 +117,20 @@ down 1px, since caps read larger than mixed case at the same size.
|
|
|
117
117
|
<Tag allcaps label="Running" />
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
## Component props
|
|
121
121
|
|
|
122
122
|
| Prop | Type | Default | Description |
|
|
123
123
|
|------|------|---------|-------------|
|
|
124
|
-
| `allcaps?` | boolean | — | Render in all-caps instead of the default normal (mixed) case
|
|
125
|
-
(uppercase tracks wider than the default body-text letter-spacing). |
|
|
124
|
+
| `allcaps?` | boolean | — | Render in all-caps instead of the default normal (mixed) case (uppercase tracks wider than the default body-text letter-spacing). |
|
|
126
125
|
| `icon?` | IconShape | — | Leading icon shape. Sits flush before the label, scaled to the pill. |
|
|
127
126
|
| `iconTrailing?` | IconShape | — | Trailing icon shape. Renders last, after the value. |
|
|
128
|
-
| `label?` | string | — | A short "key" shown before the value. When paired with `value` it
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
| `
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
| `size?` | 'small' \| 'medium' \| 'large' | medium | Size variant. `small` = 16px tall, `medium` = 20px, `large` = 24px
|
|
136
|
-
(matching `Button`). Omit the attribute or pass `'medium'` for the
|
|
137
|
-
default — both render identically and emit no DOM attribute. |
|
|
138
|
-
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`)
|
|
139
|
-
for a one-off custom tone. Each tone renders the secondary tag style:
|
|
140
|
-
`--text-3-{tone}` text over an alpha tint of the tone's hue (fill + a
|
|
141
|
-
slightly stronger hairline border). A custom color is tinted the same
|
|
142
|
-
way, with the text deepened to a readable foreground. `'neutral'` (the
|
|
143
|
-
default) is the gray tag — the same as omitting `tone`. |
|
|
144
|
-
| `value?` | string | — | The tag's primary text — a status, count, version, duration, etc.
|
|
145
|
-
Rendered in the default color and weight, with no divider from the
|
|
146
|
-
label; the color + weight contrast does the separating. |
|
|
127
|
+
| `label?` | string | — | A short "key" shown before the value. When paired with `value` it renders bold (weight 600), same color. On its own (no `value`) it's treated as the tag's primary text and keeps the default styling. |
|
|
128
|
+
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | secondary | Emphasis level. `secondary` (the default) is the subtle alpha-tint fill; `primary` is a solid fill with white text; `tertiary` is a transparent outline. Omitting it (or passing `'secondary'`) renders the default and emits no DOM attribute. |
|
|
129
|
+
| `size?` | 'small' \| 'medium' \| 'large' | medium | Size variant. `small` = 16px tall, `medium` = 20px, `large` = 24px (matching `Button`). Omit the attribute or pass `'medium'` for the default — both render identically and emit no DOM attribute. |
|
|
130
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone. Each tone renders the secondary tag style: `--text-3-{tone}` text over an alpha tint of the tone's hue (fill + a slightly stronger hairline border). A custom color is tinted the same way, with the text deepened to a readable foreground. `'neutral'` (the default) is the gray tag — the same as omitting `tone`. |
|
|
131
|
+
| `value?` | string | — | The tag's primary text — a status, count, version, duration, etc. Rendered in the default color and weight, with no divider from the label; the color + weight contrast does the separating. |
|
|
132
|
+
|
|
133
|
+
## Web Component
|
|
147
134
|
|
|
148
135
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
149
136
|
|
|
@@ -157,6 +144,8 @@ Use `a-tag-label` for the key and `a-tag-value` for its value.
|
|
|
157
144
|
</a-tag>
|
|
158
145
|
```
|
|
159
146
|
|
|
147
|
+
## Styling
|
|
148
|
+
|
|
160
149
|
Reach for the props first: **`tone`** sets the color (any CSS color for a custom
|
|
161
150
|
tone — it derives the fill / border / text in oklch), **`priority`** the fill style,
|
|
162
151
|
**`size`** the dimensions.
|