@antadesign/anta 0.3.26 → 0.3.28
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 +8 -0
- package/dist/anta_helpers.js +18 -0
- package/dist/box-types.d.ts +1 -1
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +36 -42
- package/dist/capture-types.d.ts +156 -0
- package/dist/components/Banner.js +2 -2
- package/dist/components/Box.d.ts +15 -0
- package/dist/components/Box.js +3 -11
- package/dist/components/Button.js +2 -2
- package/dist/components/Capture.d.ts +39 -0
- package/dist/components/Capture.js +36 -0
- package/dist/components/Card.js +2 -2
- package/dist/components/Checkbox.d.ts +10 -11
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/Expander.js +2 -2
- package/dist/components/Input.js +2 -2
- package/dist/components/InputTime.js +2 -2
- package/dist/components/Loader.js +2 -1
- package/dist/components/MenuItem.d.ts +7 -8
- package/dist/components/MenuItem.js +4 -4
- package/dist/components/Progress.js +2 -2
- package/dist/components/RadioGroup.d.ts +12 -13
- package/dist/components/RadioGroup.js +7 -23
- package/dist/components/Select.d.ts +12 -7
- package/dist/components/Select.js +4 -3
- package/dist/components/SelectFaceted.d.ts +7 -5
- package/dist/components/SelectFaceted.js +4 -3
- package/dist/components/Slider.js +3 -3
- package/dist/components/Steps.css +1 -1
- package/dist/components/Switch.d.ts +7 -8
- package/dist/components/Switch.js +3 -11
- package/dist/components/Tabs.js +2 -2
- package/dist/components/Tag.d.ts +7 -9
- package/dist/components/Tag.js +2 -2
- package/dist/components/Text.js +2 -2
- package/dist/components/Title.js +2 -2
- package/dist/components/capture-props.d.ts +30 -0
- package/dist/components/capture-props.js +44 -0
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-box.d.ts +1 -1
- package/dist/elements/a-box.js +11 -3
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +7 -9
- package/dist/elements/a-calendar.css +1 -1
- 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-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-checkbox.js +4 -4
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.js +1 -0
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.js +5 -7
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +4 -6
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-slider.js +6 -9
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-text.js +1 -0
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +3 -4
- package/dist/elements/a-tooltip.js +0 -1
- 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 +56 -23
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +2 -1
- package/dist/reset.css +1 -1
- package/dist/theme-antithesis.css +1 -0
- package/dist/theme-antune.css +1 -0
- package/dist/tokens.css +1 -1
- package/docs/accessibility.md +24 -0
- package/docs/changelog.md +79 -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 +49 -12
- 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 +27 -50
- 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 +75 -80
- package/docs/components/progress.md +10 -14
- package/docs/components/radio.md +28 -46
- package/docs/components/select-faceted.md +8 -25
- package/docs/components/select.md +33 -105
- package/docs/components/slider.md +16 -21
- package/docs/components/steps.md +38 -8
- package/docs/components/switch.md +16 -19
- package/docs/components/tabs.md +52 -40
- package/docs/components/tag.md +15 -24
- 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 +42 -8
- package/docs/normalization.md +48 -3
- package/docs/packages/stickers.md +56 -0
- package/docs/theming.md +362 -14
- package/package.json +7 -4
- package/dist/components/InputDate.module.css +0 -1
- package/dist/components/Select.module.css +0 -1
- package/dist/components/SelectFaceted.module.css +0 -1
- package/dist/theme-anta.css +0 -1
- /package/dist/{search-index.json → capture-types.js} +0 -0
package/docs/components/card.md
CHANGED
|
@@ -206,52 +206,29 @@ it also blocks navigation until the load resolves.
|
|
|
206
206
|
</Card>
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
## Component props
|
|
210
210
|
|
|
211
211
|
| Prop | Type | Default | Description |
|
|
212
212
|
|------|------|---------|-------------|
|
|
213
|
-
| `children?` | ReactNode | — | The card body. A string is wrapped in a `<Text>` at secondary priority,
|
|
214
|
-
|
|
215
|
-
| `
|
|
216
|
-
|
|
217
|
-
| `
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
(`<Title level={2}>`, an `<h2>`) for a different level or styling. Omit for
|
|
221
|
-
no header. |
|
|
222
|
-
| `href?` | string | — | Turn the whole card into a link. The card renders a focusable anchor and its
|
|
223
|
-
accessible name comes from `header` → body → this URL (override with
|
|
224
|
-
`aria-label`). A link card is display content — don't nest interactive
|
|
225
|
-
controls inside it. |
|
|
226
|
-
| `icon?` | (string & {}) \| string \| number \| bigint \| boolean \| ReactElement \| Iterable \| ReactPortal \| Promise \| null | — | Leading visual for the header, laid out to the left of the `header` /
|
|
227
|
-
`subtitle` as one aligned row (so it doesn't sit inline in the title, where it
|
|
228
|
-
mis-aligns). A **string** is an icon shape, rendered as an `<Icon>` inside a
|
|
229
|
-
circular chip (sized per the card via `--card-icon-size`); pass an `<img>`,
|
|
230
|
-
initials (`<Text>`), or any node to use it as-is. Omit for none. |
|
|
231
|
-
| `loading?` | boolean | — | Loading state — dims the card with a skeleton pulse, sets `aria-busy`, and (in
|
|
232
|
-
link mode) blocks navigation. |
|
|
233
|
-
| `media?` | ReactNode | — | Media (image, illustration) rendered full-bleed to the card edge, clipped to
|
|
234
|
-
its corners. Position it with `mediaPosition`. |
|
|
213
|
+
| `children?` | ReactNode | — | The card body. A string is wrapped in a `<Text>` at secondary priority, following the card's `tone` and `size`; pass your own nodes to take over. |
|
|
214
|
+
| `footer?` | ReactNode | — | Footer content, usually action buttons. Rendered as a **left-aligned** row (wraps under pressure) — the opposite of `Dialog`'s right-aligned footer. |
|
|
215
|
+
| `header?` | ReactNode | — | Header content, in the top zone. A string is wrapped in a `<Title>` — a real heading in the document outline, tinted to match `tone`, at a level that tracks `size` (small → 5, medium → 4, large → 3). Pass your own node (`<Title level={2}>`, an `<h2>`) for a different level or styling. Omit for no header. |
|
|
216
|
+
| `href?` | string | — | Turn the whole card into a link. The card renders a focusable anchor and its accessible name comes from `header` → body → this URL (override with `aria-label`). A link card is display content — don't nest interactive controls inside it. |
|
|
217
|
+
| `icon?` | (string & {}) \| string \| number \| bigint \| boolean \| ReactElement \| Iterable \| ReactPortal \| Promise \| null | — | Leading visual for the header, laid out to the left of the `header` / `subtitle` as one aligned row (so it doesn't sit inline in the title, where it mis-aligns). A **string** is an icon shape, rendered as an `<Icon>` inside a circular chip (sized per the card via `--card-icon-size`); pass an `<img>`, initials (`<Text>`), or any node to use it as-is. Omit for none. |
|
|
218
|
+
| `loading?` | boolean | — | Loading state — dims the card with a skeleton pulse, sets `aria-busy`, and (in link mode) blocks navigation. |
|
|
219
|
+
| `media?` | ReactNode | — | Media (image, illustration) rendered full-bleed to the card edge, clipped to its corners. Position it with `mediaPosition`. |
|
|
235
220
|
| `mediaPosition?` | 'top' \| 'bottom' \| 'left' \| 'right' | 'top' | Which edge the `media` bleeds to. |
|
|
236
221
|
| `ping?` | string | — | Space-separated URLs the browser pings on navigation (only with `href`). |
|
|
237
|
-
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'primary' | Surface emphasis. `primary` (the default) is a clean sheet; `secondary` is a
|
|
238
|
-
subtle fill; `tertiary` is a frosted, semi-transparent panel with a backdrop
|
|
239
|
-
blur. |
|
|
222
|
+
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'primary' | Surface emphasis. `primary` (the default) is a clean sheet; `secondary` is a subtle fill; `tertiary` is a frosted, semi-transparent panel with a backdrop blur. |
|
|
240
223
|
| `rel?` | string | — | Anchor rel (only with `href`). |
|
|
241
|
-
| `round?` | boolean \| number \| string | — | Fully-round corners (`border-radius: 999px`, clamped to the box). Pass a
|
|
242
|
-
`
|
|
243
|
-
the default `--card-radius`. |
|
|
244
|
-
| `selected?` | boolean | — | Selected / chosen state — draws an inset ring in the tone color, for
|
|
245
|
-
choice-card / plan-picker patterns. |
|
|
224
|
+
| `round?` | boolean \| number \| string | — | Fully-round corners (`border-radius: 999px`, clamped to the box). Pass a `number` (px) or a CSS length string (`'1rem'`) for a custom radius. Omit for the default `--card-radius`. |
|
|
225
|
+
| `selected?` | boolean | — | Selected / chosen state — draws an inset ring in the tone color, for choice-card / plan-picker patterns. |
|
|
246
226
|
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size variant — scales the padding. |
|
|
247
|
-
| `subtitle?` | ReactNode | — | A secondary line under the header title, rendered as smaller text
|
|
248
|
-
(`<Text size="small">`) in the heading section. Tinted to match `tone`, like
|
|
249
|
-
the title. Omit for no subtitle. |
|
|
227
|
+
| `subtitle?` | ReactNode | — | A secondary line under the header title, rendered as smaller text (`<Text size="small">`) in the heading section. Tinted to match `tone`, like the title. Omit for no subtitle. |
|
|
250
228
|
| `target?` | string | — | Anchor target (only with `href`). |
|
|
251
|
-
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
default) is the same as omitting it. |
|
|
229
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone. Named tones re-point the surface + text; a custom color keeps its hue while lightness/chroma are pinned. `'neutral'` (the default) is the same as omitting it. |
|
|
230
|
+
|
|
231
|
+
## Web Component
|
|
255
232
|
|
|
256
233
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
257
234
|
|
|
@@ -267,6 +244,8 @@ Slots hold media, header, and footer content. Unslotted content is the card body
|
|
|
267
244
|
</a-card>
|
|
268
245
|
```
|
|
269
246
|
|
|
247
|
+
## Styling
|
|
248
|
+
|
|
270
249
|
Reach for the props first: **`tone`** sets the color (any CSS color for a custom
|
|
271
250
|
tone — it derives the surface in oklch), **`priority`** the fill, **`size`** the
|
|
272
251
|
padding. The one custom-color knob worth keeping is **`--card-tone-source`** (the
|
|
@@ -20,20 +20,20 @@ neutral. Six named tones (`neutral` default), or pass any CSS color for a custom
|
|
|
20
20
|
|
|
21
21
|
## Selected-only tone
|
|
22
22
|
|
|
23
|
-
`
|
|
24
|
-
until it's checked.
|
|
25
|
-
read as a validation error.
|
|
23
|
+
`toneScope="selected"` applies the checkbox's `tone` to the **checked mark only** —
|
|
24
|
+
the empty box stays neutral grey until it's checked. Use it when a resting tinted
|
|
25
|
+
border would read as a validation error.
|
|
26
26
|
|
|
27
27
|
```tsx
|
|
28
|
-
<Checkbox
|
|
29
|
-
<Checkbox defaultChecked
|
|
28
|
+
<Checkbox tone="brand" toneScope="selected">Off stays neutral</Checkbox>
|
|
29
|
+
<Checkbox defaultChecked tone="critical" toneScope="selected">Checked mark tinted</Checkbox>
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## Coloring the text
|
|
33
33
|
|
|
34
34
|
There's no text-tone prop. To tint the **label**, set `color` on the checkbox with a
|
|
35
35
|
theme-aware `--text-N-{tone}` token (the label inherits it); for the **hint**, add a
|
|
36
|
-
`color` rule on the `a-checkbox-hint` child. Pair either with `tone`
|
|
36
|
+
`color` rule on the `a-checkbox-hint` child. Pair either with `tone`
|
|
37
37
|
to tint the whole control.
|
|
38
38
|
|
|
39
39
|
```css
|
|
@@ -167,52 +167,27 @@ The wrapper sets `role="checkbox"` and `aria-checked` (`"true"` / `"false"` / `"
|
|
|
167
167
|
|
|
168
168
|
Space toggles the checkbox. Follows the [WAI-ARIA checkbox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
## Component props
|
|
171
171
|
|
|
172
172
|
| Prop | Type | Default | Description |
|
|
173
173
|
|------|------|---------|-------------|
|
|
174
|
-
| `checked?` | CheckboxValue | — | Controlled checked state. When provided the checkbox is controlled — it
|
|
175
|
-
|
|
176
|
-
the consumer accepts by updating this prop. Use `defaultChecked` for an
|
|
177
|
-
uncontrolled checkbox. `'indeterminate'` shows the minus glyph and takes
|
|
178
|
-
visual precedence; clicking it requests `true`. |
|
|
179
|
-
| `defaultChecked?` | CheckboxValue | false | Initial checked state for an uncontrolled checkbox. Read once; later
|
|
180
|
-
changes are ignored and the element updates its state after interaction. |
|
|
174
|
+
| `checked?` | CheckboxValue | — | Controlled checked state. When provided the checkbox is controlled — it renders exactly this and never self-applies; `onStateChange` is a *request* the consumer accepts by updating this prop. Use `defaultChecked` for an uncontrolled checkbox. `'indeterminate'` shows the minus glyph and takes visual precedence; clicking it requests `true`. |
|
|
175
|
+
| `defaultChecked?` | CheckboxValue | false | Initial checked state for an uncontrolled checkbox. Read once; later changes are ignored and the element updates its state after interaction. |
|
|
181
176
|
| `disabled?` | boolean | — | Disable the checkbox (no interaction, dropped from the tab order). |
|
|
182
|
-
| `hint?` | ReactNode | — | Secondary text rendered under the label — explanatory copy, like
|
|
183
|
-
|
|
184
|
-
| `
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
(a `
|
|
189
|
-
| `name?` | string | — | Form field name. Inside a `<form>` the checkbox submits under this name,
|
|
190
|
-
contributing `value` when checked — like a native checkbox. |
|
|
191
|
-
| `onChange?` | (event) => void | — | Fired *after* the checked state changes — a native `change` event (the
|
|
192
|
-
post-apply counterpart to `onStateChange`). Not cancelable. For a controlled
|
|
193
|
-
checkbox this fires once you've updated `checked`. |
|
|
194
|
-
| `onStateChange?` | (event, detail) => void | — | Fired on click / Space *before* the element applies any change. Event-first
|
|
195
|
-
so `event.preventDefault()` is the synchronous veto (uncontrolled mode);
|
|
196
|
-
`detail` carries `{ next, prev }`. In controlled mode the element never
|
|
197
|
-
self-applies — answer by updating `checked`, reject by doing nothing. |
|
|
198
|
-
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ checked, indeterminate, name, value }` snapshot
|
|
199
|
-
as the second argument, matching `Input`'s `onValueChange`. |
|
|
200
|
-
| `round?` | boolean \| number \| string | — | Round the checkbox mark to a circle (`border-radius: 999px` on the box). Pass
|
|
201
|
-
a `number` (px) or a CSS length string for a rounded-square mark instead. |
|
|
177
|
+
| `hint?` | ReactNode | — | Secondary text rendered under the label — explanatory copy, like Input's hint. Not part of the accessible name. |
|
|
178
|
+
| `label?` | string | — | Visible label — the *value* of the checkbox (clicked along with the box). Convenience for the common single-string case; for richer content (markup, a link, an info icon) use `children`. When both are supplied, `label` renders first. Required unless `children` or `aria-label` is provided (a `role="checkbox"` takes its name from the author, not the markup). |
|
|
179
|
+
| `name?` | string | — | Form field name. Inside a `<form>` the checkbox submits under this name, contributing `value` when checked — like a native checkbox. |
|
|
180
|
+
| `onChange?` | (event) => void | — | Fired *after* the checked state changes — a native `change` event (the post-apply counterpart to `onStateChange`). Not cancelable. For a controlled checkbox this fires once you've updated `checked`. |
|
|
181
|
+
| `onStateChange?` | (event, detail) => void | — | Fired on click / Space *before* the element applies any change. Event-first so `event.preventDefault()` is the synchronous veto (uncontrolled mode); `detail` carries `{ next, prev }`. In controlled mode the element never self-applies — answer by updating `checked`, reject by doing nothing. |
|
|
182
|
+
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ checked, indeterminate, name, value }` snapshot as the second argument, matching `Input`'s `onValueChange`. |
|
|
183
|
+
| `round?` | boolean \| number \| string | — | Round the checkbox mark to a circle (`border-radius: 999px` on the box). Pass a `number` (px) or a CSS length string for a rounded-square mark instead. |
|
|
202
184
|
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size variant. small=14px, medium=16px, large=18px box. |
|
|
203
|
-
| `tone?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Color of the **mark
|
|
204
|
-
|
|
205
|
-
`'rebeccapurple'`) for a one-off custom tone. Named tones track light/dark mode
|
|
206
|
-
automatically; a custom color keeps its hue + chroma and pins lightness to the
|
|
207
|
-
fill curve. Use `toneSelected` instead to tone only the checked mark and leave
|
|
208
|
-
the empty box neutral. The label + hint stay neutral — recolor them in plain
|
|
209
|
-
CSS via the theme-aware `--text-N-{tone}` tokens. |
|
|
210
|
-
| `toneSelected?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Like `tone`, but colored onto the **checked mark only** — the empty box stays
|
|
211
|
-
neutral grey until it's checked. Prefer this over `tone` when a resting tinted
|
|
212
|
-
border would read as a validation state. Same value set as `tone`; if both are
|
|
213
|
-
set, `tone` governs the off-state border and `toneSelected` the checked fill. |
|
|
185
|
+
| `tone?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Color of the **mark**. In the default `all` scope this colors the checked-box fill and unselected box border. A named tone or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone. Named tones track light/dark mode automatically; a custom color keeps its hue + chroma and pins lightness to the fill curve. Set `toneScope="selected"` to tone only the checked mark and leave the empty box neutral. The label + hint stay neutral — recolor them in plain CSS via the theme-aware `--text-N-{tone}` tokens. |
|
|
186
|
+
| `toneScope?` | ToneScope | 'all' | Apply `tone` to every state, or only while checked so the empty box stays neutral. `selected` is useful when a tinted resting border would read as a validation state. |
|
|
214
187
|
| `value?` | string | "on" | Value submitted with the form when checked — like a native checkbox. |
|
|
215
188
|
|
|
189
|
+
## Web Component
|
|
190
|
+
|
|
216
191
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
217
192
|
|
|
218
193
|
The focusable host carries the state. Label and hint are light-DOM children.
|
|
@@ -230,20 +205,22 @@ For a standard HTML form, add `data-anta` to a native checkbox. It keeps the
|
|
|
230
205
|
browser's label behavior, checked and indeterminate states, and form submission
|
|
231
206
|
while using Anta's control surface.
|
|
232
207
|
|
|
233
|
-
`size`, `tone`, `tone-
|
|
208
|
+
`size`, `tone`, `tone-scope`, and `round` use the matching Checkbox visual
|
|
234
209
|
treatments.
|
|
235
210
|
|
|
236
211
|
```html
|
|
237
212
|
<div style="display: grid; gap: 8px">
|
|
238
213
|
<label><input data-anta type="checkbox" name="updates" size="small" tone="brand"> Product updates</label>
|
|
239
|
-
<label><input data-anta type="checkbox" name="security" tone
|
|
214
|
+
<label><input data-anta type="checkbox" name="security" tone="success" tone-scope="selected" checked> Security notices</label>
|
|
240
215
|
<label><input data-anta type="checkbox" name="billing" size="large" round tone="warning" checked> Billing alerts</label>
|
|
241
216
|
</div>
|
|
242
217
|
```
|
|
243
218
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
219
|
+
## Styling
|
|
220
|
+
|
|
221
|
+
Reach for the props first: **`tone`** chooses the mark color and **`toneScope`**
|
|
222
|
+
chooses whether it applies in `all` states or only while `selected` (any CSS color
|
|
223
|
+
derives the full rest/hover/active curve in oklch); **`size`** controls dimensions + type.
|
|
247
224
|
To tint the label + hint, add a `color` rule (on the host for the label, on
|
|
248
225
|
`a-checkbox-hint` for the hint) with the `--text-N-{tone}` tokens — there's no
|
|
249
226
|
text-tone prop. The focus ring is the global
|
|
@@ -203,47 +203,23 @@ On close, focus returns to whatever opened the dialog, from the native `<dialog>
|
|
|
203
203
|
</Dialog>
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
## Component props
|
|
207
207
|
|
|
208
208
|
| Prop | Type | Default | Description |
|
|
209
209
|
|------|------|---------|-------------|
|
|
210
210
|
| `children?` | ReactNode | — | The dialog body. Scrolls when it overflows the available height. |
|
|
211
|
-
| `closable?` | boolean | true | Whether the top-right ✕ button is present. It's one way to close the dialog,
|
|
212
|
-
alongside Esc, the backdrop, a `data-dialog-close` / footer action, and your
|
|
213
|
-
own code; `false` removes the ✕ without making the dialog unclosable. |
|
|
211
|
+
| `closable?` | boolean | true | Whether the top-right ✕ button is present. It's one way to close the dialog, alongside Esc, the backdrop, a `data-dialog-close` / footer action, and your own code; `false` removes the ✕ without making the dialog unclosable. |
|
|
214
212
|
| `defaultOpen?` | boolean | — | Initial open state for the uncontrolled case (read once on mount). |
|
|
215
|
-
| `footer?` | ReactNode | — | Footer content, usually the action buttons. Rendered in the bottom zone as
|
|
216
|
-
a
|
|
217
|
-
| `
|
|
218
|
-
|
|
219
|
-
| `
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
| `
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
state, `detail.prev` the current one (booleans). In controlled mode, apply
|
|
226
|
-
`detail.next` to `open` to accept, or do nothing to reject. |
|
|
227
|
-
| `open?` | boolean | — | Controlled open state. When provided, the consumer owns open/close: the
|
|
228
|
-
dialog only follows this prop, and every user dismiss (Esc, backdrop, close
|
|
229
|
-
button) *requests* a change via `onStateChange` (reject by not updating).
|
|
230
|
-
Leave undefined for uncontrolled. |
|
|
231
|
-
| `persistent?` | boolean | — | Turn off light-dismiss: a backdrop click and Esc no longer close the dialog.
|
|
232
|
-
It stays closable through explicit controls (the ✕ when `closable`, a footer
|
|
233
|
-
action, your own code); `persistent` isn't "un-closable", it stops an
|
|
234
|
-
accidental click or stray Esc from dismissing. For an alert / confirm that
|
|
235
|
-
should be answered deliberately. Omit for the default dismissible behavior. |
|
|
236
|
-
| `position?` | 'center' \| 'left' \| 'right' \| 'top' \| 'bottom' \| 'fullscreen' | 'center' | Placement. `center` (the default) is a centered modal; `left` / `right` /
|
|
237
|
-
`top` / `bottom` turn it into an edge drawer (full height for left/right,
|
|
238
|
-
full width for top/bottom); `fullscreen` fills the whole viewport with no
|
|
239
|
-
edge gap or corner radius. |
|
|
240
|
-
| `round?` | boolean \| number \| 'top' \| 'right' \| 'bottom' \| 'left' \| (string & {}) | — | Corner radius. A side keyword — `'top'` / `'right'` / `'bottom'` / `'left'` —
|
|
241
|
-
rounds only that edge's two corners (at `--dialog-radius`), which pairs with
|
|
242
|
-
a drawer's exposed edge (a bottom sheet → `'top'`, a right drawer → `'left'`).
|
|
243
|
-
A `number` (px) or CSS string rounds all corners at that value; the string
|
|
244
|
-
may be a full `border-radius` shorthand (`'12px 12px 0 0'`). `true` rounds all
|
|
245
|
-
corners at `--dialog-radius`. Omit for the position default: `center` is
|
|
246
|
-
rounded, drawers and `fullscreen` are square. |
|
|
213
|
+
| `footer?` | ReactNode | — | Footer content, usually the action buttons. Rendered in the bottom zone as a right-aligned row (wraps under pressure). Omit for none. |
|
|
214
|
+
| `header?` | ReactNode | — | Header content: a title, or any node. Rendered in the top zone. Omit for a chromeless dialog with only a body. |
|
|
215
|
+
| `name?` | string | — | Uncontrolled trigger name. Any element with `data-dialog-open="{name}"` opens this dialog, `data-dialog-close="{name}"` closes it. A convenience for triggers rendered elsewhere; ignored in controlled mode. |
|
|
216
|
+
| `onStateChange?` | (event, detail) => void | — | Fired before the open state changes, on every user open or dismiss. `event` is the cancelable `statechange`: call `event.preventDefault()` to veto an *uncontrolled* transition. `detail.next` is the requested open state, `detail.prev` the current one (booleans). In controlled mode, apply `detail.next` to `open` to accept, or do nothing to reject. |
|
|
217
|
+
| `open?` | boolean | — | Controlled open state. When provided, the consumer owns open/close: the dialog only follows this prop, and every user dismiss (Esc, backdrop, close button) *requests* a change via `onStateChange` (reject by not updating). Leave undefined for uncontrolled. |
|
|
218
|
+
| `persistent?` | boolean | — | Turn off light-dismiss: a backdrop click and Esc no longer close the dialog. It stays closable through explicit controls (the ✕ when `closable`, a footer action, your own code); `persistent` isn't "un-closable", it stops an accidental click or stray Esc from dismissing. For an alert / confirm that should be answered deliberately. Omit for the default dismissible behavior. |
|
|
219
|
+
| `position?` | 'center' \| 'left' \| 'right' \| 'top' \| 'bottom' \| 'fullscreen' | 'center' | Placement. `center` (the default) is a centered modal; `left` / `right` / `top` / `bottom` turn it into an edge drawer (full height for left/right, full width for top/bottom); `fullscreen` fills the whole viewport with no edge gap or corner radius. |
|
|
220
|
+
| `round?` | boolean \| number \| 'top' \| 'right' \| 'bottom' \| 'left' \| (string & {}) | — | Corner radius. A side keyword — `'top'` / `'right'` / `'bottom'` / `'left'` — rounds only that edge's two corners (at `--dialog-radius`), which pairs with a drawer's exposed edge (a bottom sheet → `'top'`, a right drawer → `'left'`). A `number` (px) or CSS string rounds all corners at that value; the string may be a full `border-radius` shorthand (`'12px 12px 0 0'`). `true` rounds all corners at `--dialog-radius`. Omit for the position default: `center` is rounded, drawers and `fullscreen` are square. |
|
|
221
|
+
|
|
222
|
+
## Web Component
|
|
247
223
|
|
|
248
224
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
249
225
|
|
|
@@ -262,6 +238,8 @@ raw `<a-button>`.
|
|
|
262
238
|
</a-dialog>
|
|
263
239
|
```
|
|
264
240
|
|
|
241
|
+
## Styling
|
|
242
|
+
|
|
265
243
|
Reach for the props first: **`position`** (modal, drawer edge, or fullscreen),
|
|
266
244
|
**`closable`** (the ✕), **`persistent`** (light-dismiss off), **`round`** (corner
|
|
267
245
|
radius). For everything else, style the shadow **parts** in plain CSS.
|
|
@@ -304,50 +304,23 @@ function Accordion() {
|
|
|
304
304
|
.accordion a-expander:not(:first-child):not(:last-child) { border-radius: 0; }
|
|
305
305
|
```
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
## Component props
|
|
308
308
|
|
|
309
309
|
| Prop | Type | Default | Description |
|
|
310
310
|
|------|------|---------|-------------|
|
|
311
|
-
| `title` | ReactNode | — | Summary (header) content. A string is rendered with the `level`
|
|
312
|
-
|
|
313
|
-
heading semantics in the document outline. |
|
|
314
|
-
| `actions?` | ReactNode | — | Header actions (e.g. buttons, tags) rendered at the end of the
|
|
315
|
-
header row, OUTSIDE the toggle trigger — clicking them never
|
|
316
|
-
toggles, they're separately focusable, and screen readers see them
|
|
317
|
-
as separate controls. |
|
|
311
|
+
| `title` | ReactNode | — | Summary (header) content. A string is rendered with the `level` type scale; pass a node (e.g. a `<Title>`) for full control or real heading semantics in the document outline. |
|
|
312
|
+
| `actions?` | ReactNode | — | Header actions (e.g. buttons, tags) rendered at the end of the header row, OUTSIDE the toggle trigger — clicking them never toggles, they're separately focusable, and screen readers see them as separate controls. |
|
|
318
313
|
| `defaultOpen?` | boolean | — | Initial open state for the uncontrolled case. |
|
|
319
|
-
| `disabled?` | boolean | — | Disables the header: not clickable or focusable, hover affordance
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
| `
|
|
324
|
-
|
|
325
|
-
the
|
|
326
|
-
| `
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
open state, `detail.prev` the current one (booleans). In controlled
|
|
330
|
-
mode, apply `detail.next` to `open` to accept, or do nothing to reject. |
|
|
331
|
-
| `open?` | boolean | — | Controlled open state. When provided, the consumer owns open/close. Selecting
|
|
332
|
-
the summary requests a change through `onStateChange`; omit `open` for
|
|
333
|
-
uncontrolled use. |
|
|
334
|
-
| `outdent?` | boolean | — | Outdent the chevron into the left gutter so the title and body sit
|
|
335
|
-
flush with surrounding content (the docs-header layout). Only takes
|
|
336
|
-
effect with `priority="tertiary"` — on the filled priorities the
|
|
337
|
-
container edge has to bound the chevron, so it's a no-op there. |
|
|
338
|
-
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'secondary' | Surface emphasis. `secondary` (the default) is a subtle fill;
|
|
339
|
-
`primary` is a more pronounced card; `tertiary` is transparent (the
|
|
340
|
-
bare disclosure). |
|
|
341
|
-
| `round?` | boolean \| number \| string | — | Round corners sized to half the folded (header) height: a pill when folded,
|
|
342
|
-
and — when expanded — the same corner radius rather than a bigger stadium.
|
|
343
|
-
The element measures the header, so it tracks custom header content. Pass a
|
|
344
|
-
`number` (px) or CSS length string for a *fixed* radius that overrides the
|
|
345
|
-
measurement (and skips it) in both states. |
|
|
346
|
-
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`)
|
|
347
|
-
for a one-off custom tone. Named tones re-point the text and (on filled
|
|
348
|
-
priorities) the surface to the matching palette; a custom color keeps
|
|
349
|
-
its hue while lightness/chroma are pinned. `'neutral'` (the default) is
|
|
350
|
-
the same as omitting it. |
|
|
314
|
+
| `disabled?` | boolean | — | Disables the header: not clickable or focusable, hover affordance off, text dimmed. The open state freezes as-is — disabling an open expander keeps it open. `actions` stay live; disable them separately if needed. |
|
|
315
|
+
| `level?` | 1 \| 2 \| 3 \| 4 \| 5 \| 6 | 5 | Heading type scale applied to a string `title` (mirrors `<Title>`'s levels). Visual only — for outline semantics, pass a `<Title>` as the title. |
|
|
316
|
+
| `onStateChange?` | (event, detail) => void | — | Fired before the open state changes. `event` is the cancelable `statechange` — call `event.preventDefault()` to veto an *uncontrolled* toggle (e.g. confirm before closing). `detail.next` is the requested open state, `detail.prev` the current one (booleans). In controlled mode, apply `detail.next` to `open` to accept, or do nothing to reject. |
|
|
317
|
+
| `open?` | boolean | — | Controlled open state. When provided, the consumer owns open/close. Selecting the summary requests a change through `onStateChange`; omit `open` for uncontrolled use. |
|
|
318
|
+
| `outdent?` | boolean | — | Outdent the chevron into the left gutter so the title and body sit flush with surrounding content (the docs-header layout). Only takes effect with `priority="tertiary"` — on the filled priorities the container edge has to bound the chevron, so it's a no-op there. |
|
|
319
|
+
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'secondary' | Surface emphasis. `secondary` (the default) is a subtle fill; `primary` is a more pronounced card; `tertiary` is transparent (the bare disclosure). |
|
|
320
|
+
| `round?` | boolean \| number \| string | — | Round corners sized to half the folded (header) height: a pill when folded, and — when expanded — the same corner radius rather than a bigger stadium. The element measures the header, so it tracks custom header content. Pass a `number` (px) or CSS length string for a *fixed* radius that overrides the measurement (and skips it) in both states. |
|
|
321
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone. Named tones re-point the text and (on filled priorities) the surface to the matching palette; a custom color keeps its hue while lightness/chroma are pinned. `'neutral'` (the default) is the same as omitting it. |
|
|
322
|
+
|
|
323
|
+
## Web Component
|
|
351
324
|
|
|
352
325
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
353
326
|
|
|
@@ -379,6 +352,8 @@ use a heading inside the summary when you need heading semantics.
|
|
|
379
352
|
</details>
|
|
380
353
|
```
|
|
381
354
|
|
|
355
|
+
## Styling
|
|
356
|
+
|
|
382
357
|
Reach for the props first: **`tone`** sets the color (any CSS color for a custom
|
|
383
358
|
tone — it derives the surface in oklch), **`priority`** the fill, **`level`** the
|
|
384
359
|
heading. Two knobs are worth keeping: **`--expander-tone-source`** (the color a
|
package/docs/components/icon.md
CHANGED
|
@@ -17,20 +17,122 @@ accessible loading status.
|
|
|
17
17
|
|
|
18
18
|
## Built-in shapes
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
| Shape | Search synonyms |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `arrow-left-to-line` | dock, snap, align |
|
|
23
|
+
| `arrow-left` | back, previous, prev |
|
|
24
|
+
| `arrow-narrow-down` | download, fall, down |
|
|
25
|
+
| `arrow-narrow-up-down` | sort, swap, transfer, reorder |
|
|
26
|
+
| `arrow-narrow-up` | upload, rise, up |
|
|
27
|
+
| `arrow-right` | forward, next |
|
|
28
|
+
| `arrow-top-right` | external, open, leave |
|
|
29
|
+
| `asterisk` | star, wildcard |
|
|
30
|
+
| `blank` | spacer, empty, placeholder, space, none |
|
|
31
|
+
| `book-open` | read, docs, documentation |
|
|
32
|
+
| `braces` | code, brackets, json |
|
|
33
|
+
| `bug` | defect, issue, error |
|
|
34
|
+
| `calendar-days` | |
|
|
35
|
+
| `calendar` | date, schedule |
|
|
36
|
+
| `case-sensitive` | aA, capitalize, case |
|
|
37
|
+
| `chat` | message, comment, discuss |
|
|
38
|
+
| `check` | tick, ok, done, confirm, approve |
|
|
39
|
+
| `chevron-down` | arrow, expand, open, down |
|
|
40
|
+
| `chevron-left` | arrow, back, previous |
|
|
41
|
+
| `chevron-right` | arrow, forward, next |
|
|
42
|
+
| `chevron-up` | arrow, collapse, close, up |
|
|
43
|
+
| `chevrons-right` | skip, fast forward |
|
|
44
|
+
| `circle-check` | success, ok, done |
|
|
45
|
+
| `circle-dot` | |
|
|
46
|
+
| `circle-large` | dot, marker |
|
|
47
|
+
| `circle-small-solid` | |
|
|
48
|
+
| `circle-user` | avatar, person, account, contact, profile |
|
|
49
|
+
| `circle` | dot, point |
|
|
50
|
+
| `click` | tap, press, touch |
|
|
51
|
+
| `clock` | time |
|
|
52
|
+
| `cloud-upload` | save, sync, upload, send, export |
|
|
53
|
+
| `columns-3-cog` | columns, table, settings, configure, fields, visibility |
|
|
54
|
+
| `copy` | duplicate, clone |
|
|
55
|
+
| `corner-down-right` | branch, indent, return |
|
|
56
|
+
| `cube` | box, package |
|
|
57
|
+
| `dollar-sign` | currency, money, payment |
|
|
58
|
+
| `dots-vertical` | more, kebab, options |
|
|
59
|
+
| `download` | save, import |
|
|
60
|
+
| `edit` | pencil, modify, rename |
|
|
61
|
+
| `external-link` | open, link, share, outbound |
|
|
62
|
+
| `eye-closed` | |
|
|
63
|
+
| `eye` | |
|
|
64
|
+
| `file-down` | download, save |
|
|
65
|
+
| `file` | document, page |
|
|
66
|
+
| `filter-x` | clear filter, reset filter, remove filter |
|
|
67
|
+
| `filter` | sort, narrow |
|
|
68
|
+
| `folder-close` | directory |
|
|
69
|
+
| `folder-open` | directory, browse |
|
|
70
|
+
| `folder-tree` | hierarchy, structure, tree |
|
|
71
|
+
| `hat-glasses` | accessibility, vision, disguise, person |
|
|
72
|
+
| `heart-handshake` | credits, thanks, agreement, deal, partnership |
|
|
73
|
+
| `heart` | like, favorite, love, wishlist |
|
|
74
|
+
| `history-tree` | log, past |
|
|
75
|
+
| `history` | log, past |
|
|
76
|
+
| `home` | |
|
|
77
|
+
| `hourglass` | progress, time, wait, loading, timer |
|
|
78
|
+
| `info` | information, about, i |
|
|
79
|
+
| `link` | url, href, anchor |
|
|
80
|
+
| `list-collapse` | list, collapse, expand, items |
|
|
81
|
+
| `maximize` | fullscreen, expand |
|
|
82
|
+
| `megaphone` | announcement, broadcast |
|
|
83
|
+
| `menu` | hamburger, list, more |
|
|
84
|
+
| `minimize` | collapse, shrink |
|
|
85
|
+
| `minus` | remove, subtract |
|
|
86
|
+
| `moon` | |
|
|
87
|
+
| `more` | options, extra |
|
|
88
|
+
| `move-horizontal` | resize, swap, horizontal |
|
|
89
|
+
| `not-equal` | neq, different |
|
|
90
|
+
| `play` | start, run, execute |
|
|
91
|
+
| `plus` | add, new, create |
|
|
92
|
+
| `pointer` | |
|
|
93
|
+
| `presentation` | slides, deck |
|
|
94
|
+
| `refresh-ccw-dot` | |
|
|
95
|
+
| `refresh` | reload, sync, update |
|
|
96
|
+
| `regex` | pattern, match |
|
|
97
|
+
| `repeat` | loop, retry, rerun |
|
|
98
|
+
| `rotate-ccw` | |
|
|
99
|
+
| `rss` | feed, subscribe |
|
|
100
|
+
| `runs-history` | log, past |
|
|
101
|
+
| `scroll-text` | log, output, console |
|
|
102
|
+
| `search-check` | found, validated |
|
|
103
|
+
| `search` | find, magnify, lookup |
|
|
104
|
+
| `send` | submit, share, deliver |
|
|
105
|
+
| `settings` | |
|
|
106
|
+
| `share` | |
|
|
107
|
+
| `sparkles` | ai, magic, generate |
|
|
108
|
+
| `square-check-big` | |
|
|
109
|
+
| `square-menu` | |
|
|
110
|
+
| `sun` | |
|
|
111
|
+
| `swatch-book` | palette, color, swatch, paint, design |
|
|
112
|
+
| `table-2` | table, grid, data, spreadsheet, rows, columns |
|
|
113
|
+
| `tag` | label, badge, chip |
|
|
114
|
+
| `text-cursor-input` | |
|
|
115
|
+
| `text-initial` | text, typography, letter, a |
|
|
116
|
+
| `timer` | stopwatch, countdown, time |
|
|
117
|
+
| `toggle-right` | toggle, switch, on, off, boolean |
|
|
118
|
+
| `trash` | delete, remove, bin |
|
|
119
|
+
| `view` | show, display, preview |
|
|
120
|
+
| `warning-diamond` | error, invalid, alert, danger |
|
|
121
|
+
| `warning-triangle` | alert, danger, caution |
|
|
122
|
+
| `webhook` | integration, hook |
|
|
123
|
+
| `workflow` | pipeline, process, flow |
|
|
124
|
+
| `x` | close, cancel, dismiss, remove, no |
|
|
125
|
+
|
|
126
|
+
## Component props
|
|
21
127
|
|
|
22
128
|
| Prop | Type | Default | Description |
|
|
23
129
|
|------|------|---------|-------------|
|
|
24
|
-
| `shape` | IconShape | — | Which icon to render. The set of valid shapes comes from Anta's
|
|
25
|
-
|
|
26
|
-
`IconShapes` interface module augmentation). |
|
|
27
|
-
| `label?` | string | — | Accessible name for the icon. When set, the wrapper exposes
|
|
28
|
-
`role="img"` and `aria-label={label}` so screen readers announce
|
|
29
|
-
the icon. When omitted (the default), the icon is treated as
|
|
30
|
-
decorative — `aria-hidden="true"` is applied so it doesn't add
|
|
31
|
-
noise alongside neighbouring text. |
|
|
130
|
+
| `shape` | IconShape | — | Which icon to render. The set of valid shapes comes from Anta's built-in icons plus any consumer-generated shapes (via the `IconShapes` interface module augmentation). |
|
|
131
|
+
| `label?` | string | — | Accessible name for the icon. When set, the wrapper exposes `role="img"` and `aria-label={label}` so screen readers announce the icon. When omitted (the default), the icon is treated as decorative — `aria-hidden="true"` is applied so it doesn't add noise alongside neighbouring text. |
|
|
32
132
|
| `size?` | number | 16 | Width and height in pixels. |
|
|
33
133
|
|
|
134
|
+
## Web Component
|
|
135
|
+
|
|
34
136
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
35
137
|
|
|
36
138
|
Set the accessible name on the raw element. Use `--icon-size` for a portable custom
|
|
@@ -37,34 +37,30 @@ closes the list; clicking the field to place the caret keeps it open.
|
|
|
37
37
|
Suggestions are bare strings or `SelectOption`s, the same option shape
|
|
38
38
|
[Select](./select.md) uses: `value`, `label`, `hint`, `icon`, `tone`, `disabled`.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
## Component props
|
|
41
41
|
|
|
42
42
|
| Prop | Type | Default | Description |
|
|
43
43
|
|------|------|---------|-------------|
|
|
44
|
-
| `suggestions` | string \| SelectOption[] | — | The suggestions: bare strings or `SelectOption`s (`value` / `label` / `hint` /
|
|
45
|
-
`icon` / `tone` / `disabled`). A flat list; picking one fills the field. |
|
|
44
|
+
| `suggestions` | string \| SelectOption[] | — | The suggestions: bare strings or `SelectOption`s (`value` / `label` / `hint` / `icon` / `tone` / `disabled`). A flat list; picking one fills the field. |
|
|
46
45
|
| `clearable?` | boolean | — | Show a clear button while the field has text. |
|
|
47
46
|
| `defaultValue?` | string | — | Initial value for uncontrolled use. |
|
|
48
47
|
| `disabled?` | boolean | — | Disable the field. |
|
|
49
|
-
| `filter?` | boolean \| (option, query) => boolean | true | How suggestions match the text. `true` uses the built-in case-insensitive
|
|
50
|
-
substring match on `value` / `label` / `hint`; a function `(option, query) =>
|
|
51
|
-
boolean` uses a custom matcher; `false` shows `suggestions` unchanged for
|
|
52
|
-
application-provided async or remote filtering. |
|
|
48
|
+
| `filter?` | boolean \| (option, query) => boolean | true | How suggestions match the text. `true` uses the built-in case-insensitive substring match on `value` / `label` / `hint`; a function `(option, query) => boolean` uses a custom matcher; `false` shows `suggestions` unchanged for application-provided async or remote filtering. |
|
|
53
49
|
| `hint?` | ReactNode | — | Hint under the field. |
|
|
54
50
|
| `label?` | ReactNode | — | Field label. |
|
|
55
51
|
| `leading?` | ReactNode | — | Leading adornment inside the field. |
|
|
56
52
|
| `name?` | string | — | Form field name. |
|
|
57
53
|
| `onSelect?` | (option) => void | — | Fires only when a suggestion is chosen, with that option. |
|
|
58
|
-
| `onValueChange?` | (value) => void | — | Fires as the text changes (typing, picking a suggestion, or clearing) with
|
|
59
|
-
the new field text. |
|
|
54
|
+
| `onValueChange?` | (value) => void | — | Fires as the text changes (typing, picking a suggestion, or clearing) with the new field text. |
|
|
60
55
|
| `placeholder?` | string | — | Placeholder text. |
|
|
61
56
|
| `size?` | 'small' \| 'medium' \| 'large' | medium | Field size. |
|
|
62
57
|
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | — | Validation status. |
|
|
63
58
|
| `statusIcon?` | (string & {}) \| false \| IconShape | — | Status icon override, or `false` to drop it. |
|
|
64
59
|
| `tone?` | string | — | Custom accent color — a named tone or any CSS color. |
|
|
65
60
|
| `trailing?` | ReactNode | — | Trailing adornment inside the field. |
|
|
66
|
-
| `value?` | string | — | Controlled value: the field's text, a **free** string not constrained to a
|
|
67
|
-
|
|
61
|
+
| `value?` | string | — | Controlled value: the field's text, a **free** string not constrained to a suggestion. Leave undefined for uncontrolled. |
|
|
62
|
+
|
|
63
|
+
## Web Component
|
|
68
64
|
|
|
69
65
|
`InputAutocomplete` combines an input with a Menu. Reproducing its filtering,
|
|
70
66
|
selection, focus, and popup coordination without the React or Preact wrapper is
|
|
@@ -90,6 +86,8 @@ option content, popup styling, or consistent behavior across browsers.
|
|
|
90
86
|
</datalist>
|
|
91
87
|
```
|
|
92
88
|
|
|
89
|
+
## Styling
|
|
90
|
+
|
|
93
91
|
**The field** is styled through Input's props (`size`, `status`, `tone`, `round`,
|
|
94
92
|
`leading` / `trailing`) and its `::part`s; set its width with `style` / `className`
|
|
95
93
|
(forwarded to the field). **The suggestion popover** takes Menu's `::part(menu)`.
|