@antadesign/anta 0.3.26 → 0.3.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -28
- package/dist/anta_helpers.d.ts +8 -0
- package/dist/anta_helpers.js +18 -0
- package/dist/box-types.d.ts +1 -1
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +36 -42
- package/dist/capture-types.d.ts +156 -0
- package/dist/components/Banner.js +2 -2
- package/dist/components/Box.d.ts +15 -0
- package/dist/components/Box.js +3 -11
- package/dist/components/Button.js +2 -2
- package/dist/components/Capture.d.ts +39 -0
- package/dist/components/Capture.js +36 -0
- package/dist/components/Card.js +2 -2
- package/dist/components/Checkbox.d.ts +10 -11
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/Expander.js +2 -2
- package/dist/components/Input.js +2 -2
- package/dist/components/InputTime.js +2 -2
- package/dist/components/Loader.js +2 -1
- package/dist/components/MenuItem.d.ts +7 -8
- package/dist/components/MenuItem.js +4 -4
- package/dist/components/Progress.js +2 -2
- package/dist/components/RadioGroup.d.ts +12 -13
- package/dist/components/RadioGroup.js +7 -23
- package/dist/components/Select.d.ts +12 -7
- package/dist/components/Select.js +4 -3
- package/dist/components/SelectFaceted.d.ts +7 -5
- package/dist/components/SelectFaceted.js +4 -3
- package/dist/components/Slider.js +3 -3
- package/dist/components/Steps.css +1 -1
- package/dist/components/Switch.d.ts +7 -8
- package/dist/components/Switch.js +3 -11
- package/dist/components/Tabs.js +2 -2
- package/dist/components/Tag.d.ts +7 -9
- package/dist/components/Tag.js +2 -2
- package/dist/components/Text.js +2 -2
- package/dist/components/Title.js +2 -2
- package/dist/components/capture-props.d.ts +30 -0
- package/dist/components/capture-props.js +44 -0
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-box.d.ts +1 -1
- package/dist/elements/a-box.js +11 -3
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +7 -9
- package/dist/elements/a-calendar.css +1 -1
- package/dist/elements/a-capture.css +1 -0
- package/dist/elements/a-capture.d.ts +10 -0
- package/dist/elements/a-capture.js +24 -0
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-checkbox.js +4 -4
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.js +1 -0
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.js +5 -7
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +4 -6
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-slider.js +6 -9
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-text.js +1 -0
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +3 -4
- package/dist/elements/a-tooltip.js +0 -1
- package/dist/elements/capture-input.d.ts +5 -0
- package/dist/elements/capture-input.js +609 -0
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/general_types.d.ts +56 -23
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +2 -1
- package/dist/reset.css +1 -1
- package/dist/theme-antithesis.css +1 -0
- package/dist/theme-antune.css +1 -0
- package/dist/tokens.css +1 -1
- package/docs/accessibility.md +24 -0
- package/docs/changelog.md +79 -0
- package/docs/colors.md +141 -0
- package/docs/comparison.md +463 -28
- package/docs/components/avatar.md +13 -17
- package/docs/components/banner.md +13 -27
- package/docs/components/box.md +226 -154
- package/docs/components/breadcrumbs.md +49 -12
- package/docs/components/button.md +48 -37
- package/docs/components/capture.md +345 -0
- package/docs/components/card.md +17 -38
- package/docs/components/checkbox.md +27 -50
- package/docs/components/dialog.md +14 -36
- package/docs/components/expander.md +15 -40
- package/docs/components/icon.md +111 -9
- package/docs/components/input-autocomplete.md +9 -11
- package/docs/components/input-date.md +33 -23
- package/docs/components/input-time.md +15 -23
- package/docs/components/input.md +27 -76
- package/docs/components/loader.md +7 -5
- package/docs/components/menu.md +75 -80
- package/docs/components/progress.md +10 -14
- package/docs/components/radio.md +28 -46
- package/docs/components/select-faceted.md +8 -25
- package/docs/components/select.md +33 -105
- package/docs/components/slider.md +16 -21
- package/docs/components/steps.md +38 -8
- package/docs/components/switch.md +16 -19
- package/docs/components/tabs.md +52 -40
- package/docs/components/tag.md +15 -24
- package/docs/components/text.md +10 -23
- package/docs/components/title.md +7 -8
- package/docs/components/toaster.md +6 -3
- package/docs/components/tooltip.md +13 -23
- package/docs/index.md +3 -1
- package/docs/install-config.md +42 -8
- package/docs/normalization.md +48 -3
- package/docs/packages/stickers.md +56 -0
- package/docs/theming.md +362 -14
- package/package.json +7 -4
- package/dist/components/InputDate.module.css +0 -1
- package/dist/components/Select.module.css +0 -1
- package/dist/components/SelectFaceted.module.css +0 -1
- package/dist/theme-anta.css +0 -1
- /package/dist/{search-index.json → capture-types.js} +0 -0
|
@@ -17,16 +17,16 @@ The `Switch` wrapper renders a form-associated `<a-switch>` element. It works un
|
|
|
17
17
|
|
|
18
18
|
## Selected-only tone
|
|
19
19
|
|
|
20
|
-
`
|
|
20
|
+
`toneScope="selected"` applies the switch's `tone` to the checked track only. The unchecked track and thumb stay neutral until the switch is on. Use it when a resting tinted control could imply a validation state.
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
|
-
<Switch
|
|
24
|
-
<Switch defaultChecked
|
|
23
|
+
<Switch tone="brand" toneScope="selected" label="Off stays neutral" />
|
|
24
|
+
<Switch defaultChecked tone="critical" toneScope="selected" label="Checked track tinted" />
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Coloring the text
|
|
28
28
|
|
|
29
|
-
There is no text-tone prop. To tint the label, set `color` on the switch with a theme-aware `--text-N-{tone}` token; to tint the hint, target `a-switch-hint`. Pair either with `tone`
|
|
29
|
+
There is no text-tone prop. To tint the label, set `color` on the switch with a theme-aware `--text-N-{tone}` token; to tint the hint, target `a-switch-hint`. Pair either with `tone` to color the whole control.
|
|
30
30
|
|
|
31
31
|
```css
|
|
32
32
|
/* The class is only for the demo — use your own selector. */
|
|
@@ -123,33 +123,28 @@ The wrapper sets `role="switch"` and keeps `aria-checked` in sync with the curre
|
|
|
123
123
|
|
|
124
124
|
Space toggles the switch. It follows the [WAI-ARIA switch pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/).
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
## Component props
|
|
127
127
|
|
|
128
128
|
| Prop | Type | Default | Description |
|
|
129
129
|
|------|------|---------|-------------|
|
|
130
130
|
| `checked?` | boolean | — | Controlled checked value. In controlled mode, update this in `onStateChange`. |
|
|
131
131
|
| `defaultChecked?` | boolean | false | Initial checked value for an uncontrolled switch. |
|
|
132
132
|
| `disabled?` | boolean | — | Disables interaction and removes the switch from the tab order. |
|
|
133
|
-
| `hint?` | ReactNode | — | Secondary text rendered under the label. It does not become part of the
|
|
134
|
-
accessible name. |
|
|
133
|
+
| `hint?` | ReactNode | — | Secondary text rendered under the label. It does not become part of the accessible name. |
|
|
135
134
|
| `label?` | string | — | Visible, stable label for the setting. Use `children` for richer label content. |
|
|
136
|
-
| `labelPosition?` | 'start' \| 'end' | 'end' | Put the visible label before or after the control. Grid layout changes only
|
|
137
|
-
the visual order, preserving DOM/source order for assistive technologies. |
|
|
135
|
+
| `labelPosition?` | 'start' \| 'end' | 'end' | Put the visible label before or after the control. Grid layout changes only the visual order, preserving DOM/source order for assistive technologies. |
|
|
138
136
|
| `name?` | string | — | Form field name. A checked switch submits `value` under this name. |
|
|
139
137
|
| `onChange?` | (event) => void | — | Native post-apply `change` event. |
|
|
140
|
-
| `onStateChange?` | (event, detail) => void | — | Fired before a user toggle applies. Call `event.preventDefault()` to veto an
|
|
141
|
-
uncontrolled change; controlled consumers accept by updating `checked`. |
|
|
138
|
+
| `onStateChange?` | (event, detail) => void | — | Fired before a user toggle applies. Call `event.preventDefault()` to veto an uncontrolled change; controlled consumers accept by updating `checked`. |
|
|
142
139
|
| `onValueChange?` | (event, attrs) => void | — | Post-apply callback with the new form-relevant value snapshot. |
|
|
143
|
-
| `round?` | boolean \| number \| string | — | Fully round the thumb and track. Pass a `number` (px) or CSS length string
|
|
144
|
-
for a custom track radius; the thumb radius is 3px smaller. |
|
|
140
|
+
| `round?` | boolean \| number \| string | — | Fully round the thumb and track. Pass a `number` (px) or CSS length string for a custom track radius; the thumb radius is 3px smaller. |
|
|
145
141
|
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size variant. small=26×16px, medium=30×18px, large=34×20px. |
|
|
146
|
-
| `tone?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'brand' | Color of the track and thumb. A tinted tone also colors the unchecked
|
|
147
|
-
|
|
148
|
-
| `toneSelected?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'brand' | Like `tone`, but applies only while the switch is checked. The unchecked
|
|
149
|
-
track and thumb stay neutral. If both are set, `tone` colors the unchecked
|
|
150
|
-
state and `toneSelected` colors the checked track. |
|
|
142
|
+
| `tone?` | 'brand' \| 'neutral' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'brand' | Color of the track and thumb. A tinted tone also colors the unchecked track border and thumb; use `toneScope="selected"` to color only the checked track. |
|
|
143
|
+
| `toneScope?` | ToneScope | 'all' | Apply `tone` to every state, or only while checked so the unchecked track and thumb stay neutral. |
|
|
151
144
|
| `value?` | string | "on" | Value submitted while checked. |
|
|
152
145
|
|
|
146
|
+
## Web Component
|
|
147
|
+
|
|
153
148
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
154
149
|
|
|
155
150
|
The focusable host carries the state. Label and hint are light-DOM children.
|
|
@@ -161,7 +156,9 @@ The focusable host carries the state. Label and hint are light-DOM children.
|
|
|
161
156
|
</a-switch>
|
|
162
157
|
```
|
|
163
158
|
|
|
164
|
-
|
|
159
|
+
## Styling
|
|
160
|
+
|
|
161
|
+
Reach for the props first: **`tone`** chooses the control color, while **`toneScope`** chooses whether it colors all states or only the checked track. `tone` accepts any CSS color; **`size`** scales the control, label, and hint. The focus ring is the global [`--focus-ring`](../colors.md#focus-ring).
|
|
165
162
|
|
|
166
163
|
```tsx
|
|
167
164
|
<Switch tone="#e0457b" defaultChecked label="Custom color" />
|
package/docs/components/tabs.md
CHANGED
|
@@ -166,6 +166,8 @@ its value is active. The panel names its tab as its accessible label
|
|
|
166
166
|
Panels are **optional**. Without panels, `Tabs` renders the strip. Listen to
|
|
167
167
|
`onStateChange` / `onValueChange` and render the content yourself.
|
|
168
168
|
|
|
169
|
+
### JSX vs DOM
|
|
170
|
+
|
|
169
171
|
The strip renders from the `options` array; each `<TabPanel>` renders a
|
|
170
172
|
self-managing `<a-tabpanel>`. `Tabs` **never reads or toggles the panels**: there's
|
|
171
173
|
no child introspection, so it renders the same in static SSR and works with any
|
|
@@ -196,6 +198,8 @@ and shows/hides **itself** via its own off-DOM `:state(active)`; nothing writes
|
|
|
196
198
|
writes the light DOM, only your JSX does, which keeps a worker-thread reactive engine
|
|
197
199
|
in sync.
|
|
198
200
|
|
|
201
|
+
### Hiding an inactive panel
|
|
202
|
+
|
|
199
203
|
A `<TabPanel>` stays mounted while inactive (its DOM, form values, and scroll
|
|
200
204
|
survive tab switches); `hideMode` picks how it hides:
|
|
201
205
|
|
|
@@ -265,6 +269,8 @@ const [tab, setTab] = useState('overview')
|
|
|
265
269
|
/>
|
|
266
270
|
```
|
|
267
271
|
|
|
272
|
+
## Keyboard & accessibility
|
|
273
|
+
|
|
268
274
|
Every enabled tab is in the tab order; `Tab` / `Shift`+`Tab` step through them.
|
|
269
275
|
The arrow keys also move between enabled tabs (wrapping at the ends), `Home` /
|
|
270
276
|
`End` jump to the first / last, and `Space` / `Enter` activate the focused tab;
|
|
@@ -275,6 +281,8 @@ Pass `label` for the tablist's accessible name. Each `<TabPanel>` names its tab
|
|
|
275
281
|
its accessible label (`aria-labelledby`), set off-DOM so nothing writes the panel's
|
|
276
282
|
attributes.
|
|
277
283
|
|
|
284
|
+
## Routing
|
|
285
|
+
|
|
278
286
|
`Tabs` reports the picked value and leaves navigation to the app, so a strip can
|
|
279
287
|
switch routes as readily as panels. Treat each `value` as a path: control `value`
|
|
280
288
|
from the current location and navigate in `onStateChange` (the pick fires *on click*;
|
|
@@ -319,54 +327,56 @@ so those suit an uncontrolled strip reacting to its own pick. **`onFocus`** /
|
|
|
319
327
|
<Tabs defaultValue="a" onValueChange={(_e, { value }) => route(value)}>…</Tabs>
|
|
320
328
|
```
|
|
321
329
|
|
|
330
|
+
## Tabs props
|
|
331
|
+
|
|
322
332
|
| Prop | Type | Default | Description |
|
|
323
333
|
|------|------|---------|-------------|
|
|
324
|
-
| `children?` | ReactNode | — | Optional `<TabPanel value="…">` panels, one per tab value. Each is a
|
|
325
|
-
|
|
326
|
-
tab. Omit them to use `Tabs` as a bare selectable strip. To place panels in a
|
|
327
|
-
different layout region, or to unmount an inactive panel, drive selection with
|
|
328
|
-
a controlled `value` and render the content yourself (see the docs). |
|
|
329
|
-
| `defaultValue?` | string | — | Initial active value for the uncontrolled case. After first render `Tabs`
|
|
330
|
-
owns selection itself. |
|
|
334
|
+
| `children?` | ReactNode | — | Optional `<TabPanel value="…">` panels, one per tab value. Each is a self-managing `<a-tabpanel>` that shows itself when its `value` is the active tab. Omit them to use `Tabs` as a bare selectable strip. To place panels in a different layout region, or to unmount an inactive panel, drive selection with a controlled `value` and render the content yourself (see the docs). |
|
|
335
|
+
| `defaultValue?` | string | — | Initial active value for the uncontrolled case. After first render `Tabs` owns selection itself. |
|
|
331
336
|
| `disabled?` | boolean | — | Disable the whole strip. |
|
|
332
337
|
| `fill?` | boolean | false | Makes horizontal tabs share the available inline space equally. |
|
|
333
338
|
| `label?` | string | — | Accessible name for the tablist (`aria-label`). |
|
|
334
|
-
| `noslide?` | boolean | — | Disable the sliding indicator. By default the selected-tab indicator animates
|
|
335
|
-
between tabs (a single rectangle, via CSS anchor positioning); `noslide` paints it
|
|
336
|
-
per tab so it snaps with no movement. (Browsers without anchor positioning get that
|
|
337
|
-
per-tab paint automatically — `noslide` is the explicit opt-out.) |
|
|
339
|
+
| `noslide?` | boolean | — | Disable the sliding indicator. By default the selected-tab indicator animates between tabs (a single rectangle, via CSS anchor positioning); `noslide` paints it per tab so it snaps with no movement. (Browsers without anchor positioning get that per-tab paint automatically — `noslide` is the explicit opt-out.) |
|
|
338
340
|
| `onBlur?` | (event) => void | — | Focus left the strip entirely — wired to `focusout`. |
|
|
339
341
|
| `onChange?` | (event) => void | — | Fired *after* the active tab changes — a native `change` event. |
|
|
340
|
-
| `onFocus?` | (event) => void | — | Focus entered the strip (any tab) — wired to `focusin` (focus lands on a tab,
|
|
341
|
-
|
|
342
|
-
| `onStateChange?` | (event, detail) => void | — | Fired whenever the active tab changes — event-first. `detail` is
|
|
343
|
-
`{ next, prev }` (values; `null` = none). Cancelable: `event.preventDefault()`
|
|
344
|
-
vetoes it (uncontrolled), or in controlled mode answer by updating `value`. |
|
|
342
|
+
| `onFocus?` | (event) => void | — | Focus entered the strip (any tab) — wired to `focusin` (focus lands on a tab, not the tablist). |
|
|
343
|
+
| `onStateChange?` | (event, detail) => void | — | Fired whenever the active tab changes — event-first. `detail` is `{ next, prev }` (values; `null` = none). Cancelable: `event.preventDefault()` vetoes it (uncontrolled), or in controlled mode answer by updating `value`. |
|
|
345
344
|
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ value }` snapshot as the 2nd argument. |
|
|
346
|
-
| `options?` | TabOption[] | — | The tabs, as a data array (the strip's single source). Each entry is a
|
|
347
|
-
`
|
|
348
|
-
`
|
|
349
|
-
|
|
350
|
-
| `
|
|
351
|
-
|
|
352
|
-
| `
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
`
|
|
360
|
-
|
|
361
|
-
| `
|
|
362
|
-
|
|
363
|
-
| `
|
|
364
|
-
|
|
365
|
-
| `
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
345
|
+
| `options?` | TabOption[] | — | The tabs, as a data array (the strip's single source). Each entry is a `TabOption` (`value`, `label` or `children`, `icon`, `iconTrailing`, `tone`, `disabled`, `round`, `className`, `style`). `className` and `style` land on that option's individual `<a-tab>`, not on the strip. |
|
|
346
|
+
| `orientation?` | 'horizontal' \| 'vertical' | 'horizontal' | Layout + arrow-key axis. Horizontal ellipsizes labels when tabs overflow (scroll is opt-in via CSS); vertical stacks them. |
|
|
347
|
+
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'primary' | Visual priority. `primary` is the raised pill on a recessed track (the segmented-control look); `secondary` keeps that sizing but drops the track, marking the selected tab with a subtle active background fill; `tertiary` is a bottom-underline indicator under the selected tab (no track, no rest line). `tone` colors `secondary` + `tertiary`; `primary` stays neutral. |
|
|
348
|
+
| `round?` | boolean \| number \| string | — | Fully-round the tabs and the sliding indicator (and the primary track well). Applies strip-wide; a single tab's `round` rounds just that tab. A `number` (px) or CSS length string sets a custom radius on the top-level track well only — the tab pills + indicator stay fully round. |
|
|
349
|
+
| `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size — small 24px · medium 28px · large 32px tall, matching Button's scale (the tab's label leading runs a touch tighter, offset by 1px more block padding per side). |
|
|
350
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Tone applied to the selected indicator/label, or any literal CSS color for a one-off custom tone (derived in oklch). Named tones track light/dark. |
|
|
351
|
+
| `value?` | string | — | Controlled active value — the tab `value` to mark selected (and, when a `<TabPanel value="…">` shares it, the panel to reveal). When set, you own selection: the strip renders exactly what this says, and a user pick only *requests* a change via `onStateChange` — apply it by updating this prop. Leave undefined (and use `defaultValue`) for uncontrolled. |
|
|
352
|
+
|
|
353
|
+
## Tab option props
|
|
354
|
+
|
|
355
|
+
| Prop | Type | Default | Description |
|
|
356
|
+
|------|------|---------|-------------|
|
|
357
|
+
| `value` | string | — | This tab's identity — pairs it with the `<TabPanel value="…">` of the same value, and the value reported by `onStateChange` / `onChange`. Unique per strip. |
|
|
358
|
+
| `children?` | ReactNode | — | Tab content when you need more than a string — used if `label` is omitted. |
|
|
359
|
+
| `className?` | string | — | CSS class on the option's rendered row. |
|
|
360
|
+
| `disabled?` | boolean | — | Disable just this tab — skipped by keyboard nav and dropped from the tab order (a disabled-but-selected tab stays reachable, per the ARIA pattern). |
|
|
361
|
+
| `icon?` | IconShape | — | Leading icon shape, rendered before the label. |
|
|
362
|
+
| `iconTrailing?` | IconShape | — | Trailing icon shape, rendered after the label. |
|
|
363
|
+
| `label?` | ReactNode | — | Visible label. The string shorthand for the tab's content; for richer content pass `children` instead (`label` wins when both are set). |
|
|
364
|
+
| `round?` | boolean | — | Fully-round just this tab's box. `<Tabs round>` rounds the whole strip (tabs + sliding indicator) instead. |
|
|
365
|
+
| `style?` | CSSProperties | — | Inline styles on the option's rendered row. |
|
|
366
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | inherits the strip's `tone | Per-tab tone override, same vocabulary as `<Tabs tone>` — colors this one tab's label + icons (all priorities/modes, named or custom color) and, when it's the active tab, its indicator. For a **custom literal color** the sliding indicator can't adopt it (the shared moving element can't read a descendant's color), so a custom tone colors the label everywhere and the indicator only in `noslide`; the six **named** tones color both in every mode. Overrides the strip's `tone` for this tab. |
|
|
367
|
+
| `tooltip?` | ReactNode | — | Tooltip for this tab — a string or any node — shown **only when one of the tab's ellipsizing label parts is truncated** (tabs ellipsize when the strip overflows), so clipped content reveals its full text on hover while a tab that fits shows nothing. Rendered as a `truncatedOnly` `<Tooltip>` anchored to the tab. For an always-visible tooltip or other custom trigger content, use `children` with your own `<Tooltip>` instead. |
|
|
368
|
+
|
|
369
|
+
## TabPanel props
|
|
370
|
+
|
|
371
|
+
| Prop | Type | Default | Description |
|
|
372
|
+
|------|------|---------|-------------|
|
|
373
|
+
| `value` | string | — | Pairs this panel with the tab (`options` entry) of the same `value`. |
|
|
374
|
+
| `children?` | ReactNode | — | Panel content — arbitrary React/Preact. |
|
|
375
|
+
| `className?` | string | — | CSS class on the rendered `<a-tabpanel>`. |
|
|
376
|
+
| `hideMode?` | 'display' \| 'visibility' | display | How this panel hides while inactive: `display` (default — removed from layout and the a11y tree) or `visibility` (keeps its layout box, to measure it or avoid reflow). Both stay mounted; to *not render* an inactive panel, render it conditionally off a controlled `value` (see the Tabs docs). |
|
|
377
|
+
| `style?` | CSSProperties | — | Inline style on the rendered `<a-tabpanel>`. |
|
|
378
|
+
|
|
379
|
+
## Web Component
|
|
370
380
|
|
|
371
381
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
372
382
|
|
|
@@ -386,6 +396,8 @@ Add `fill` to make horizontal tabs share the available width equally.
|
|
|
386
396
|
</div>
|
|
387
397
|
```
|
|
388
398
|
|
|
399
|
+
## Styling
|
|
400
|
+
|
|
389
401
|
Reach for the props first: **`tone`**, **`size`**, **`priority`**. The focus ring is
|
|
390
402
|
the global `--focus-ring` (see [Colors](../colors.md#focus-ring)).
|
|
391
403
|
|
package/docs/components/tag.md
CHANGED
|
@@ -109,41 +109,30 @@ proper names, identifiers, and case-sensitive IDs keep their shape (`GitHub`,
|
|
|
109
109
|
not `GITHUB`). Pass `allcaps` for the uppercase treatment: at this small size
|
|
110
110
|
all-caps reads as a label at a glance and keeps a uniform, scannable shape,
|
|
111
111
|
which suits short status words where the exact case carries no meaning.
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
Without a theme, both treatments use `0.1ch` tracking. Antune and Antithesis
|
|
113
|
+
retain their font-specific `0.02ch` mixed-case and `0.08ch` uppercase tracking.
|
|
114
|
+
All-caps steps each size down 1px, since caps read larger than mixed case at the
|
|
115
|
+
same size.
|
|
114
116
|
|
|
115
117
|
```tsx
|
|
116
118
|
<Tag icon="external-link" label="GitHub" value="v1.6.9" />
|
|
117
119
|
<Tag allcaps label="Running" />
|
|
118
120
|
```
|
|
119
121
|
|
|
120
|
-
|
|
122
|
+
## Component props
|
|
121
123
|
|
|
122
124
|
| Prop | Type | Default | Description |
|
|
123
125
|
|------|------|---------|-------------|
|
|
124
|
-
| `allcaps?` | boolean | — | Render in all-caps instead of the default normal (mixed) case
|
|
125
|
-
(uppercase tracks wider than the default body-text letter-spacing). |
|
|
126
|
+
| `allcaps?` | boolean | — | Render in all-caps instead of the default normal (mixed) case. |
|
|
126
127
|
| `icon?` | IconShape | — | Leading icon shape. Sits flush before the label, scaled to the pill. |
|
|
127
128
|
| `iconTrailing?` | IconShape | — | Trailing icon shape. Renders last, after the value. |
|
|
128
|
-
| `label?` | string | — | A short "key" shown before the value. When paired with `value` it
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
| `
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
| `size?` | 'small' \| 'medium' \| 'large' | medium | Size variant. `small` = 16px tall, `medium` = 20px, `large` = 24px
|
|
136
|
-
(matching `Button`). Omit the attribute or pass `'medium'` for the
|
|
137
|
-
default — both render identically and emit no DOM attribute. |
|
|
138
|
-
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`)
|
|
139
|
-
for a one-off custom tone. Each tone renders the secondary tag style:
|
|
140
|
-
`--text-3-{tone}` text over an alpha tint of the tone's hue (fill + a
|
|
141
|
-
slightly stronger hairline border). A custom color is tinted the same
|
|
142
|
-
way, with the text deepened to a readable foreground. `'neutral'` (the
|
|
143
|
-
default) is the gray tag — the same as omitting `tone`. |
|
|
144
|
-
| `value?` | string | — | The tag's primary text — a status, count, version, duration, etc.
|
|
145
|
-
Rendered in the default color and weight, with no divider from the
|
|
146
|
-
label; the color + weight contrast does the separating. |
|
|
129
|
+
| `label?` | string | — | A short "key" shown before the value. When paired with `value` it renders bold (weight 600), same color. On its own (no `value`) it's treated as the tag's primary text and keeps the default styling. |
|
|
130
|
+
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | secondary | Emphasis level. `secondary` (the default) is the subtle alpha-tint fill; `primary` is a solid fill with white text; `tertiary` is a transparent outline. Omitting it (or passing `'secondary'`) renders the default and emits no DOM attribute. |
|
|
131
|
+
| `size?` | 'small' \| 'medium' \| 'large' | medium | Size variant. `small` = 16px tall, `medium` = 20px, `large` = 24px (matching `Button`). Omit the attribute or pass `'medium'` for the default — both render identically and emit no DOM attribute. |
|
|
132
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for a one-off custom tone. Each tone renders the secondary tag style: `--text-3-{tone}` text over an alpha tint of the tone's hue (fill + a slightly stronger hairline border). A custom color is tinted the same way, with the text deepened to a readable foreground. `'neutral'` (the default) is the gray tag — the same as omitting `tone`. |
|
|
133
|
+
| `value?` | string | — | The tag's primary text — a status, count, version, duration, etc. Rendered in the default color and weight, with no divider from the label; the color + weight contrast does the separating. |
|
|
134
|
+
|
|
135
|
+
## Web Component
|
|
147
136
|
|
|
148
137
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
149
138
|
|
|
@@ -157,6 +146,8 @@ Use `a-tag-label` for the key and `a-tag-value` for its value.
|
|
|
157
146
|
</a-tag>
|
|
158
147
|
```
|
|
159
148
|
|
|
149
|
+
## Styling
|
|
150
|
+
|
|
160
151
|
Reach for the props first: **`tone`** sets the color (any CSS color for a custom
|
|
161
152
|
tone — it derives the fill / border / text in oklch), **`priority`** the fill style,
|
|
162
153
|
**`size`** the dimensions.
|
package/docs/components/text.md
CHANGED
|
@@ -97,34 +97,19 @@ more" and "Show less". `collapsible` takes effect only with `expandable`.
|
|
|
97
97
|
<Text truncate={3} expandable collapsible>{longSentence}</Text>
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
## Component props
|
|
101
101
|
|
|
102
102
|
| Prop | Type | Default | Description |
|
|
103
103
|
|------|------|---------|-------------|
|
|
104
|
-
| `collapsible?` | boolean | — | Let the reader collapse back after expanding: the chevron becomes a
|
|
105
|
-
|
|
106
|
-
Only takes effect together with `expandable`. |
|
|
107
|
-
| `expandable?` | boolean | — | Show a fade hint and chevron over the truncated text and let the user
|
|
108
|
-
expand it by clicking the chevron region or pressing Enter while the
|
|
109
|
-
chevron has keyboard focus. Only takes effect together with `truncate`.
|
|
110
|
-
On its own, expanding is **one-way** — the control is removed once
|
|
111
|
-
expanded; add `collapsible` for a two-way toggle. |
|
|
104
|
+
| `collapsible?` | boolean | — | Let the reader collapse back after expanding: the chevron becomes a "Show more" / "Show less" toggle that stays visible while expanded. Only takes effect together with `expandable`. |
|
|
105
|
+
| `expandable?` | boolean | — | Show a fade hint and chevron over the truncated text and let the user expand it by clicking the chevron region or pressing Enter while the chevron has keyboard focus. Only takes effect together with `truncate`. On its own, expanding is **one-way** — the control is removed once expanded; add `collapsible` for a two-way toggle. |
|
|
112
106
|
| `inline?` | boolean | — | Render as inline-block instead of the default block element. |
|
|
113
|
-
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' \| 'quaternary' | secondary | Visual priority. Maps to text-1..text-4 (`primary` = text-1, the
|
|
114
|
-
strongest). The default is `secondary` (text-2) — body text reads a
|
|
115
|
-
step softer than the strongest foreground; pass `primary` for emphasis. |
|
|
107
|
+
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' \| 'quaternary' | secondary | Visual priority. Maps to text-1..text-4 (`primary` = text-1, the strongest). The default is `secondary` (text-2) — body text reads a step softer than the strongest foreground; pass `primary` for emphasis. |
|
|
116
108
|
| `size?` | 'small' \| 'medium' \| 'large' | medium | Type scale. `small` = 13/16, `medium` = 15/20, `large` = 17/24. |
|
|
117
|
-
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Color tint. `neutral` (the default) is the untinted `--text-{N}` scale; a
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
| `truncate?` | boolean \| number | — | Truncate with a trailing ellipsis. `true` (or `1`) clamps to a
|
|
122
|
-
single line; any integer ≥ 2 clamps to that many lines; `0` or a
|
|
123
|
-
negative value means no truncation. A clipped, non-expandable JSX
|
|
124
|
-
`Text` shows its text content in a tooltip by default. Nest a
|
|
125
|
-
`<Tooltip>` to provide your own tooltip instead. Uses the
|
|
126
|
-
`-webkit-line-clamp` technique, supported in all major browsers
|
|
127
|
-
(Firefox 68+, Chrome, Safari, Edge). |
|
|
109
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Color tint. `neutral` (the default) is the untinted `--text-{N}` scale; a named tone applies the matching `--text-{N}-{tone}` palette. Any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) is a one-off custom tone — its hue is kept while lightness/chroma are pinned per priority in oklch. |
|
|
110
|
+
| `truncate?` | boolean \| number | — | Truncate with a trailing ellipsis. `true` (or `1`) clamps to a single line; any integer ≥ 2 clamps to that many lines; `0` or a negative value means no truncation. A clipped, non-expandable JSX `Text` shows its text content in a tooltip by default. Nest a `<Tooltip>` to provide your own tooltip instead. Uses the `-webkit-line-clamp` technique, supported in all major browsers (Firefox 68+, Chrome, Safari, Edge). |
|
|
111
|
+
|
|
112
|
+
## Web Component
|
|
128
113
|
|
|
129
114
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
130
115
|
|
|
@@ -136,6 +121,8 @@ Use `<a-text>` directly for a block that carries the text priority and tone.
|
|
|
136
121
|
</a-text>
|
|
137
122
|
```
|
|
138
123
|
|
|
124
|
+
## Styling
|
|
125
|
+
|
|
139
126
|
Color comes from **`priority`** (the neutral text level) and **`tone`** (the tint);
|
|
140
127
|
`size` and the type props set the rest. For a named tone, `Text` consumes the
|
|
141
128
|
global **text role tokens** (`--text-1` … `--text-5`, the `-{tone}` tints,
|
package/docs/components/title.md
CHANGED
|
@@ -93,18 +93,15 @@ The four priorities are shown across every named tone at `level={3}`. Omit
|
|
|
93
93
|
document outline or SEO needs heading elements; the reset applies the same type
|
|
94
94
|
scale.
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
## Component props
|
|
97
97
|
|
|
98
98
|
| Prop | Type | Default | Description |
|
|
99
99
|
|------|------|---------|-------------|
|
|
100
|
-
| `level?` | 1 \| 2 \| 3 \| 4 \| 5 \| 6 | 2 | Heading level, 1-6. Drives font-size, line-height, and vertical
|
|
101
|
-
rhythm. Also surfaced to assistive tech via `aria-level`
|
|
102
|
-
(h1 is typically reserved for the page title). |
|
|
100
|
+
| `level?` | 1 \| 2 \| 3 \| 4 \| 5 \| 6 | 2 | Heading level, 1-6. Drives font-size, line-height, and vertical rhythm. Also surfaced to assistive tech via `aria-level` (h1 is typically reserved for the page title). |
|
|
103
101
|
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' \| 'quaternary' | primary | Visual priority. Maps to text-1..text-4 (`primary` = text-1). |
|
|
104
|
-
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Color tint. `neutral` (the default) is the untinted `--text-{N}` scale; a
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
kept while lightness/chroma are pinned per priority in oklch. |
|
|
102
|
+
| `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | neutral | Color tint. `neutral` (the default) is the untinted `--text-{N}` scale; a named tone applies the matching `--text-{N}-{tone}` palette. Any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) is a one-off custom tone — its hue is kept while lightness/chroma are pinned per priority in oklch. |
|
|
103
|
+
|
|
104
|
+
## Web Component
|
|
108
105
|
|
|
109
106
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
110
107
|
|
|
@@ -116,6 +113,8 @@ Set the heading role and level when writing `<a-title>` directly.
|
|
|
116
113
|
</a-title>
|
|
117
114
|
```
|
|
118
115
|
|
|
116
|
+
## Styling
|
|
117
|
+
|
|
119
118
|
`priority` selects a neutral text level. Named `tone`s use the matching global
|
|
120
119
|
text tokens. A literal `tone` is stored in `--title-tone-source` and resolved
|
|
121
120
|
into the four priority levels.
|
|
@@ -222,13 +222,14 @@ Toaster.manager.add(() => <Banner tone="critical" message="Connection lost" />,
|
|
|
222
222
|
})
|
|
223
223
|
```
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
## Component props
|
|
226
226
|
|
|
227
227
|
| Prop | Type | Default | Description |
|
|
228
228
|
|------|------|---------|-------------|
|
|
229
229
|
| `label?` | string | 'Notifications' | Accessible label for the region landmark. |
|
|
230
|
-
| `toaster?` | Toaster | — | The store this region renders. Omit to bind the default store driven by
|
|
231
|
-
|
|
230
|
+
| `toaster?` | Toaster | — | The store this region renders. Omit to bind the default store driven by `Toaster.manager`; pass a `createToaster()` for an isolated region. |
|
|
231
|
+
|
|
232
|
+
## Web Component
|
|
232
233
|
|
|
233
234
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
234
235
|
|
|
@@ -266,6 +267,8 @@ remove the toast from the DOM.
|
|
|
266
267
|
</script>
|
|
267
268
|
```
|
|
268
269
|
|
|
270
|
+
## Styling
|
|
271
|
+
|
|
269
272
|
The region and item are plain custom elements — style them with ordinary CSS
|
|
270
273
|
(`@layer anta`, so an un-layered rule of yours wins without `!important`).
|
|
271
274
|
|
|
@@ -117,32 +117,20 @@ arrives later works normally; a bubble whose content is cleared while it's open
|
|
|
117
117
|
closes itself. Content that's a single icon or image (an element, no text) still
|
|
118
118
|
shows.
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
## Component props
|
|
121
121
|
|
|
122
122
|
| Prop | Type | Default | Description |
|
|
123
123
|
|------|------|---------|-------------|
|
|
124
|
-
| `children?` | ReactNode | — | Tooltip content. Renders anything — text, markup, an icon + text.
|
|
125
|
-
|
|
126
|
-
| `
|
|
127
|
-
|
|
128
|
-
| `
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
| `
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
can't follow the cursor, even with `follow`). |
|
|
135
|
-
| `placement?` | 'top' \| 'bottom' | bottom | Which side of the anchor the bubble prefers. Auto-flips to the other
|
|
136
|
-
side when there isn't room. |
|
|
137
|
-
| `round?` | boolean \| number \| string | — | Round the bubble to a 20px radius (matching a round menu). Pass a `number`
|
|
138
|
-
(px) or a CSS length string for a custom radius. |
|
|
139
|
-
| `truncatedOnly?` | boolean | — | Only show when the target is actually truncated (its text overflows and is
|
|
140
|
-
ellipsized); a label that fits gets no tooltip. The check is a UI-thread
|
|
141
|
-
layout read, re-measured on each show. By default it measures every Anta
|
|
142
|
-
ellipsizing label part inside the anchor, then the anchor itself —
|
|
143
|
-
override with `truncatedSelector`. |
|
|
144
|
-
| `truncatedSelector?` | string | — | CSS selector (resolved within the anchor) for the element or elements
|
|
145
|
-
whose overflow decides whether a `truncatedOnly` tooltip shows. |
|
|
124
|
+
| `children?` | ReactNode | — | Tooltip content. Renders anything — text, markup, an icon + text. Lives in the light DOM, so it's styleable with your own plain CSS. |
|
|
125
|
+
| `delay?` | number | 300 | Show delay in milliseconds after hover / focus. Never use `0` — use ~`50` for a near-instant tooltip (0 has caused issues in practice). |
|
|
126
|
+
| `follow?` | boolean | — | Follow the cursor instead of pinning under the anchor. The bubble is pinned (anchored beneath the target) by default; pass `follow` for the cursor-tracking behavior, which fades by distance as the cursor leaves. |
|
|
127
|
+
| `interactive?` | boolean | — | Make the bubble hoverable and clickable — enables pointer events and keeps it open while the cursor is over it, so its content (links, buttons) can be interacted with. Always pinned (an interactive bubble can't follow the cursor, even with `follow`). |
|
|
128
|
+
| `placement?` | 'top' \| 'bottom' | bottom | Which side of the anchor the bubble prefers. Auto-flips to the other side when there isn't room. |
|
|
129
|
+
| `round?` | boolean \| number \| string | — | Round the bubble to a 20px radius (matching a round menu). Pass a `number` (px) or a CSS length string for a custom radius. |
|
|
130
|
+
| `truncatedOnly?` | boolean | — | Only show when the target is actually truncated (its text overflows and is ellipsized); a label that fits gets no tooltip. The check is a UI-thread layout read, re-measured on each show. By default it measures every Anta ellipsizing label part inside the anchor, then the anchor itself — override with `truncatedSelector`. |
|
|
131
|
+
| `truncatedSelector?` | string | — | CSS selector (resolved within the anchor) for the element or elements whose overflow decides whether a `truncatedOnly` tooltip shows. |
|
|
132
|
+
|
|
133
|
+
## Web Component
|
|
146
134
|
|
|
147
135
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
148
136
|
|
|
@@ -155,6 +143,8 @@ Place `<a-tooltip>` inside the element it describes.
|
|
|
155
143
|
</a-button>
|
|
156
144
|
```
|
|
157
145
|
|
|
146
|
+
## Styling
|
|
147
|
+
|
|
158
148
|
The bubble lives in shadow DOM and is exposed as a single **part** — style the box
|
|
159
149
|
(background, frost, shadow, radius, padding, a border) with `::part(bubble)`. Its
|
|
160
150
|
*content* is slotted light DOM with a **normalized text baseline** (Anta body
|
package/docs/index.md
CHANGED
|
@@ -41,7 +41,6 @@ Anta is designed for a clean DOM. Prefer the props and attributes exposed by eac
|
|
|
41
41
|
- [Select](./components/select.md)
|
|
42
42
|
- [SelectFaceted](./components/select-faceted.md)
|
|
43
43
|
|
|
44
|
-
- [Box](./components/box.md)
|
|
45
44
|
- [Banner](./components/banner.md)
|
|
46
45
|
- [Card](./components/card.md)
|
|
47
46
|
- [Dialog](./components/dialog.md)
|
|
@@ -49,6 +48,9 @@ Anta is designed for a clean DOM. Prefer the props and attributes exposed by eac
|
|
|
49
48
|
- [Expander](./components/expander.md)
|
|
50
49
|
- [Menu](./components/menu.md)
|
|
51
50
|
|
|
51
|
+
- [Box](./components/box.md)
|
|
52
|
+
- [Capture](./components/capture.md)
|
|
53
|
+
|
|
52
54
|
## Packages
|
|
53
55
|
|
|
54
56
|
- [Table](./packages/table.md)
|
package/docs/install-config.md
CHANGED
|
@@ -15,7 +15,7 @@ of a floating tag such as `"latest"`.
|
|
|
15
15
|
import '@antadesign/anta/tokens.css' // CSS custom properties
|
|
16
16
|
import '@antadesign/anta/reset.css' // reset and typography defaults
|
|
17
17
|
import '@antadesign/anta/elements' // registers <a-*> elements
|
|
18
|
-
import '@antadesign/anta/theme-
|
|
18
|
+
import '@antadesign/anta/theme-antune.css' // optional Antune theme
|
|
19
19
|
import { Progress } from '@antadesign/anta'
|
|
20
20
|
|
|
21
21
|
<Progress value={42} label="Uploaded" hint="3 of 7" />
|
|
@@ -43,18 +43,19 @@ recommended; the reference theme is optional.
|
|
|
43
43
|
|
|
44
44
|
| Import | Provides | Skip if… |
|
|
45
45
|
|---|---|---|
|
|
46
|
-
| `@antadesign/anta/tokens.css` | Six seed tokens, derived role scales (`--bg-1…5`, `--text-1…5`, `--border-1…5`), `.dark`, the 15px root size, and layer order. Override a seed to reskin its tone. | You provide those variables. |
|
|
46
|
+
| `@antadesign/anta/tokens.css` | Six seed tokens, derived role scales (`--bg-1…5`, `--text-1…5`, `--border-1…5`), `.dark` and its `color-scheme`, the 15px root size, and layer order. Override a seed to reskin its tone. | You provide those variables. |
|
|
47
47
|
| `@antadesign/anta/reset.css` | A small reset plus Anta's focus, heading, list, and link typography in `@layer anta.reset`. | You use another reset and typography. |
|
|
48
48
|
| `@antadesign/anta/elements` | Registers every `<a-*>` element and its CSS. Per-element entries register one; see [Registering elements](#registering-elements). | You render only on the server or register elements individually. |
|
|
49
49
|
| `@antadesign/anta` | Typed React/Preact wrappers such as `Progress`, `Text`, and `Icon`. | You write `<a-*>` elements directly. |
|
|
50
50
|
| `@antadesign/anta/bundle.css` | One minified stylesheet containing tokens, reset, element, and JSX-wrapper styles. | You want granular CSS imports. |
|
|
51
51
|
| `@antadesign/anta/bundle` | One minified ESM runtime that registers every `<a-*>` element and re-exports the JSX API. | You want granular JS imports. |
|
|
52
|
-
| `@antadesign/anta/theme-
|
|
52
|
+
| `@antadesign/anta/theme-antune.css` *(optional)* | Antune, the hand-tuned reference palette. Import last to replace the seed-derived default. | You want the seed-derived or your own palette. |
|
|
53
|
+
| `@antadesign/anta/theme-antithesis.css` *(optional)* | Antithesis: warm color seeds, pill buttons, square text fields, and `1px` tag corners. Import as the only theme. | You want Antune, the seed-derived palette, or your own theme. |
|
|
53
54
|
|
|
54
55
|
Load `tokens.css` before element CSS. Elements read its variables; without it,
|
|
55
56
|
they render unstyled.
|
|
56
57
|
|
|
57
|
-
To use the optional reference palette, import `theme-
|
|
58
|
+
To use the optional reference palette, import `theme-antune.css` after the element
|
|
58
59
|
registration import. It ships in `@antadesign/anta`; omit it to keep the
|
|
59
60
|
seed-derived default palette or provide your own theme.
|
|
60
61
|
|
|
@@ -93,6 +94,30 @@ Token custom properties stay unlayered so they apply everywhere.
|
|
|
93
94
|
> `@layer base { … }`; `reset.css` already applies the same universal reset in
|
|
94
95
|
> `@layer anta.reset`.
|
|
95
96
|
|
|
97
|
+
## AI setup
|
|
98
|
+
|
|
99
|
+
Anta includes version-matched Markdown documentation in its npm package.
|
|
100
|
+
Append this section to your application's agent instruction file, such as
|
|
101
|
+
`AGENTS.md`, `CLAUDE.md`, or your tool's equivalent. Keep existing project rules:
|
|
102
|
+
|
|
103
|
+
```md
|
|
104
|
+
## Anta
|
|
105
|
+
|
|
106
|
+
Before Anta UI work, read
|
|
107
|
+
`node_modules/@antadesign/anta/docs/index.md`
|
|
108
|
+
and the pages relevant to the task.
|
|
109
|
+
Verify component names, imports, props, and event signatures against the
|
|
110
|
+
installed documentation and TypeScript declarations. Do not infer Anta APIs
|
|
111
|
+
from similarly named components in other libraries.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The path is relative to the application directory where Anta is installed.
|
|
115
|
+
Adjust it for your workspace or package-manager layout. Installing Anta does
|
|
116
|
+
not modify your agent configuration.
|
|
117
|
+
|
|
118
|
+
For tools without local file access, provide the [web documentation index](https://anta.design/llms.txt)
|
|
119
|
+
and your installed Anta version. Web documentation may describe a newer release.
|
|
120
|
+
|
|
96
121
|
## Registering elements
|
|
97
122
|
|
|
98
123
|
JSX wrappers render `<a-*>` tags. Register their classes before those tags reach
|
|
@@ -235,10 +260,15 @@ Use `dark` or `light` on another ancestor to scope its color scheme and palette.
|
|
|
235
260
|
|
|
236
261
|
## Fonts
|
|
237
262
|
|
|
238
|
-
|
|
263
|
+
Without an optional theme, `tokens.css` defines system stacks in `--sans-serif`,
|
|
264
|
+
`--serif`, and `--monospace`. Reference themes register hosted fonts and replace
|
|
265
|
+
some of those same variables. Components and theme rules decide which stack to
|
|
266
|
+
use. Theme-free components do not force font-specific stylistic sets or
|
|
267
|
+
variable-font axes. `tokens.css` also sets `1rem` to 15px.
|
|
239
268
|
|
|
240
|
-
Register application-owned fonts
|
|
241
|
-
uses separate Roman and Italic
|
|
269
|
+
Register application-owned fonts and redefine the variables in CSS loaded after
|
|
270
|
+
the Anta styles and optional theme. This example uses separate Roman and Italic
|
|
271
|
+
variable files:
|
|
242
272
|
|
|
243
273
|
```css
|
|
244
274
|
@font-face {
|
|
@@ -257,11 +287,15 @@ uses separate Roman and Italic variable files:
|
|
|
257
287
|
|
|
258
288
|
:root {
|
|
259
289
|
--sans-serif: "App Sans", sans-serif;
|
|
290
|
+
--serif: Georgia, serif;
|
|
260
291
|
--monospace: ui-monospace, monospace;
|
|
261
292
|
}
|
|
262
293
|
```
|
|
263
294
|
|
|
264
|
-
|
|
295
|
+
Place this application stylesheet after `theme-antune.css` or
|
|
296
|
+
`theme-antithesis.css`, not before it. When all stylesheets are in the document
|
|
297
|
+
head, the override applies before the first paint. Anta's semantic italics
|
|
298
|
+
(`em`, `i`, `var`, and `dt`) select the Italic face.
|
|
265
299
|
|
|
266
300
|
### Variable slant
|
|
267
301
|
|