@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
|
@@ -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** in every state — the checked-box fill *and* the
|
|
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 every state — the checked-box fill *and* the 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. Use `toneSelected` instead 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
|
+
| `toneSelected?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Like `tone`, but colored onto the **checked mark only** — the empty box stays neutral grey until it's checked. Prefer this over `tone` when a resting tinted border would read as a validation state. Same value set as `tone`; if both are set, `tone` governs the off-state border and `toneSelected` the checked fill. |
|
|
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.
|
|
@@ -241,6 +216,8 @@ treatments.
|
|
|
241
216
|
</div>
|
|
242
217
|
```
|
|
243
218
|
|
|
219
|
+
## Styling
|
|
220
|
+
|
|
244
221
|
Reach for the props first: **`tone`** colors the mark in every state,
|
|
245
222
|
**`toneSelected`** only the checked mark (any CSS color for a custom tone — it
|
|
246
223
|
derives the full rest/hover/active curve in oklch), **`size`** the dimensions + type.
|
|
@@ -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)`.
|
|
@@ -52,42 +52,30 @@ field converts it (18 → 6 PM).
|
|
|
52
52
|
<InputDate size="large" label="Large" time defaultValue="2026-06-15T09:00" />
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
## InputDate props
|
|
56
|
+
|
|
55
57
|
| Prop | Type | Default | Description |
|
|
56
58
|
|------|------|---------|-------------|
|
|
57
59
|
| `clearable?` | boolean | — | Show a clear button once the field has a value. |
|
|
58
60
|
| `defaultValue?` | string | — | Initial value for the uncontrolled case. |
|
|
59
61
|
| `disabled?` | boolean | — | Disable the field and the calendar. |
|
|
60
|
-
| `hint?` | ReactNode | — | Helper text under the field. Replaced by a format hint while the entry is
|
|
61
|
-
|
|
62
|
-
| `
|
|
63
|
-
for 24-hour. Omit to follow the locale (`en-US` → 12-hour, most others → 24). |
|
|
64
|
-
| `icon?` | false \| IconShape | calendar-days | Leading icon at the start of the field — the calendar affordance. Pass
|
|
65
|
-
another shape to change it, or `false` to drop it. |
|
|
62
|
+
| `hint?` | ReactNode | — | Helper text under the field. Replaced by a format hint while the entry is unrecognized. |
|
|
63
|
+
| `hour12?` | boolean | — | Force the time cycle when `time` is on: `true` for 12-hour (AM/PM), `false` for 24-hour. Omit to follow the locale (`en-US` → 12-hour, most others → 24). |
|
|
64
|
+
| `icon?` | false \| IconShape | calendar-days | Leading icon at the start of the field — the calendar affordance. Pass another shape to change it, or `false` to drop it. |
|
|
66
65
|
| `label?` | ReactNode | — | Field label, above the control. |
|
|
67
|
-
| `locale?` | string | navigator.language | BCP-47 locale driving the display format, the placeholder mask, parsing order,
|
|
68
|
-
and the calendar. |
|
|
66
|
+
| `locale?` | string | navigator.language | BCP-47 locale driving the display format, the placeholder mask, parsing order, and the calendar. |
|
|
69
67
|
| `max?` | string | — | Latest selectable date (ISO). |
|
|
70
|
-
| `min?` | string | — | Earliest selectable date (ISO). Earlier days disable, and a typed date before
|
|
71
|
-
it stays uncommitted. |
|
|
68
|
+
| `min?` | string | — | Earliest selectable date (ISO). Earlier days disable, and a typed date before it stays uncommitted. |
|
|
72
69
|
| `name?` | string | — | Form field name — the ISO value submits under this key. |
|
|
73
70
|
| `offset?` | number | 4 | Gap in pixels between the field and the calendar menu. |
|
|
74
|
-
| `onValueChange?` | (value, attrs) => void | — | Fired after the value resolves (a recognized entry, a calendar pick, a time
|
|
75
|
-
change, or a clear), with the new ISO value (`''` when cleared) and a
|
|
76
|
-
`{ value, name }` snapshot. An unrecognized entry does not fire it. |
|
|
71
|
+
| `onValueChange?` | (value, attrs) => void | — | Fired after the value resolves (a recognized entry, a calendar pick, a time change, or a clear), with the new ISO value (`''` when cleared) and a `{ value, name }` snapshot. An unrecognized entry does not fire it. |
|
|
77
72
|
| `placeholder?` | string | the locale's format mask (e.g. `MM/DD/YYYY`, `MM/DD/YYYY HH:MM` with `time`) | Placeholder shown when empty. |
|
|
78
|
-
| `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 calendar menu relative to the field. Same values as
|
|
79
|
-
`Menu`; it auto-flips and clamps when space runs out. |
|
|
73
|
+
| `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 calendar menu relative to the field. Same values as `Menu`; it auto-flips and clamps when space runs out. |
|
|
80
74
|
| `round?` | boolean \| number \| string | — | Round the field corners — `true` for fully round, or a number / CSS length. |
|
|
81
75
|
| `size?` | 'small' \| 'medium' \| 'large' | medium | Field size. Also sizes the calendar and the time row. |
|
|
82
76
|
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | neutral | Validation/feedback tone. An unrecognized entry forces `critical` until fixed. |
|
|
83
|
-
| `time?` | boolean | — | Include a time. The value becomes ISO `YYYY-MM-DDTHH:mm`, the field parses a
|
|
84
|
-
|
|
85
|
-
shows a time row (hours : minutes, an AM/PM toggle in 12-hour locales, then a
|
|
86
|
-
Done button) under the calendar. Picking a day keeps the menu open so you can
|
|
87
|
-
set the time. |
|
|
88
|
-
| `value?` | string | — | Controlled value — ISO `YYYY-MM-DD` (or `YYYY-MM-DDTHH:mm` with `time`), `''`
|
|
89
|
-
for empty. Pair with `onValueChange`; the field and calendar follow it and a
|
|
90
|
-
pick only *requests* a change. |
|
|
77
|
+
| `time?` | boolean | — | Include a time. The value becomes ISO `YYYY-MM-DDTHH:mm`, the field parses a trailing time after a space (`06/15/2026 14:30`, `… 2:30pm`), and the menu shows a time row (hours : minutes, an AM/PM toggle in 12-hour locales, then a Done button) under the calendar. Picking a day keeps the menu open so you can set the time. |
|
|
78
|
+
| `value?` | string | — | Controlled value — ISO `YYYY-MM-DD` (or `YYYY-MM-DDTHH:mm` with `time`), `''` for empty. Pair with `onValueChange`; the field and calendar follow it and a pick only *requests* a change. |
|
|
91
79
|
|
|
92
80
|
## Calendar
|
|
93
81
|
|
|
@@ -336,6 +324,26 @@ Tracking the cursor, painting the grid from `buildMonth`, and re-rendering on
|
|
|
336
324
|
`navigate` is what the React `Calendar` packages, plus the year/month jump menu,
|
|
337
325
|
which uses the same `Menu` composition shown on the [Menu](./menu.md) page.
|
|
338
326
|
|
|
327
|
+
## Calendar props
|
|
328
|
+
|
|
329
|
+
| Prop | Type | Default | Description |
|
|
330
|
+
|------|------|---------|-------------|
|
|
331
|
+
| `aria-label?` | string | — | Accessible name for the grid (defaults to the visible month heading). |
|
|
332
|
+
| `defaultValue?` | string | — | Initial selected date for the uncontrolled case (ISO `YYYY-MM-DD`). |
|
|
333
|
+
| `disabled?` | boolean | — | Disable the whole calendar (not focusable or selectable). |
|
|
334
|
+
| `focusSignal?` | number | — | Move keyboard focus onto the active day. Change this to a new value (e.g. increment a counter) to focus the cursor cell — `InputDate` bumps it when the calendar is opened from the field by keyboard (ArrowDown), so focus lands in the grid. The initial value never focuses; only a change does. |
|
|
335
|
+
| `locale?` | string | navigator.language | BCP-47 locale tag driving first-day-of-week, weekday, and month names. |
|
|
336
|
+
| `max?` | string | — | Latest selectable date (ISO `YYYY-MM-DD`) — later days render disabled. |
|
|
337
|
+
| `min?` | string | — | Earliest selectable date (ISO `YYYY-MM-DD`) — earlier days render disabled. |
|
|
338
|
+
| `name?` | string | — | Form field name — the selected ISO date submits under this key. |
|
|
339
|
+
| `onChange?` | (event) => void | — | Fired *after* the selection changes (post-apply). Not cancelable; for a controlled calendar it fires once you've updated `value`. |
|
|
340
|
+
| `onStateChange?` | (event, detail) => void | — | Fired whenever the selection changes — event-first. `detail` is `{ next, prev, reason }`: `next` / `prev` are ISO date strings (`null` = none); `reason` is `'user'` \| `'reset'` \| `'restore'`. A `'user'` pick fires *before* applying and is **cancelable** — `event.preventDefault()` vetoes it (uncontrolled), or in controlled mode answer by updating `value`. `'reset'` / `'restore'` are not cancelable. |
|
|
341
|
+
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ value, name }` snapshot as the second argument, matching `Input`. |
|
|
342
|
+
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size of the whole calendar — scales the day cells, the chevrons, and the weekday / month-heading type together (uses Button's `small` / `medium` / `large` scale). |
|
|
343
|
+
| `value?` | string | — | Controlled selected date — ISO `YYYY-MM-DD`. When provided, the application controls selection: the grid follows this prop and a pick only *requests* a change via `onStateChange`. Leave undefined for uncontrolled. |
|
|
344
|
+
|
|
345
|
+
## Web Component
|
|
346
|
+
|
|
339
347
|
`InputDate` has no host element. Rebuilding its text parsing, dropdown calendar,
|
|
340
348
|
localized day grid, month navigation, keyboard navigation, and focus management
|
|
341
349
|
in vanilla JavaScript is significant work, even with Anta's `buildMonth` and
|
|
@@ -361,6 +369,8 @@ field treatments.
|
|
|
361
369
|
<input data-anta type="week" name="sprint-week" value="2026-W25">
|
|
362
370
|
```
|
|
363
371
|
|
|
372
|
+
## Styling
|
|
373
|
+
|
|
364
374
|
The calendar is **light DOM**, so everything is plain CSS, with no shadow parts or
|
|
365
375
|
hidden internals. The days and chevrons are real `<a-button>`s, so their colors,
|
|
366
376
|
hover, focus ring, and selected look come from the Button styles and theme
|
|
@@ -66,47 +66,39 @@ range is clamped to the nearest bound as you step or leave the field, and flags
|
|
|
66
66
|
<InputTime label="Office hours" size="large" min="09:00" max="17:00" defaultValue="09:30" />
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
## InputTime props
|
|
70
|
+
|
|
69
71
|
| Prop | Type | Default | Description |
|
|
70
72
|
|------|------|---------|-------------|
|
|
71
73
|
| `autoFocus?` | boolean | — | Focus this field when its containing `Dialog` opens. |
|
|
72
|
-
| `children?` | ReactNode | — | Extra content rendered under the field, above the hint (a no-box child like
|
|
73
|
-
a `<Tooltip>` takes no space and anchors to the field). |
|
|
74
|
+
| `children?` | ReactNode | — | Extra content rendered under the field, above the hint (a no-box child like a `<Tooltip>` takes no space and anchors to the field). |
|
|
74
75
|
| `clearable?` | boolean | — | Show a clear button once the field has a value. |
|
|
75
76
|
| `defaultValue?` | string | — | Initial value for the uncontrolled case (24-hour `"HH:mm"`). |
|
|
76
77
|
| `dimActions?` | boolean | — | Dim the trailing adornments at rest; they brighten on hover / focus. |
|
|
77
78
|
| `disabled?` | boolean | — | Disable the field. |
|
|
78
79
|
| `hint?` | ReactNode | — | Message below the field. `status` recolors it and prefixes a glyph. |
|
|
79
|
-
| `hour12?` | boolean | — | Force the clock: `true` = 12-hour (AM/PM), `false` = 24-hour. Omit to follow
|
|
80
|
-
the
|
|
81
|
-
| `
|
|
82
|
-
|
|
83
|
-
| `
|
|
84
|
-
|
|
85
|
-
| `locale?` | string | navigator.language | BCP-47 locale driving the clock (12h vs 24h), segment order, separator, and
|
|
86
|
-
the AM/PM text. |
|
|
87
|
-
| `max?` | string | — | Latest allowed time, 24-hour `"HH:mm"`. A complete value above it is clamped
|
|
88
|
-
down (on step / blur) and flagged `rangeOverflow`. |
|
|
89
|
-
| `min?` | string | — | Earliest allowed time, 24-hour `"HH:mm"`. A complete value below it is
|
|
90
|
-
clamped up (on step / blur) and flagged `rangeUnderflow` for form validity. |
|
|
80
|
+
| `hour12?` | boolean | — | Force the clock: `true` = 12-hour (AM/PM), `false` = 24-hour. Omit to follow the locale. |
|
|
81
|
+
| `icon?` | false \| IconShape | clock | Leading icon at the start of the field — the clock affordance. Pass another shape to change it, or `false` to drop it. |
|
|
82
|
+
| `label?` | ReactNode | — | Field label, shown above the control and used as the segment group's accessible name. |
|
|
83
|
+
| `locale?` | string | navigator.language | BCP-47 locale driving the clock (12h vs 24h), segment order, separator, and the AM/PM text. |
|
|
84
|
+
| `max?` | string | — | Latest allowed time, 24-hour `"HH:mm"`. A complete value above it is clamped down (on step / blur) and flagged `rangeOverflow`. |
|
|
85
|
+
| `min?` | string | — | Earliest allowed time, 24-hour `"HH:mm"`. A complete value below it is clamped up (on step / blur) and flagged `rangeUnderflow` for form validity. |
|
|
91
86
|
| `name?` | string | — | Form field name — the 24-hour value submits under this key. |
|
|
92
87
|
| `onBlur?` | (e) => void | — | Fires when the field loses focus. |
|
|
93
88
|
| `onClearInput?` | (e) => void | — | Fires after the built-in clear button has cleared the field. |
|
|
94
89
|
| `onFocus?` | (e) => void | — | Fires when the field gains focus. |
|
|
95
|
-
| `onValueChange?` | (event, attrs) => void | — | Fires on every edit (`input`), with the native event + an `attrs` snapshot
|
|
96
|
-
(`value`, `name`, `empty`, `valid`, `validationMessage`). Also fires on
|
|
97
|
-
`change` (blur) and on clear. |
|
|
90
|
+
| `onValueChange?` | (event, attrs) => void | — | Fires on every edit (`input`), with the native event + an `attrs` snapshot (`value`, `name`, `empty`, `valid`, `validationMessage`). Also fires on `change` (blur) and on clear. |
|
|
98
91
|
| `required?` | boolean | — | Mark the field required (drives native validity). |
|
|
99
92
|
| `round?` | boolean \| number \| string | — | Fully-round the field, or a custom radius (`number` px / CSS length). |
|
|
100
93
|
| `size?` | 'small' \| 'medium' \| 'large' | medium | Size variant. small=24px, medium=28px, large=32px tall. |
|
|
101
|
-
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | — | Validation / feedback tone. Only `critical` marks the field invalid; the
|
|
102
|
-
|
|
103
|
-
| `
|
|
104
|
-
shape to override, or `false` to drop it). |
|
|
105
|
-
| `tone?` | string | — | Custom accent color — any literal CSS color tints the resting + hover
|
|
106
|
-
border (focus ring stays `--focus-ring`); `status` overrides for validation. |
|
|
94
|
+
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | — | Validation / feedback tone. Only `critical` marks the field invalid; the others are advisory. Omit (or `neutral`) for a plain field. |
|
|
95
|
+
| `statusIcon?` | (string & {}) \| false \| IconShape | — | Glyph before the `hint` when `status` is set (per-status default; pass a shape to override, or `false` to drop it). |
|
|
96
|
+
| `tone?` | string | — | Custom accent color — any literal CSS color tints the resting + hover border (focus ring stays `--focus-ring`); `status` overrides for validation. |
|
|
107
97
|
| `trailing?` | ReactNode | — | Content pinned to the end of the field (after the clear button). |
|
|
108
98
|
| `value?` | string | — | Controlled value — 24-hour `"HH:mm"`. Pair with `onValueChange`. |
|
|
109
99
|
|
|
100
|
+
## Web Component
|
|
101
|
+
|
|
110
102
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
111
103
|
|
|
112
104
|
Slots supply the field label and leading icon.
|