@antadesign/anta 0.3.25 → 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 +17 -3
- package/dist/box-types.d.ts +161 -0
- package/dist/box-types.js +0 -0
- 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 +52 -0
- package/dist/components/Box.js +55 -0
- 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-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-banner.js +4 -4
- package/dist/elements/a-box.css +1 -0
- package/dist/elements/a-box.d.ts +41 -0
- package/dist/elements/a-box.js +584 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-calendar.js +2 -2
- 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 +2 -2
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.js +3 -3
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +6 -6
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-item.js +3 -3
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-menu.js +2 -2
- package/dist/elements/a-radio-group.js +3 -3
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-slider.js +6 -6
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-switch.js +2 -2
- package/dist/elements/a-tabpanel.js +2 -2
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tabs.js +6 -6
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-toast.js +2 -2
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +4 -3
- package/dist/elements/a-tooltip.js +9 -5
- package/dist/elements/capture-input.d.ts +5 -0
- package/dist/elements/capture-input.js +609 -0
- package/dist/elements/index.d.ts +2 -0
- package/dist/elements/index.js +6 -0
- package/dist/general_types.d.ts +70 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/jsx-runtime.d.ts +3 -1
- package/docs/accessibility.md +24 -0
- package/docs/changelog.md +45 -3
- package/docs/colors.md +141 -0
- package/docs/comparison.md +463 -28
- package/docs/components/avatar.md +364 -0
- package/docs/components/banner.md +13 -27
- package/docs/components/box.md +354 -0
- 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 +6 -3
- 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
|
@@ -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.
|
package/docs/components/input.md
CHANGED
|
@@ -424,106 +424,55 @@ wraps to fewer columns as it narrows. Resize the preview to see it reflow.
|
|
|
424
424
|
`}</style>
|
|
425
425
|
```
|
|
426
426
|
|
|
427
|
-
|
|
427
|
+
## Component props
|
|
428
428
|
|
|
429
429
|
| Prop | Type | Default | Description |
|
|
430
430
|
|------|------|---------|-------------|
|
|
431
|
-
| `autoComplete?` | 'off' \| 'on' \| 'name' \| 'username' \| 'email' \| 'current-password' \| 'new-password' \| 'one-time-code' \| 'tel' \| 'url' \| (string & {}) | — | Native autocomplete token. Overrides the value derived from `type`
|
|
432
|
-
(`email` / `tel` / `url`) — set it for the cases `type` can't express, e.g.
|
|
433
|
-
`username`, `current-password`, `new-password`, `one-time-code`, or `off`. |
|
|
431
|
+
| `autoComplete?` | 'off' \| 'on' \| 'name' \| 'username' \| 'email' \| 'current-password' \| 'new-password' \| 'one-time-code' \| 'tel' \| 'url' \| (string & {}) | — | Native autocomplete token. Overrides the value derived from `type` (`email` / `tel` / `url`) — set it for the cases `type` can't express, e.g. `username`, `current-password`, `new-password`, `one-time-code`, or `off`. |
|
|
434
432
|
| `autoFocus?` | boolean | — | Focus this field when its containing `Dialog` opens. |
|
|
435
|
-
| `children?` | ReactNode | — | Extra content rendered directly under the field, above the hint/error (it
|
|
436
|
-
|
|
437
|
-
space and anchors to the field — consistent with how tooltips attach
|
|
438
|
-
to any other element. Use the named `leading` / `trailing` props for
|
|
439
|
-
in-field content. |
|
|
440
|
-
| `clearable?` | boolean | — | Show a clear button as the first trailing item once the field has a
|
|
441
|
-
value. |
|
|
433
|
+
| `children?` | ReactNode | — | Extra content rendered directly under the field, above the hint/error (it pushes the message down). A no-box child like an Anta `<Tooltip>` takes no space and anchors to the field — consistent with how tooltips attach to any other element. Use the named `leading` / `trailing` props for in-field content. |
|
|
434
|
+
| `clearable?` | boolean | — | Show a clear button as the first trailing item once the field has a value. |
|
|
442
435
|
| `defaultValue?` | string | — | Initial value for the uncontrolled case. |
|
|
443
|
-
| `dimActions?` | boolean | — | Dim the `leading` / `trailing` adornments at rest; they brighten to full
|
|
444
|
-
when the field is hovered or focused (a quiet-until-engaged affordance for
|
|
445
|
-
trailing actions). |
|
|
436
|
+
| `dimActions?` | boolean | — | Dim the `leading` / `trailing` adornments at rest; they brighten to full when the field is hovered or focused (a quiet-until-engaged affordance for trailing actions). |
|
|
446
437
|
| `disabled?` | boolean | — | Disable the field. |
|
|
447
|
-
| `hint?` | ReactNode | — | Message below the field. Neutral helper text by default; `status` recolors
|
|
448
|
-
it and prefixes the matching glyph. |
|
|
438
|
+
| `hint?` | ReactNode | — | Message below the field. Neutral helper text by default; `status` recolors it and prefixes the matching glyph. |
|
|
449
439
|
| `inputMode?` | 'none' \| 'text' \| 'decimal' \| 'numeric' \| 'tel' \| 'search' \| 'email' \| 'url' | — | Virtual-keyboard hint. Overrides the value derived from `type`. |
|
|
450
|
-
| `label?` | ReactNode | — | Field label, shown above the control. A string is rendered with the
|
|
451
|
-
label type scale; pass a node for full control. Associated with the
|
|
452
|
-
control as its accessible name (the element mirrors the label text to
|
|
453
|
-
`aria-label`, since `<label for>` can't cross the shadow boundary). |
|
|
440
|
+
| `label?` | ReactNode | — | Field label, shown above the control. A string is rendered with the label type scale; pass a node for full control. Associated with the control as its accessible name (the element mirrors the label text to `aria-label`, since `<label for>` can't cross the shadow boundary). |
|
|
454
441
|
| `leading?` | ReactNode | — | Content pinned to the start of the field (e.g. an icon). |
|
|
455
442
|
| `max?` | number \| string | — | |
|
|
456
443
|
| `maxLength?` | number | — | Max input length. |
|
|
457
|
-
| `maxRows?` | number | — | Cap the autogrow height (in rows) of a `multiline` field with no `rows`.
|
|
458
|
-
Omit for unbounded growth. |
|
|
444
|
+
| `maxRows?` | number | — | Cap the autogrow height (in rows) of a `multiline` field with no `rows`. Omit for unbounded growth. |
|
|
459
445
|
| `min?` | number \| string | — | Min / max / step — for `type="number"`. |
|
|
460
446
|
| `minLength?` | number | — | Min input length. |
|
|
461
|
-
| `multiline?` | boolean | — | Render a `<textarea>` instead of an `<input>`. Without `rows` it grows
|
|
462
|
-
with its content from one line (capped by `maxRows` if set). Autogrow uses
|
|
463
|
-
CSS `field-sizing` where supported (Chrome/Edge, Safari ≥ 26.2) and falls
|
|
464
|
-
back to a built-in JS resize elsewhere (Firefox, older Safari), so it grows
|
|
465
|
-
in every browser. |
|
|
447
|
+
| `multiline?` | boolean | — | Render a `<textarea>` instead of an `<input>`. Without `rows` it grows with its content from one line (capped by `maxRows` if set). Autogrow uses CSS `field-sizing` where supported (Chrome/Edge, Safari ≥ 26.2) and falls back to a built-in JS resize elsewhere (Firefox, older Safari), so it grows in every browser. |
|
|
466
448
|
| `name?` | string | — | Form field name — submitted with the form via ElementInternals. |
|
|
467
449
|
| `onBlur?` | (e) => void | — | Fires when the field loses focus. |
|
|
468
|
-
| `onChange?` | (e) => void | — | Fires on **commit** (blur / Enter) — the platform `change` semantics, **not**
|
|
469
|
-
|
|
470
|
-
the
|
|
471
|
-
(both) for live updates. Read `e.target.value`. |
|
|
472
|
-
| `onClearClick?` | (e) => void | — | Fires when the built-in clear button (`clearable`) is clicked, *before*
|
|
473
|
-
the field is cleared. Call `e.preventDefault()` to keep the current value
|
|
474
|
-
— the clear is cancelled and `onClearInput` won't fire. Backed by the
|
|
475
|
-
element's cancelable, bubbling `clearclick` event. |
|
|
476
|
-
| `onClearInput?` | (e) => void | — | Fires after the built-in clear button (`clearable`) has cleared the field
|
|
477
|
-
— so `onInput` / `onChange` fire too — making this useful for reacting
|
|
478
|
-
specifically to a clear. Doesn't fire if `onClearClick` cancelled the
|
|
479
|
-
clear. Backed by the element's bubbling `clearinput` event. |
|
|
450
|
+
| `onChange?` | (e) => void | — | Fires on **commit** (blur / Enter) — the platform `change` semantics, **not** React's per-keystroke `onChange`. This is a web component, so `onChange` keeps the native meaning; reach for `onInput` (every keystroke) or `onValueChange` (both) for live updates. Read `e.target.value`. |
|
|
451
|
+
| `onClearClick?` | (e) => void | — | Fires when the built-in clear button (`clearable`) is clicked, *before* the field is cleared. Call `e.preventDefault()` to keep the current value — the clear is cancelled and `onClearInput` won't fire. Backed by the element's cancelable, bubbling `clearclick` event. |
|
|
452
|
+
| `onClearInput?` | (e) => void | — | Fires after the built-in clear button (`clearable`) has cleared the field — so `onInput` / `onChange` fire too — making this useful for reacting specifically to a clear. Doesn't fire if `onClearClick` cancelled the clear. Backed by the element's bubbling `clearinput` event. |
|
|
480
453
|
| `onFocus?` | (e) => void | — | Fires when the field gains focus. |
|
|
481
454
|
| `onInput?` | (e) => void | — | Fires on every keystroke. Read `e.target.value`. |
|
|
482
|
-
| `onValueChange?` | (event, attrs) => void | — | Unified value-change handler — the easy path for state. Fires on `input`
|
|
483
|
-
*and* `change` (and on clear), with the native `event` plus a convenience
|
|
484
|
-
`attrs` snapshot (`value`, `name`, `empty`, `valid`, `validationMessage`) so
|
|
485
|
-
you can do `setForm(s => ({ ...s, [attrs.name]: attrs.value }))` without
|
|
486
|
-
digging into the event. Use `event.type` to tell a live edit (`input`) from
|
|
487
|
-
a commit (`change`); read `id` / `type` / `className` off `event.target`. |
|
|
455
|
+
| `onValueChange?` | (event, attrs) => void | — | Unified value-change handler — the easy path for state. Fires on `input` *and* `change` (and on clear), with the native `event` plus a convenience `attrs` snapshot (`value`, `name`, `empty`, `valid`, `validationMessage`) so you can do `setForm(s => ({ ...s, [attrs.name]: attrs.value }))` without digging into the event. Use `event.type` to tell a live edit (`input`) from a commit (`change`); read `id` / `type` / `className` off `event.target`. |
|
|
488
456
|
| `pattern?` | string | — | Validation pattern (single-line). |
|
|
489
457
|
| `placeholder?` | string | — | Placeholder shown when empty. |
|
|
490
458
|
| `readOnly?` | boolean | — | Make the field read-only. |
|
|
491
459
|
| `required?` | boolean | — | Mark the field required (drives native validity). |
|
|
492
|
-
| `role?` | string | — | ARIA `role` for the field — e.g. `combobox` when the input drives a
|
|
493
|
-
|
|
494
|
-
| `
|
|
495
|
-
|
|
496
|
-
a circle to match (it isn't sized by a custom field value). |
|
|
497
|
-
| `rows?` | number | — | Fixed visible row count — a constant-height `<textarea>` (implies
|
|
498
|
-
`multiline`). |
|
|
499
|
-
| `size?` | 'small' \| 'medium' \| 'large' | medium | Size variant. small=24px, medium=28px, large=32px tall; the type scale and
|
|
500
|
-
icon track the size (small 13/16 + 14px icon · medium 15/20 + 16px ·
|
|
501
|
-
large 17/22 + 18px). |
|
|
460
|
+
| `role?` | string | — | ARIA `role` for the field — e.g. `combobox` when the input drives a suggestion `listbox` (see `InputAutocomplete`). Left unset by default. |
|
|
461
|
+
| `round?` | boolean \| number \| string | — | Fully-round the field (`border-radius: 999px`). Pass a `number` (px) or a CSS length string for a custom radius. The `clearable` × button always rounds to a circle to match (it isn't sized by a custom field value). |
|
|
462
|
+
| `rows?` | number | — | Fixed visible row count — a constant-height `<textarea>` (implies `multiline`). |
|
|
463
|
+
| `size?` | 'small' \| 'medium' \| 'large' | medium | Size variant. small=24px, medium=28px, large=32px tall; the type scale and icon track the size (small 13/16 + 14px icon · medium 15/20 + 16px · large 17/22 + 18px). |
|
|
502
464
|
| `spellCheck?` | boolean | — | Toggle native spell-checking. |
|
|
503
|
-
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | — | Validation / feedback tone — colors the border + `hint` and prefixes a
|
|
504
|
-
|
|
505
|
-
submission, `:state(invalid)`); `success` / `warning` / `info` / `brand`
|
|
506
|
-
are advisory and stay valid. Omit (or `neutral`) for a plain field. |
|
|
507
|
-
| `statusIcon?` | (string & {}) \| false \| IconShape | — | Glyph shown before the `hint` when `status` is set. Each status has a
|
|
508
|
-
default (critical → `warning-diamond`, warning → `warning-triangle`,
|
|
509
|
-
success → `circle-check`, info → `info`, brand → `circle-small-solid`); pass a
|
|
510
|
-
shape to override, or `false` to drop it. `neutral` has no default glyph. |
|
|
465
|
+
| `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | — | Validation / feedback tone — colors the border + `hint` and prefixes a glyph. Only `critical` marks the field invalid (`aria-invalid`, blocks form submission, `:state(invalid)`); `success` / `warning` / `info` / `brand` are advisory and stay valid. Omit (or `neutral`) for a plain field. |
|
|
466
|
+
| `statusIcon?` | (string & {}) \| false \| IconShape | — | Glyph shown before the `hint` when `status` is set. Each status has a default (critical → `warning-diamond`, warning → `warning-triangle`, success → `circle-check`, info → `info`, brand → `circle-small-solid`); pass a shape to override, or `false` to drop it. `neutral` has no default glyph. |
|
|
511
467
|
| `step?` | number \| string | — | |
|
|
512
|
-
| `tone?` | string | — | Custom accent color — any literal CSS color tints the resting + hover
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
| `
|
|
516
|
-
clear button when `clearable`. |
|
|
517
|
-
| `truncate?` | boolean | true | Ellipsize an overflowing single-line value. Read-only inputs already do
|
|
518
|
-
this; pass `false` when an editable field should show the full value. |
|
|
519
|
-
| `type?` | 'text' \| 'search' \| 'email' \| 'password' \| 'tel' \| 'url' \| 'number' | text | Single-line input type. Ignored when `multiline`. `search` is a
|
|
520
|
-
**wrapper-only** shorthand: it defaults a leading search icon and a clear
|
|
521
|
-
button (both overridable — pass your own `leading`, or `clearable={false}`)
|
|
522
|
-
and sets `inputmode="search"`, but the DOM input stays `type="text"`. The
|
|
523
|
-
native `search` type never reaches the element, so the browser's own
|
|
524
|
-
clear/search affordances never appear — Anta owns that chrome. |
|
|
468
|
+
| `tone?` | string | — | Custom accent color — any literal CSS color tints the resting + hover border (focus ring stays the global `--focus-ring`). For consistency with the other controls' custom-tone knob; a `status` still overrides for validation. |
|
|
469
|
+
| `trailing?` | ReactNode | — | Content pinned to the end of the field (e.g. icons, buttons), after the clear button when `clearable`. |
|
|
470
|
+
| `truncate?` | boolean | true | Ellipsize an overflowing single-line value. Read-only inputs already do this; pass `false` when an editable field should show the full value. |
|
|
471
|
+
| `type?` | 'text' \| 'search' \| 'email' \| 'password' \| 'tel' \| 'url' \| 'number' | text | Single-line input type. Ignored when `multiline`. `search` is a **wrapper-only** shorthand: it defaults a leading search icon and a clear button (both overridable — pass your own `leading`, or `clearable={false}`) and sets `inputmode="search"`, but the DOM input stays `type="text"`. The native `search` type never reaches the element, so the browser's own clear/search affordances never appear — Anta owns that chrome. |
|
|
525
472
|
| `value?` | string | — | Controlled value. Pair with `onChange` / `onInput`. |
|
|
526
473
|
|
|
474
|
+
## Web Component
|
|
475
|
+
|
|
527
476
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
528
477
|
|
|
529
478
|
Slots hold the label, hint, and controls around the native field.
|
|
@@ -568,6 +517,8 @@ their `size` attribute, so Anta does not reuse it. `round` and a custom-color
|
|
|
568
517
|
<input data-anta type="reset" value="Reset">
|
|
569
518
|
```
|
|
570
519
|
|
|
520
|
+
## Styling
|
|
521
|
+
|
|
571
522
|
Reach for the props first: **`status`** sets a validation tone (border + message),
|
|
572
523
|
**`tone`** a custom accent color for the border (any CSS color), **`size`** the
|
|
573
524
|
dimensions. The focus ring is the global [`--focus-ring`](../colors.md#focus-ring).
|
|
@@ -52,18 +52,18 @@ label, state, and semantics.
|
|
|
52
52
|
|
|
53
53
|
Use `<Loader>` when you need a value, speed, or accessible loading status.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
## Component props
|
|
56
56
|
|
|
57
57
|
| Prop | Type | Default | Description |
|
|
58
58
|
|------|------|---------|-------------|
|
|
59
|
-
| `label?` | string | — | Accessible name for a standalone loader. Without a label, the loader is
|
|
60
|
-
decorative so nearby status text remains the single announcement. |
|
|
59
|
+
| `label?` | string | — | Accessible name for a standalone loader. Without a label, the loader is decorative so nearby status text remains the single announcement. |
|
|
61
60
|
| `max?` | number | 100 | Upper bound of the range. |
|
|
62
61
|
| `size?` | number | 16 | Width and height in pixels. |
|
|
63
62
|
| `speed?` | number | 0.75 | Seconds per rotation. Pass a positive number. |
|
|
64
63
|
| `tone?` | LoaderTone | — | Color tone for the loader. Omit it to use the standard text-3 color. |
|
|
65
|
-
| `value?` | number \| false | — | Current progress value. Omit this prop, or pass `false`, for an
|
|
66
|
-
|
|
64
|
+
| `value?` | number \| false | — | Current progress value. Omit this prop, or pass `false`, for an indeterminate rotating gradient. |
|
|
65
|
+
|
|
66
|
+
## Web Component
|
|
67
67
|
|
|
68
68
|
Use a raw `<a-loader>` when you are not using the JSX wrapper. Set its size,
|
|
69
69
|
speed, and determinate percentage with CSS custom properties. `value` selects
|
|
@@ -92,6 +92,8 @@ the static ring; `--loader-value` is the percentage it shows.
|
|
|
92
92
|
When the value is unknown, omit `value` and give a standalone loader an
|
|
93
93
|
accessible name. Mark a loader beside visible status text with `aria-hidden`.
|
|
94
94
|
|
|
95
|
+
## Styling
|
|
96
|
+
|
|
95
97
|
The standalone Loader uses the quiet `--text-3` color by default. Set `color`
|
|
96
98
|
directly when it needs a deliberate semantic or one-off color; the `loader`
|
|
97
99
|
icon alias inherits its parent control’s color.
|