@vokality/design-system 5.1.1 → 6.0.0
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/CHANGELOG.md +13 -0
- package/README.md +22 -1
- package/dist/appearance.d.ts +6 -0
- package/dist/appearance.js +1 -0
- package/dist/chat.d.ts +3 -1
- package/dist/components/Accordion/Accordion.d.ts +9 -6
- package/dist/components/Accordion/Accordion.js +4 -8
- package/dist/components/AppShell/AppShell.js +1 -1
- package/dist/components/Badge/Badge.d.ts +5 -1
- package/dist/components/Badge/Badge.js +2 -2
- package/dist/components/Button/Button.d.ts +11 -10
- package/dist/components/Button/Button.js +6 -14
- package/dist/components/ChatPanel/transcript.js +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +2 -2
- package/dist/components/Combobox/Combobox.d.ts +3 -0
- package/dist/components/Combobox/Combobox.js +3 -3
- package/dist/components/Combobox/ListPanel.d.ts +3 -1
- package/dist/components/Combobox/ListPanel.js +2 -2
- package/dist/components/Container/Container.d.ts +7 -4
- package/dist/components/Container/Container.js +3 -4
- package/dist/components/DatePicker/DatePicker.d.ts +3 -0
- package/dist/components/DatePicker/DatePicker.js +3 -3
- package/dist/components/Dialog/Dialog.d.ts +2 -4
- package/dist/components/Dialog/Dialog.js +2 -3
- package/dist/components/Grid/Grid.d.ts +3 -3
- package/dist/components/Heading/Heading.d.ts +14 -9
- package/dist/components/Heading/Heading.js +6 -5
- package/dist/components/IconButton/IconButton.d.ts +7 -7
- package/dist/components/IconButton/IconButton.js +2 -10
- package/dist/components/Inline/Inline.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +6 -1
- package/dist/components/Input/Input.js +3 -3
- package/dist/components/Link/Link.d.ts +18 -3
- package/dist/components/Link/Link.js +7 -7
- package/dist/components/Menu/Menu.d.ts +27 -8
- package/dist/components/Menu/Menu.js +6 -11
- package/dist/components/MultiSelect/MultiSelect.d.ts +3 -0
- package/dist/components/MultiSelect/MultiSelect.js +3 -3
- package/dist/components/OtpInput/OtpInput.d.ts +16 -15
- package/dist/components/OtpInput/OtpInput.js +10 -8
- package/dist/components/PageHeader/PageHeader.d.ts +2 -2
- package/dist/components/PageHeader/PageHeader.js +2 -2
- package/dist/components/Popover/Popover.d.ts +16 -7
- package/dist/components/Popover/Popover.js +4 -3
- package/dist/components/Progress/Progress.d.ts +10 -10
- package/dist/components/Progress/Progress.js +8 -12
- package/dist/components/Prose/Prose.d.ts +4 -3
- package/dist/components/Prose/Prose.js +2 -2
- package/dist/components/Radio/Radio.d.ts +3 -3
- package/dist/components/Radio/Radio.js +4 -3
- package/dist/components/RadioGroup/RadioGroup.d.ts +7 -2
- package/dist/components/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/SearchInput/SearchInput.d.ts +6 -1
- package/dist/components/SearchInput/SearchInput.js +2 -2
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +8 -8
- package/dist/components/SegmentedControl/SegmentedControl.js +4 -3
- package/dist/components/Select/Select.d.ts +4 -9
- package/dist/components/Select/Select.js +2 -7
- package/dist/components/Slider/Slider.d.ts +26 -19
- package/dist/components/Slider/Slider.js +20 -25
- package/dist/components/Sparkline/Sparkline.d.ts +2 -2
- package/dist/components/Sparkline/Sparkline.js +3 -3
- package/dist/components/Stack/Stack.d.ts +2 -2
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Table/Table.js +1 -1
- package/dist/components/Tabs/Tabs.d.ts +11 -9
- package/dist/components/Tabs/Tabs.js +5 -5
- package/dist/components/Text/Text.d.ts +12 -5
- package/dist/components/Text/Text.js +3 -3
- package/dist/components/Textarea/Textarea.d.ts +2 -0
- package/dist/components/Textarea/Textarea.js +3 -3
- package/dist/components/TimePicker/TimePicker.d.ts +2 -0
- package/dist/components/TimePicker/TimePicker.js +5 -5
- package/dist/components/Tooltip/Tooltip.d.ts +11 -6
- package/dist/components/Tooltip/Tooltip.js +5 -3
- package/dist/components.css +274 -130
- package/dist/internal/choice.d.ts +7 -2
- package/dist/internal/choice.js +4 -4
- package/dist/lib/space.d.ts +2 -1
- package/dist/lib/space.js +2 -6
- package/dist/tokens.css +2 -0
- package/dist/tokens.dtcg.json +10 -0
- package/dist/tokens.json +10 -0
- package/dist/types.d.ts +4 -3
- package/dist/typography.d.ts +8 -0
- package/dist/typography.js +34 -0
- package/dist/vokality.css +276 -130
- package/dist/vokality.iife.js +1945 -1863
- package/docs/brand.md +6 -2
- package/docs/components/Accordion/README.md +5 -2
- package/docs/components/Badge/README.md +2 -2
- package/docs/components/Button/README.md +15 -11
- package/docs/components/Checkbox/README.md +4 -0
- package/docs/components/Combobox/README.md +6 -0
- package/docs/components/Container/README.md +2 -1
- package/docs/components/DatePicker/README.md +6 -0
- package/docs/components/Dialog/README.md +2 -2
- package/docs/components/Grid/README.md +2 -1
- package/docs/components/Heading/README.md +4 -2
- package/docs/components/IconButton/README.md +7 -3
- package/docs/components/Inline/README.md +3 -3
- package/docs/components/Input/README.md +6 -0
- package/docs/components/Link/README.md +3 -1
- package/docs/components/Menu/README.md +7 -1
- package/docs/components/MultiSelect/README.md +8 -0
- package/docs/components/NumberInput/README.md +6 -0
- package/docs/components/OtpInput/README.md +10 -2
- package/docs/components/PageHeader/README.md +1 -1
- package/docs/components/PasswordInput/README.md +6 -0
- package/docs/components/Popover/README.md +6 -2
- package/docs/components/Progress/README.md +2 -2
- package/docs/components/Prose/README.md +1 -1
- package/docs/components/Radio/README.md +4 -0
- package/docs/components/RadioGroup/README.md +4 -0
- package/docs/components/SearchInput/README.md +6 -0
- package/docs/components/SegmentedControl/README.md +4 -1
- package/docs/components/Select/README.md +8 -3
- package/docs/components/Slider/README.md +13 -3
- package/docs/components/Sparkline/README.md +1 -1
- package/docs/components/Stack/README.md +1 -1
- package/docs/components/Switch/README.md +4 -0
- package/docs/components/Tabs/README.md +3 -1
- package/docs/components/Text/README.md +6 -3
- package/docs/components/Textarea/README.md +4 -0
- package/docs/components/ThemeProvider/README.md +1 -1
- package/docs/components/TimePicker/README.md +6 -0
- package/docs/components/Tooltip/README.md +4 -3
- package/package.json +9 -1
- package/skills/vokality-design-system/SKILL.md +1 -1
package/docs/brand.md
CHANGED
|
@@ -23,7 +23,7 @@ Build screens from **primitives** first. **Patterns** are primitives already com
|
|
|
23
23
|
|
|
24
24
|
| Layer | Group | Components |
|
|
25
25
|
| --- | --- | --- |
|
|
26
|
-
| Primitives | Actions | `Button` (
|
|
26
|
+
| Primitives | Actions | `Button` (semantic `color`, visual `variant`, `xs`/`sm`/`md`; `loading`, `block`), `IconButton`, `Link`, `Menu` (submenus, checkbox and radio items), `ContextMenu` |
|
|
27
27
|
| Primitives | Form controls | `Field` (label, hint, error), `Input` (prefix, suffix, character count), `Textarea`, `RichTextEditor` (Markdown, emoji, attachment uploads), `PasswordInput`, `NumberInput`, `Slider`, `OtpInput`, `SearchInput`, `Select`, `Combobox`, `MultiSelect`, `DatePicker` (typed or picked), `Calendar`, `TimePicker`, `Checkbox`, `Radio`, `RadioGroup`, `Switch`, `SegmentedControl`, `FileUpload`, `ErrorSummary` |
|
|
28
28
|
| Primitives | Feedback | `Alert`, `Toaster` + `toast()`, `Progress`, `Spinner`, `Skeleton`, `EmptyState` |
|
|
29
29
|
| Primitives | Overlays | `Dialog` (and alert dialog), `Drawer`, `Popover`, `Tooltip`, `CommandPalette` (⌘K) |
|
|
@@ -98,7 +98,7 @@ The test suite checks these pairs in every theme and fails the build if one slip
|
|
|
98
98
|
|
|
99
99
|
## Space and layout
|
|
100
100
|
|
|
101
|
-
- Dense operational apps opt in with `density="compact"` on `ThemeProvider`. The shared compact scale is 20px page titles, 16px section titles, 14px body and fine-pointer controls (16px input text with a coarse pointer, which stops iOS focus zoom), 24px statistics; smaller text (metadata, captions) keeps its size. Table cells, list and navigation rows, menus and cards tighten too. Headers add no trailing section margin; compose vertical rhythm with `Stack`. Actions align with the page title. Controls share a 32px height for fine pointers and retain 44px when a coarse pointer is available.
|
|
101
|
+
- Dense operational apps opt in with `density="compact"` on `ThemeProvider`. The shared compact scale is 20px page titles, 16px section titles, 14px body and fine-pointer controls (16px input text with a coarse pointer, which stops iOS focus zoom), 24px statistics; smaller text (metadata, captions) keeps its size. Table cells, list and navigation rows, menus and cards tighten too. Headers add no trailing section margin; compose vertical rhythm with `Stack`. Actions align with the page title. Controls share a 32px height for fine pointers and retain 44px when a coarse pointer is available. Actions, fields and choices can choose `size="xs"`, `"sm"` or `"md"` independently of the application density; fine-pointer single-line heights are 24px, 32px and 44px. The default scale is unchanged.
|
|
102
102
|
|
|
103
103
|
- Apps: wrap the screen in `AppShell` (56px top bar, 15rem sidebar that collapses to icons and becomes an overlay below 48rem), put a `PageHeader` at the top of each page, and lay out content with `Stack`, `Inline` and `Grid`. Start new pages from the templates.
|
|
104
104
|
- Sites and documents: set content in one frame, max-width 80rem (`--content-max`), outlined left, right and bottom by `border-subtle`, over a faint 10px dot grid (`.vk-dot-grid`) on marketing pages.
|
|
@@ -166,3 +166,7 @@ The test suite checks these pairs in every theme and fails the build if one slip
|
|
|
166
166
|
- Rich-text editing uses `RichTextEditor` from `@vokality/design-system/rich-text`: Markdown is the persisted value, with basic formatting, Unicode emoji and app-provided attachment uploads. The editor uses system tokens and accessible field/toolbar conventions.
|
|
167
167
|
- Components are authored in code. Tokens import into Figma; a parallel Figma component library is optional and is not maintained here.
|
|
168
168
|
- Fonts are Latin subsets.
|
|
169
|
+
|
|
170
|
+
## Appearance APIs
|
|
171
|
+
|
|
172
|
+
Styled wrappers retain the native HTML and Radix behavioral contracts. Shared `color` palettes and `variant` treatments are independent; tokens supply the matching foreground, fill, edge and interaction colors in every theme. Text uses token-backed typography recipes and neutral `emphasis`. Feedback `status` continues to determine semantic content and announcements. Button refs target buttons; navigation uses Link with an anchor ref. Explicit control size remains effective in mixed rows and compact density, subject to the coarse-pointer target policy.
|
|
@@ -6,7 +6,7 @@ A stack of sections that expand and collapse, for long content people scan by he
|
|
|
6
6
|
Rules of 1px `border-subtle` between items. Each heading is a full-width button in Manrope 600 (`text-base`) with a `chevron-down` that turns 180° and goes `primary` when open. The panel holds `small` text in `muted-foreground` and opens and closes by animating its height (`--radix-accordion-content-height`) over `motion-normal`; that motion stops under reduced motion.
|
|
7
7
|
|
|
8
8
|
## Behaviour
|
|
9
|
-
- `type="single"`
|
|
9
|
+
- `type="single"` keeps one item open at a time; `collapsible` allows that item to close again. `type="multiple"` lets several stay open. These are the native Radix contracts.
|
|
10
10
|
- Style state with Radix's attributes: `[data-state=open|closed]` and `[data-disabled]` on `.vk-accordion-item`, `.vk-accordion-heading`, `.vk-accordion-trigger` and `.vk-accordion-panel` (this replaces the old `vk-accordion-open` class).
|
|
11
11
|
- Hover turns the heading `primary-hover`. Focus shows the 2px `ring`.
|
|
12
12
|
|
|
@@ -17,7 +17,10 @@ Enter or Space toggles; ↓ ↑ move between enabled headings (wrapping); Home a
|
|
|
17
17
|
Each heading is a `button` inside a heading element (`headingLevel`, default `h3`) with `aria-expanded` and `aria-controls`; panels are `region`s labelled by their button.
|
|
18
18
|
|
|
19
19
|
## Props
|
|
20
|
-
- `items`: `{ id, title, content, disabled }
|
|
20
|
+
- `items`: `{ id, title, content, disabled }`; `headingLevel` defaults to `h3`.
|
|
21
|
+
- `type="single"`: `value` / `defaultValue` are strings and `onValueChange` receives a string. Set `collapsible` to allow all sections to close.
|
|
22
|
+
- `type="multiple"`: `value` / `defaultValue` are string arrays and `onValueChange` receives a string array.
|
|
23
|
+
- Native Radix root props, attributes, events, orientation, direction and disabled state pass through. The forwarded ref targets its root `div`.
|
|
21
24
|
|
|
22
25
|
## Rules
|
|
23
26
|
- Don't hide what everyone needs. Use an accordion when most people need only one section.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Badge
|
|
2
2
|
|
|
3
|
-
`icon` adds a system status icon beside the label. Standard span attributes and a forwarded ref allow a badge to be a tooltip trigger: `<Tooltip content="Connected recently"><Badge
|
|
3
|
+
`icon` adds a system status icon beside the label. Standard span attributes and a forwarded ref allow a badge to be a tooltip trigger: `<Tooltip content="Connected recently"><Badge color="success" icon="circle-check" tabIndex={0}>Online</Badge></Tooltip>`. Focusable badges show the shared focus ring and provide a `--button-height-sm` target (32px, 44px with a coarse pointer); essential information must also remain visible.
|
|
4
4
|
|
|
5
5
|
A small outlined tag for status, set beside a title or in a table cell.
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ A square outline with 0.2rem 0.5rem padding around a 10px uppercase IBM Plex San
|
|
|
18
18
|
| `danger` | `danger` | `danger-line` | Overdue, Failed |
|
|
19
19
|
|
|
20
20
|
## Props
|
|
21
|
-
- `children`: one or two words ("Beta", "Draft", "Overdue"). `
|
|
21
|
+
- `children`: one or two words ("Beta", "Draft", "Overdue"). `color`.
|
|
22
22
|
|
|
23
23
|
## Rules
|
|
24
24
|
- Status only. Categories go in an eyebrow, not a badge.
|
|
@@ -10,20 +10,23 @@ The button for actions and record names, with square corners and a visible keybo
|
|
|
10
10
|
## Variants
|
|
11
11
|
| Variant | Use | Fill | Border | Label |
|
|
12
12
|
| --- | --- | --- | --- | --- |
|
|
13
|
-
| `
|
|
13
|
+
| `solid` | A high-emphasis action | selected color | selected color | matching foreground, 700 |
|
|
14
|
+
| `soft` | A tinted action | selected tint | none | selected color, 600 |
|
|
14
15
|
| `outline` | Secondary actions | none | `primary` | `foreground`, 600 |
|
|
15
16
|
| `ghost` | Low-emphasis actions in toolbars, dialogs and dense rows | none | none | `foreground`, 600 |
|
|
16
|
-
| `danger` | The confirming action of a destructive dialog ("Delete invoice") | `danger` | `danger` | `on-status`, 700 |
|
|
17
17
|
| `text` | A record name that opens details | none | none | `foreground`, sentence case, 500 |
|
|
18
18
|
|
|
19
|
+
Color is independent of treatment: `color="primary"` (default), `neutral`, `info`, `success`, `warning`, or `danger`. For example, `<Button color="danger" variant="outline">Delete invoice</Button>`. Color uses the active theme's semantic tokens.
|
|
20
|
+
|
|
19
21
|
## Sizes
|
|
20
22
|
| Size | Min height | Label | Padding |
|
|
21
23
|
| --- | --- | --- | --- |
|
|
22
|
-
|
|
|
24
|
+
| omitted | Follows density (40px normally) | 12px | 0.65rem 1.25rem |
|
|
25
|
+
| `md` | 44px | 12px | 0.65rem 1.25rem |
|
|
23
26
|
| `sm` | 32px | 11px | 0.4rem 0.85rem |
|
|
24
27
|
| `xs` | 24px (44px with a coarse pointer) | 11px; 12px for `text` | 0 `space-sm` |
|
|
25
28
|
|
|
26
|
-
Use `xs` in toolbars, record rows and status lines where a 32px control crowds the content. `IconButton`, `Menu`, `Popover` and `SegmentedControl`
|
|
29
|
+
Use `xs` in toolbars, record rows and status lines where a 32px control crowds the content. `IconButton`, `Menu`, `Popover` and `SegmentedControl` use the same `xs`, `sm`, and `md` control sizes. Explicit sizes take precedence over density; coarse pointers keep a 44px target.
|
|
27
30
|
|
|
28
31
|
## States
|
|
29
32
|
| State | Primary | Outline | Ghost |
|
|
@@ -34,20 +37,21 @@ Use `xs` in toolbars, record rows and status lines where a 32px control crowds t
|
|
|
34
37
|
| Busy (`loading`) | spinner, 70% opacity, `progress` cursor, change the label ("Saving…") | same | same |
|
|
35
38
|
| Disabled | no fill, 1px dashed `muted-subtle` edge, `muted-subtle` text, no hover, `not-allowed` cursor | same | no fill or edge, `muted-subtle` text |
|
|
36
39
|
|
|
37
|
-
Every disabled variant drops its
|
|
40
|
+
Every disabled variant drops its color fill instead of fading it, so an unavailable action reads consistently; `text` matches `ghost`. Disabled controls are exempt from WCAG contrast minimums, and `muted-subtle` still clears 4.5:1 on background and card. Forced colors use `GrayText`.
|
|
38
41
|
|
|
39
42
|
## Props
|
|
40
43
|
- `children`: the label in sentence case, starting with a verb.
|
|
41
|
-
- `variant`: `
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
+
- `variant`: `solid` (default), `soft`, `outline`, `ghost`, or `text`. `color` chooses the semantic palette independently.
|
|
45
|
+
- `size`: `xs`, `sm`, or `md`. Omit to follow density.
|
|
46
|
+
- Native button attributes and an `HTMLButtonElement` ref pass through. Pass `type="submit"` in forms. Navigation uses `Link`, which accepts the same appearance props.
|
|
47
|
+
- `arrow` adds a trailing arrow glyph cell.
|
|
44
48
|
- `loading` disables the button, sets `aria-busy` and shows a spinner before the label; `loadingLabel` replaces the label while it runs ("Saving…"). Use it instead of building the spinner yourself.
|
|
45
49
|
- `block` stretches the button to its container (sign-in forms, mobile sheets).
|
|
46
50
|
|
|
47
51
|
## Rules
|
|
48
|
-
- One `primary` per view. Put it first in a row and last in a dialog footer.
|
|
52
|
+
- One main `variant="solid" color="primary"` action per view. Put it first in a row and last in a dialog footer.
|
|
49
53
|
- Under 40rem, buttons stretch to the column width; `text` stays content-sized. Text buttons support multiline labels and keep a 32px minimum target.
|
|
50
|
-
- With `data-density="compact"` on `html`, record names use 14px and action labels keep their size (12px, 11px at `sm`).
|
|
51
|
-
- Beside a field in an `Inline` row, a button takes the field height (44px by default, 32px compact with a fine pointer).
|
|
54
|
+
- With `data-density="compact"` on `html`, record names use 14px and action labels keep their size (12px, 11px at `sm`). Unspecified control sizes follow compact density; an explicit `size` keeps its chosen height. Coarse pointers keep a 44px target.
|
|
55
|
+
- Beside a field in an `Inline` row, a button without an explicit size takes the field height (44px by default, 32px compact with a fine pointer).
|
|
52
56
|
- With a coarse pointer, every button and icon button is 44px in any density (`--button-height` and `--button-height-sm` follow `--control-height`).
|
|
53
57
|
- Don't use a button for navigation inside running text; use `Link`.
|
|
@@ -32,3 +32,7 @@ See [Radix Checkbox](https://www.radix-ui.com/primitives/docs/components/checkbo
|
|
|
32
32
|
- The label states what will be true when checked ("Email me when an invoice is paid").
|
|
33
33
|
- The whole label is the click target.
|
|
34
34
|
- For a setting that applies immediately, use `Switch` instead.
|
|
35
|
+
|
|
36
|
+
## Appearance
|
|
37
|
+
|
|
38
|
+
`size="xs" | "sm" | "md"` controls the choice dimensions and label typography; touch targets retain 44px. `color` selects a shared semantic palette independently of checked state, disabled state and validation. Radix/native callbacks and refs retain their upstream contracts. Forced colors use the system selection palette.
|
|
@@ -41,3 +41,9 @@ WAI-ARIA combobox with list autocomplete: `aria-autocomplete="list"`, `aria-expa
|
|
|
41
41
|
## Rules
|
|
42
42
|
- Use `Select` for short lists people scan; use Combobox from about 10 options up.
|
|
43
43
|
- Put the most common choices first; filtering handles the rest.
|
|
44
|
+
|
|
45
|
+
## Sizes
|
|
46
|
+
|
|
47
|
+
`size="xs" | "sm" | "md"` uses the same scale as buttons and other fields: 24px, 32px or 44px minimum height on fine pointers, with 12px, 14px or 16px field text. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density. Icons, add-ons and trailing controls follow the selected geometry.
|
|
48
|
+
|
|
49
|
+
The portalled option list carries the same size for its text and option spacing. Options with descriptions can grow beyond the minimum row height.
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Centers content at the frame width (`content-max`, 80rem) or the reading width (`prose-max`, 44rem), with the fluid page gutter on each side.
|
|
4
4
|
|
|
5
5
|
## Props
|
|
6
|
-
- `size`: `content` (default) or `prose`. `padded={false}` drops the side gutter.
|
|
6
|
+
- `size`: `content` (default) or `prose`. `padded={false}` drops the side gutter.
|
|
7
|
+
- `as`: the native element to render (`div` by default). Its attributes and events are preserved, such as `id`, ARIA labels, `style`, and form events.
|
|
7
8
|
|
|
8
9
|
## Rules
|
|
9
10
|
- Marketing pages: one `content` container per band. Docs and articles: `prose`.
|
|
@@ -32,3 +32,9 @@ A field that opens a `Calendar` in a popover to choose a date or a date range. T
|
|
|
32
32
|
## Rules
|
|
33
33
|
- Display format follows `locale` (`Intl.DateTimeFormat`, medium date). Never show raw ISO strings to people.
|
|
34
34
|
- In single mode, people can type the date. The field accepts ISO (`2026-10-11`), the locale's numeric order (`10/11/2026` in en-US, `11-10-2026` in Dutch) and month names in the locale or English (`Oct 11 2026`, `11 okt 2026`). On Enter or leaving the field, a valid date is reformatted; anything else (or a date outside `min`/`max`) shows "Enter a date like Oct 11, 2026." Set `allowTyping={false}` for a button-only trigger. Range mode is calendar-only.
|
|
35
|
+
|
|
36
|
+
## Sizes
|
|
37
|
+
|
|
38
|
+
`size="xs" | "sm" | "md"` uses the same scale as buttons and other fields: 24px, 32px or 44px minimum height on fine pointers, with 12px, 14px or 16px field text. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density. Icons, add-ons and trailing controls follow the selected geometry.
|
|
39
|
+
|
|
40
|
+
The calendar panel carries the size tokens across its portal; calendar days keep their component-specific geometry.
|
|
@@ -12,13 +12,13 @@ A modal window that takes focus for a task or decision before people return to t
|
|
|
12
12
|
## Behaviour
|
|
13
13
|
- Radix owns initial focus and Tab order. With the standard header, the close button is the first eligible control. `data-autofocus` has no special meaning; applications can use the native `contentProps.onOpenAutoFocus` hook when a task needs a particular target.
|
|
14
14
|
- Tab and Shift+Tab stay inside the dialog. The page behind can't scroll and is hidden from assistive technology and pointer input while it is open.
|
|
15
|
-
- Esc, the close button and a backdrop click call `onOpenChange(false)
|
|
15
|
+
- Esc, the close button and a backdrop click call `onOpenChange(false)`. Use `trigger` to compose a Radix Trigger; Radix then restores focus to that trigger on close. Imperative openings without a trigger need application-specific focus handling through the native content hooks.
|
|
16
16
|
- `role="alertdialog"` uses Radix AlertDialog: outside presses do nothing, Escape closes, and the `cancel` element receives initial focus. Supply `cancel` and `action` elements to compose native Radix Cancel and Action controls.
|
|
17
17
|
- The panel rises 0.5rem as it fades in (none under reduced motion); it closes at once.
|
|
18
18
|
- Selects, menus, date pickers and popovers inside the body float above the dialog, so a field near the bottom can open its list without being clipped.
|
|
19
19
|
|
|
20
20
|
## Props
|
|
21
|
-
- Native state: `open`, `defaultOpen`, `onOpenChange`.
|
|
21
|
+
- Native state: `open`, `defaultOpen`, `onOpenChange`.
|
|
22
22
|
- Composition: `trigger` (one focusable element that forwards its ref), `title`, `description`, `children`, `footer`, and alert dialog `cancel` / `action` elements.
|
|
23
23
|
- Presentation: `size`, `role`, `hideCloseButton`, `closeLabel`, `className`. Hiding the close button does not disable native dismissal.
|
|
24
24
|
- `contentProps` forwards Radix Content props, including autofocus, Escape and outside-interaction hooks. AlertDialog always owns outside dismissal. The old `dismissible` and `closeOnBackdrop` policies are removed; when an application needs an exception, prevent the corresponding native event explicitly.
|
|
@@ -6,7 +6,8 @@ A responsive grid. With `columns` it is a fixed count (one column under 40rem);
|
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
8
|
- `columns`: a number of equal columns. Or `min`: the smallest column width for an auto-fitting grid (`16rem` default).
|
|
9
|
-
- `gap
|
|
9
|
+
- `gap`: a typed spacing step (`none`, `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`; `lg` default). Use `style.gap` for a custom CSS length.
|
|
10
|
+
- `as`: native element to render; its attributes and events pass through.
|
|
10
11
|
|
|
11
12
|
## Rules
|
|
12
13
|
- Card grids: `min="16rem"`. Stat rows: `min="10rem"`. Form columns: `columns={2}`.
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
A heading at the right level with the right type style, so document structure and visual size can differ when they need to.
|
|
4
4
|
|
|
5
5
|
## Props
|
|
6
|
-
- `level` (1–
|
|
7
|
-
- `
|
|
6
|
+
- `level` (1–6, default 2) sets the native heading element. `size` picks a typed typography recipe (`display-xl`, `heading-1`, `heading-2`, `title`, `title-sm` …); by default level 1 is `heading-1`, 2 `heading-2`, 3 `title`, 4 `title-sm`, 5 `title-xs`, 6 `section-label`.
|
|
7
|
+
- `color`: semantic foreground palette (`neutral`, `primary`, `info`, `success`, `warning`, `danger`).
|
|
8
|
+
- `emphasis`: `default`, `muted`, or `subtle` for neutral text. Semantic colors retain their named foreground.
|
|
9
|
+
- Native heading attributes and events pass through, including `id`, ARIA attributes and `onClick`. The forwarded ref targets the actual heading.
|
|
8
10
|
|
|
9
11
|
## Rules
|
|
10
12
|
- One `h1` per page (usually in `PageHeader`). Don't skip levels; change `size` instead.
|
|
@@ -6,7 +6,10 @@ A square button that shows only an icon, for compact controls: close, menu, prev
|
|
|
6
6
|
1. **Container**: 40×40px square, 1px border (transparent for `ghost`).
|
|
7
7
|
2. **Icon**: one `Icon` at its default size, `currentColor` (`foreground`).
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Appearance
|
|
10
|
+
|
|
11
|
+
`variant` selects `solid`, `soft`, `outline`, or `ghost` (default). `color` independently selects `neutral`, `primary` (default), `info`, `success`, `warning`, or `danger`.
|
|
12
|
+
|
|
10
13
|
| Variant | Border at rest | Use |
|
|
11
14
|
| --- | --- | --- |
|
|
12
15
|
| `ghost` (default) | none | Toolbars, headers, dismiss buttons |
|
|
@@ -21,8 +24,9 @@ A square button that shows only an icon, for compact controls: close, menu, prev
|
|
|
21
24
|
|
|
22
25
|
## Props
|
|
23
26
|
- `icon` (required): an `Icon` name. `label` (required): the action in words; it becomes `aria-label` and the tooltip.
|
|
24
|
-
- `variant`, `size` (
|
|
27
|
+
- `variant`, `color`, and `size` (`xs`, `sm`, or `md`). Omit `size` to follow application density; explicit sizes take precedence. Fine-pointer targets are 24px, 32px, and 44px; coarse pointers keep 44px.
|
|
28
|
+
- Native button attributes and an `HTMLButtonElement` ref pass through. Navigation uses `Link` with appearance props and an `Icon` child.
|
|
25
29
|
|
|
26
30
|
## Rules
|
|
27
31
|
- Always pass `label`. If the action isn't obvious from the icon alone, use a `Button` with text instead.
|
|
28
|
-
-
|
|
32
|
+
- Size controls the target, independently of the icon artwork.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Inline
|
|
2
2
|
|
|
3
|
-
Standard element attributes and events pass through to `as`, including IDs, ARIA labels and form events. Use `<Inline as="form" onSubmit={...}>` for a search toolbar.
|
|
3
|
+
Standard element attributes and events pass through to `as`, including IDs, ARIA labels and form events. Use `<Inline as="form" onSubmit={...}>` for a search toolbar. Give adjacent controls the same explicit `size` when they should align; an explicit size keeps its geometry. `style` can size a flex item; visual controls remain system components.
|
|
4
4
|
|
|
5
5
|
Lays children out in a row that wraps, with one gap. For button groups, tag lists, metadata rows and toolbars.
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
|
-
- `gap
|
|
8
|
+
- `gap`: a typed spacing step (`none`, `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`; `sm` default), `align` (`center` default), `justify` (`flex-start`, `space-between`, `flex-end`), `wrap` (`true` default), `as`.
|
|
9
9
|
|
|
10
10
|
## Rules
|
|
11
|
-
- Buttons in a row: `gap="sm"` (0.5rem)
|
|
11
|
+
- Buttons in a row: `gap="sm"` (0.5rem). Use `style.gap` for a custom CSS length. Toolbars that push actions to the end: `justify="space-between"`.
|
|
@@ -29,3 +29,9 @@ A single-line text control for names, emails, numbers, search and other short va
|
|
|
29
29
|
- Placeholders show an example of the format ("name@company.com"), never the label.
|
|
30
30
|
- Set `type` and `autoComplete` so phones show the right keyboard and autofill works.
|
|
31
31
|
- Use Space Grotesk with `tabular-nums` (`font-family: var(--font-numeric)`) for amounts and codes.
|
|
32
|
+
|
|
33
|
+
## Sizes
|
|
34
|
+
|
|
35
|
+
`size="xs" | "sm" | "md"` uses the same scale as buttons and other fields: 24px, 32px or 44px minimum height on fine pointers, with 12px, 14px or 16px field text. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density. Icons, add-ons and trailing controls follow the selected geometry.
|
|
36
|
+
|
|
37
|
+
`htmlSize` sets the native input width in characters. It is independent of visual `size`; the component still fills its available container width.
|
|
@@ -21,7 +21,7 @@ An inline text link for navigation inside or beside running text.
|
|
|
21
21
|
| Visited | Same as rest |
|
|
22
22
|
|
|
23
23
|
## Props
|
|
24
|
-
- `href`, `children`. `
|
|
24
|
+
- `href`, `children`. `emphasis`: `muted`. `external`: adds the glyph and opens in a new tab.
|
|
25
25
|
|
|
26
26
|
## Rules
|
|
27
27
|
- Link text names the destination ("Billing settings"), never "click here".
|
|
@@ -29,3 +29,5 @@ An inline text link for navigation inside or beside running text.
|
|
|
29
29
|
|
|
30
30
|
## Client-side navigation
|
|
31
31
|
Wrap the app in `LinkProvider` with your router's link component (for example `next/link`) and internal links in `Link`, `Button`, `IconButton`, `Card`, `MediaCard`, `NavList`, `Breadcrumbs` and `ListItem` render with it. Hash, external, `mailto:` and `tel:` links, and links with `target` or `download`, stay plain `<a>`.
|
|
32
|
+
|
|
33
|
+
Inline links accept `emphasis`. An explicit `variant` selects action geometry and enables `size`; those action links use `color` and `variant` for their foreground treatment. The type contract rejects visual props that would have no effect.
|
|
@@ -41,10 +41,16 @@ WAI-ARIA menu button: the trigger has `aria-haspopup="menu"`, `aria-expanded` an
|
|
|
41
41
|
|
|
42
42
|
## Props
|
|
43
43
|
- `items`: `{ label, onSelect, icon, shortcut, danger, disabled }`, checkable and submenu items as above, `{ type: 'separator' }` or `{ type: 'label', label }`.
|
|
44
|
-
- `label` or `icon` + `triggerLabel`, `variant` (`
|
|
44
|
+
- `label` or `icon` + `triggerLabel`, `variant` (`solid`, `soft`, `outline`, `ghost`, or `text`), and semantic `color` (`neutral`, `primary`, `info`, `success`, `warning`, or `danger`). Labelled triggers default to `outline`; icon-only triggers default to `ghost` and support `solid`, `soft`, `outline`, and `ghost`. The type contract requires either a label or an icon.
|
|
45
|
+
- `size`: `xs`, `sm`, or `md` for either trigger kind. Omit to follow density; explicit sizes win. Fine-pointer targets are 24px, 32px, and 44px; coarse pointers keep 44px.
|
|
46
|
+
- `align`, `disabled`, and native Radix root props including `open`, `defaultOpen`, `onOpenChange`, `modal`, and `dir`. `text` draws a labelled trigger in sentence case.
|
|
45
47
|
|
|
46
48
|
## Rules
|
|
47
49
|
- Menus hold actions. To pick a value, use `Select`; to navigate, use links.
|
|
48
50
|
- Put destructive items last, after a separator, and confirm them with a `Dialog`.
|
|
49
51
|
|
|
50
52
|
See the [Radix Dropdown Menu documentation](https://www.radix-ui.com/primitives/docs/components/dropdown-menu) for the underlying interaction contract.
|
|
53
|
+
|
|
54
|
+
Native root state props are forwarded. The forwarded ref targets the trigger button. `triggerProps` accepts native trigger attributes/events; `contentProps` accepts native positioning, focus and dismissal hooks. `side` and `align` use the native Radix placement values. Generated parts own their children, so `asChild` is not exposed on those parts.
|
|
55
|
+
|
|
56
|
+
Entry `onSelect(event)` receives the native Radix selection event; `event.preventDefault()` keeps the menu open.
|
|
@@ -39,3 +39,11 @@ Mouse: click anywhere in the field to open; click options to toggle; click a tag
|
|
|
39
39
|
## Rules
|
|
40
40
|
- With fewer than about six options, a group of `Checkbox`es is clearer.
|
|
41
41
|
- Keep option labels short; they become tags.
|
|
42
|
+
|
|
43
|
+
## Sizes
|
|
44
|
+
|
|
45
|
+
`size="xs" | "sm" | "md"` uses the same scale as buttons and other fields: 24px, 32px or 44px minimum height on fine pointers, with 12px, 14px or 16px field text. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density. Icons, add-ons and trailing controls follow the selected geometry.
|
|
46
|
+
|
|
47
|
+
The portalled option list carries the same size for its text and option spacing. Options with descriptions can grow beyond the minimum row height.
|
|
48
|
+
|
|
49
|
+
Selected tags and the search input fit the selected row height. The field grows when its values wrap onto additional rows.
|
|
@@ -17,3 +17,9 @@ The `Input` box with the value in Space Grotesk (tabular), an optional unit, and
|
|
|
17
17
|
|
|
18
18
|
## Rules
|
|
19
19
|
- For amounts of money, put the currency in `prefix` and keep the field narrow. For values people don't count, such as phone numbers, use `Input`.
|
|
20
|
+
|
|
21
|
+
## Sizes
|
|
22
|
+
|
|
23
|
+
`size="xs" | "sm" | "md"` uses the same scale as buttons and other fields: 24px, 32px or 44px minimum height on fine pointers, with 12px, 14px or 16px field text. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density. Icons, add-ons and trailing controls follow the selected geometry.
|
|
24
|
+
|
|
25
|
+
`htmlSize` sets the native input width in characters. It is independent of visual `size`; the component still fills its available container width.
|
|
@@ -9,13 +9,21 @@ Styled Radix One-Time Password Field parts for a code from an authenticator app,
|
|
|
9
9
|
- Radix owns typing, validation, navigation, selection, paste and autofill. The wrapper adds no keyboard handlers, focus movement, paste parsing or internal value state.
|
|
10
10
|
- A single Tab stop represents the code. Direction keys move between available boxes; Home/End reach the ends. Backspace removes the current character and moves back; Delete removes it and shifts later characters back.
|
|
11
11
|
- Pasting replaces the whole code, regardless of the focused box. Radix assigns `autoComplete="one-time-code"` to its active autofill input.
|
|
12
|
-
- `
|
|
12
|
+
- `onValueChange(code)` is the native Radix callback. `onComplete(code)` also runs for a changed value that fills all `length` boxes. `autoSubmit` and `onAutoSubmit` are available directly from Radix when the form should submit on completion.
|
|
13
13
|
- Radix's `HiddenInput` supplies the single named form value. Disabled fields are excluded from form data.
|
|
14
14
|
|
|
15
15
|
## Props
|
|
16
|
-
- `length
|
|
16
|
+
- `length` composes that many input boxes; `label` names each box ("Digit 3 of 6").
|
|
17
|
+
- Native Radix Root props pass through: `value` + `onValueChange`, or `defaultValue`; `validationType` (`numeric`, `alpha`, `alphanumeric`, `none`), `sanitizeValue`, `type`, `readOnly`, `autoComplete`, `autoFocus`, `autoSubmit`, `onAutoSubmit`, `name`, `form`, `disabled`, `dir`, `orientation`, and div attributes/events.
|
|
18
|
+
- `onComplete(code)` observes a changed value that fills all boxes. It does not submit the form or create separate value state.
|
|
19
|
+
- `inputProps` passes native Radix Input props to every digit, including `onInvalidChange(character)` and native input events. The component owns their indexes, IDs, classes and accessible labels.
|
|
20
|
+
- `id`, `style`, DOM events and the forwarded ref belong to the Root `<div role="group">`. `aria-invalid` reaches every digit; `aria-describedby` also reaches the first digit. Child composition is owned here, so `children` and `asChild` are not exposed.
|
|
17
21
|
|
|
18
22
|
## Rules
|
|
19
23
|
- Say where the code was sent in the `Field` hint ("Sent to •••• 1803"), and offer a resend link below.
|
|
20
24
|
|
|
21
25
|
Labels use `LocaleProvider`; `label` overrides the per-box noun. See the [Radix One-Time Password Field documentation](https://www.radix-ui.com/primitives/docs/components/one-time-password-field) for the underlying behavior.
|
|
26
|
+
|
|
27
|
+
## Sizes
|
|
28
|
+
|
|
29
|
+
`size="xs" | "sm" | "md"` selects 24px, 32px or 44px boxes on fine pointers, with matching text sizes. Boxes still share the available width and wrap on narrow screens. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density and existing digit style.
|
|
@@ -13,7 +13,7 @@ The top of a page inside an app: breadcrumbs, the page title (the page's `h1`),
|
|
|
13
13
|
6. **Divider** (optional): a 1px `border-subtle` rule below.
|
|
14
14
|
|
|
15
15
|
## Props
|
|
16
|
-
- `title`, `description`, `eyebrow`, `breadcrumbs` (items as in `Breadcrumbs`), `actions`, `badge`, `
|
|
16
|
+
- `title`, `description`, `eyebrow`, `breadcrumbs` (items as in `Breadcrumbs`), `actions`, `badge`, `badgeColor`, `divider`, `headingAs`, `children` (rendered below, e.g. `Tabs`).
|
|
17
17
|
|
|
18
18
|
## Rules
|
|
19
19
|
- One page header per page, first in the main area. At most one primary button among its actions.
|
|
@@ -20,3 +20,9 @@ Radix `Root`, `Input`, `Toggle` and `Slot` compose with the system's `Input` usi
|
|
|
20
20
|
- Never block paste. State the rules in the `Field` hint before people type ("At least 12 characters"), not after.
|
|
21
21
|
|
|
22
22
|
See the [Radix Password Toggle Field documentation](https://www.radix-ui.com/primitives/docs/components/password-toggle-field) for the underlying behavior.
|
|
23
|
+
|
|
24
|
+
## Sizes
|
|
25
|
+
|
|
26
|
+
`size="xs" | "sm" | "md"` uses the same scale as buttons and other fields: 24px, 32px or 44px minimum height on fine pointers, with 12px, 14px or 16px field text. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density. Icons, add-ons and trailing controls follow the selected geometry.
|
|
27
|
+
|
|
28
|
+
`htmlSize` sets the native input width in characters. It is independent of visual `size`; the component still fills its available container width.
|
|
@@ -12,8 +12,10 @@ A small non-modal panel attached to a button, for interactive content that doesn
|
|
|
12
12
|
- The page stays usable behind it; nothing else is blocked.
|
|
13
13
|
|
|
14
14
|
## Props
|
|
15
|
-
- `label`, `title`, `icon`, `variant` (`
|
|
16
|
-
-
|
|
15
|
+
- `label`, `title`, `icon`, and `variant` (`solid`, `soft`, `outline` by default, `ghost`, or `text`).
|
|
16
|
+
- `color`: `neutral`, `primary` (default), `info`, `success`, `warning`, or `danger`, independent of variant.
|
|
17
|
+
- `size`: `xs`, `sm`, or `md`. Omit to follow density; explicit sizes take precedence. Fine-pointer targets are 24px, 32px, and 44px; coarse pointers keep 44px. `align`, `width`.
|
|
18
|
+
- Native Radix state and mode: `open`, `defaultOpen`, `onOpenChange`, `modal`. `disabled` disables the native trigger button.
|
|
17
19
|
- `children`: panel content. `close`: one focusable element rendered through Radix Close. The former render-function child is replaced by native Close composition; for more application-specific actions, control `open` through `onOpenChange`.
|
|
18
20
|
|
|
19
21
|
## Accessibility
|
|
@@ -25,3 +27,5 @@ The trigger has `aria-haspopup="dialog"`, `aria-expanded` and `aria-controls`; t
|
|
|
25
27
|
- In a status line, use `variant="text" size="xs"`: the trigger reads in sentence case at 12px (`text-xs`, the size of `Text size="small"` under compact density) and sits at `--control-height-xs`.
|
|
26
28
|
|
|
27
29
|
[Radix Popover documentation](https://www.radix-ui.com/primitives/docs/components/popover) defines focus and dismissal behavior.
|
|
30
|
+
|
|
31
|
+
Native root state props are forwarded. The forwarded ref targets the trigger button. `triggerProps` accepts native trigger attributes/events; `contentProps` accepts native positioning, focus and dismissal hooks. `side` and `align` use the native Radix placement values. Generated parts own their children, so `asChild` is not exposed on those parts.
|
|
@@ -13,9 +13,9 @@ A bar showing how far a task has got, or that it is still running.
|
|
|
13
13
|
- **Tone**: `primary` (default), `success`, `warning`, `danger`, for example a quota bar that turns `warning` past 90%.
|
|
14
14
|
|
|
15
15
|
## Props
|
|
16
|
-
- `value`, `max` (100), `label`, `showValue`, `
|
|
16
|
+
- `value`, `max` (100), `label`, `showValue`, `getValueLabel` ("9.2 of 10 GB"), `color`, `aria-label` when there's no visible label.
|
|
17
17
|
|
|
18
18
|
## Accessibility
|
|
19
|
-
Built on Radix Progress: `role="progressbar"` with `aria-valuenow/min/max` (the current value is omitted when indeterminate; min/max remain available) and the label wired with `aria-labelledby`. Values must be within `0..max`; Radix handles invalid values as indeterminate and reports invalid props. Radix supplies its percentage value label unless `
|
|
19
|
+
Built on Radix Progress: `role="progressbar"` with `aria-valuenow/min/max` (the current value is omitted when indeterminate; min/max remain available) and the label wired with `aria-labelledby`. Values must be within `0..max`; Radix handles invalid values as indeterminate and reports invalid props. Radix supplies its percentage value label unless `getValueLabel` is provided. The track carries `data-state` (`loading`, `complete` or `indeterminate`).
|
|
20
20
|
|
|
21
21
|
[Radix Progress documentation](https://www.radix-ui.com/primitives/docs/components/progress) defines the value and accessibility contract.
|
|
@@ -7,7 +7,7 @@ Headings in Manrope 700, paragraphs in `muted-foreground` at 1.7 line height, `s
|
|
|
7
7
|
|
|
8
8
|
## Props
|
|
9
9
|
- `children` (the HTML, or `dangerouslySetInnerHTML` on your own element inside), `as`, `className`.
|
|
10
|
-
- `
|
|
10
|
+
- `emphasis`: `muted` (default) for articles and release notes; `foreground` when the text is the record itself, such as a task description or a message.
|
|
11
11
|
|
|
12
12
|
## Compact density
|
|
13
13
|
With `data-density="compact"`, prose uses 14px text at 1.6 line height, 0.75em block spacing and headings from 20px down to 14px, so rendered Markdown sits beside compact interface text.
|
|
@@ -23,3 +23,7 @@ A single option in a set where exactly one can be chosen. Use it through `RadioG
|
|
|
23
23
|
## Rules
|
|
24
24
|
- Always give a set a visible group label (`RadioGroup` adds the `legend`).
|
|
25
25
|
- Pre-select a sensible default when there is one.
|
|
26
|
+
|
|
27
|
+
## Appearance
|
|
28
|
+
|
|
29
|
+
`size="xs" | "sm" | "md"` controls the choice dimensions and label typography; touch targets retain 44px. `color` selects a shared semantic palette independently of checked state, disabled state and validation. Radix/native callbacks and refs retain their upstream contracts. Forced colors use the system selection palette.
|
|
@@ -24,3 +24,7 @@ The `fieldset` has `role="radiogroup"`, named by the legend; each option is a `b
|
|
|
24
24
|
- Order options logically (by size, by frequency), not alphabetically by default.
|
|
25
25
|
|
|
26
26
|
See [Radix RadioGroup](https://www.radix-ui.com/primitives/docs/components/radio-group) for the public behavior and root props.
|
|
27
|
+
|
|
28
|
+
## Appearance
|
|
29
|
+
|
|
30
|
+
`size="xs" | "sm" | "md"` controls the choice dimensions and label typography; touch targets retain 44px. `color` selects a shared semantic palette independently of checked state, disabled state and validation. Radix/native callbacks and refs retain their upstream contracts. Forced colors use the system selection palette.
|
|
@@ -21,3 +21,9 @@ Same as `Input` (focus, disabled). The clear button gets a `primary-tint` hover
|
|
|
21
21
|
## Rules
|
|
22
22
|
- Give it an `aria-label` or a visible label that says what it searches.
|
|
23
23
|
- Filter as people type when results are local; on Enter when each search hits the server.
|
|
24
|
+
|
|
25
|
+
## Sizes
|
|
26
|
+
|
|
27
|
+
`size="xs" | "sm" | "md"` uses the same scale as buttons and other fields: 24px, 32px or 44px minimum height on fine pointers, with 12px, 14px or 16px field text. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density. Icons, add-ons and trailing controls follow the selected geometry.
|
|
28
|
+
|
|
29
|
+
`htmlSize` sets the native input width in characters. It is independent of visual `size`; the component still fills its available container width.
|
|
@@ -12,7 +12,10 @@ Arrow keys move the selection (wrapping); one Tab stop for the whole control.
|
|
|
12
12
|
Built on Radix RadioGroup: `role="radiogroup"` (named by `label`) with `radio` buttons and `aria-checked`; the selected segment has `data-state="checked"`.
|
|
13
13
|
|
|
14
14
|
## Props
|
|
15
|
-
- `options`: strings or `{ value, label, icon, disabled }`. `value` + `
|
|
15
|
+
- `options`: strings or `{ value, label, icon, disabled }`. `value` + Radix `onValueChange`, or `defaultValue`.
|
|
16
|
+
- `size`: `xs`, `sm`, or `md`. Omit to follow density; explicit sizes take precedence. Fine-pointer outer heights are 24px, 32px, and 44px; coarse pointers keep 44px.
|
|
17
|
+
- `color`: `neutral`, `primary` (default), `info`, `success`, `warning`, or `danger`. `variant`: `solid`, `soft` (default), or `outline`, applied to the selected segment.
|
|
18
|
+
- `label` or standard ARIA naming, an `HTMLDivElement` ref, and native Radix root props: `name`, `required`, `disabled`, `orientation`, `dir`, `loop`, and DOM attributes/events.
|
|
16
19
|
|
|
17
20
|
## Rules
|
|
18
21
|
- The choice applies immediately. For a choice inside a form, use `RadioGroup`.
|
|
@@ -35,15 +35,20 @@ Implements the WAI-ARIA *select-only combobox* pattern with Radix Select: the tr
|
|
|
35
35
|
## Props
|
|
36
36
|
- `options`: strings or `{ value, label, description, disabled }`.
|
|
37
37
|
- `placeholder`: shown until something is chosen; defaults to the localized select prompt. No value is selected unless supplied through `value` or `defaultValue`.
|
|
38
|
-
- `value` + `
|
|
38
|
+
- `value` + `onValueChange(value)` to control it, or `defaultValue`. These are the original Radix Root props, passed through unchanged. `value=""` shows the placeholder; option values must be non-empty strings. `onValueChange` runs when Radix changes the selected value. Its callback receives the value; look up additional option data in your own typed options when needed.
|
|
39
39
|
- `name`, `form`, `required` and `disabled` pass to Radix Root. Its native form select posts the value, participates in validation and handles reset; disabled controls are excluded.
|
|
40
40
|
- `aria-label` when there is no `Field`; `aria-labelledby`, `aria-describedby` and `aria-invalid` wire accessible presentation.
|
|
41
41
|
- `open`, `defaultOpen` and `onOpenChange` pass directly to Radix; `dir` and `autoComplete` are supported through its Root contract.
|
|
42
|
-
- `size="xs"`: the compact trigger for toolbars and status lines, 24px (`--control-height-xs`) with `text-xs` and `space-sm` padding on fine pointers; a coarse pointer keeps the 44px target. Name it with `aria-label` or a visible label beside it. Forms keep the default size.
|
|
43
42
|
- The ref is the trigger `<button>`, so a `Select` can be a `Tooltip` trigger.
|
|
44
43
|
|
|
45
44
|
## Rules
|
|
46
|
-
- Render inside a `Field`,
|
|
45
|
+
- Render inside a `Field`, or give a toolbar select an accessible name with `aria-label` or `aria-labelledby`.
|
|
47
46
|
- With five or fewer options that people should compare, use a `RadioGroup`.
|
|
48
47
|
- For long lists that need search, use `Combobox`; to pick several, use `MultiSelect`.
|
|
49
48
|
- Never fall back to a native `<select>`.
|
|
49
|
+
|
|
50
|
+
## Sizes
|
|
51
|
+
|
|
52
|
+
`size="xs" | "sm" | "md"` uses the same scale as buttons and other fields: 24px, 32px or 44px minimum height on fine pointers, with 12px, 14px or 16px field text. A coarse pointer keeps 44px targets and 16px field text. Omit `size` to follow the app's density. Icons, add-ons and trailing controls follow the selected geometry.
|
|
53
|
+
|
|
54
|
+
The portalled option list carries the same size for its text and option spacing. Options with descriptions can grow beyond the minimum row height.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Slider
|
|
2
2
|
|
|
3
|
-
Picks
|
|
3
|
+
Picks one or more values from a continuous range by dragging or with the keyboard, for settings where the exact number matters less than the position: volume, a threshold, a budget range preview. Built on Radix Slider.
|
|
4
4
|
|
|
5
5
|
## Anatomy
|
|
6
6
|
1. **Track**: 4px, `card` with an `input-border` edge, inside a 28px hit area.
|
|
@@ -16,9 +16,19 @@ Picks a value from a continuous range by dragging or with the keyboard, for sett
|
|
|
16
16
|
`role="slider"` with Radix-managed `aria-valuenow`, min and max, and `aria-valuetext` from `valueText` or `format` ("$1,200 per month").
|
|
17
17
|
|
|
18
18
|
## Props
|
|
19
|
-
- `value`
|
|
19
|
+
- Native `value` / `defaultValue` are `number[]`. `onValueChange(values)` and `onValueCommit(values)` preserve Radix's callbacks. One thumb is rendered per value; `[20, 80]` renders a range.
|
|
20
|
+
- Native root props pass through, including `min` (0), `max` (100), `step` (1), `minStepsBetweenThumbs`, `preserveThumbOrder`, `orientation`, `dir`, `inverted`, `name`, `form`, disabled state, DOM attributes and events. The forwarded ref targets the native root `span`.
|
|
21
|
+
- `showValue`, `format(value, index)` and `valueText(value, index)` require controlled `value`. The component reads those values directly and maintains no mirror of Radix state. Use `defaultValue` for an uncontrolled slider without dynamic formatted output.
|
|
22
|
+
- `thumbProps(index)` forwards native props to each thumb: distinct accessible names, `aria-valuetext`, attributes, and events. Root `aria-label`, `aria-labelledby`, and `aria-describedby` are also applied to the generated thumbs, including labels supplied by `Field`.
|
|
23
|
+
- `showLimits` displays the minimum and maximum below the track.
|
|
20
24
|
|
|
21
25
|
## Rules
|
|
22
26
|
- If people need an exact number, add a `NumberInput` beside it or use one instead.
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
Radix owns array values, stepping, pointer handling, keyboard behavior, bounds and uncontrolled form reset. Controlled formatted readouts are derived directly from the caller's values. [Radix Slider documentation](https://www.radix-ui.com/primitives/docs/components/slider).
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
const [values, setValues] = useState([20, 80]);
|
|
32
|
+
<Slider value={values} onValueChange={setValues} showValue
|
|
33
|
+
thumbProps={(index) => ({ "aria-label": index === 0 ? "Minimum" : "Maximum" })} />
|
|
34
|
+
```
|
|
@@ -6,7 +6,7 @@ A word-sized trend line beside a number, in a table cell or a `Stat`.
|
|
|
6
6
|
A 1.5px line scaled to its own minimum and maximum, with a 2.5px dot on the latest value. Default 96×28px, in `chart-1`, or a status tone.
|
|
7
7
|
|
|
8
8
|
## Props
|
|
9
|
-
- `values` (numbers, oldest first), `width`, `height`, `
|
|
9
|
+
- `values` (numbers, oldest first), `width`, `height`, `color` (`success`, `danger` …), `label` (its accessible description; defaults to the values).
|
|
10
10
|
|
|
11
11
|
## Rules
|
|
12
12
|
- Sparklines show shape, not amounts: always put the number beside them.
|
|
@@ -5,7 +5,7 @@ Standard element attributes and events pass through to `as`, including IDs, ARIA
|
|
|
5
5
|
Lays children out vertically with one gap from the spacing scale. Use it instead of margins between siblings.
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
|
-
- `gap`: a spacing step (`none`, `xs`, `sm`, `md` default, `lg`, `xl`, `2xl`, `3xl`)
|
|
8
|
+
- `gap`: a spacing step (`none`, `xs`, `sm`, `md` default, `lg`, `xl`, `2xl`, `3xl`). Use `style={{ gap: "1.25rem" }}` for a custom CSS length.
|
|
9
9
|
- `align`: cross-axis alignment (`stretch` by default; `flex-start` to shrink children).
|
|
10
10
|
- `as`: the element (`div` default; `section`, `ul`, `form`).
|
|
11
11
|
|
|
@@ -28,3 +28,7 @@ See [Radix Switch](https://www.radix-ui.com/primitives/docs/components/switch) f
|
|
|
28
28
|
## Rules
|
|
29
29
|
- Use a switch only when the change applies without a Save button. Inside a form that is submitted, use `Checkbox`.
|
|
30
30
|
- Label the setting, not the state ("Weekly summary email", not "On").
|
|
31
|
+
|
|
32
|
+
## Appearance
|
|
33
|
+
|
|
34
|
+
`size="xs" | "sm" | "md"` controls the choice dimensions and label typography; touch targets retain 44px. `color` selects a shared semantic palette independently of checked state, disabled state and validation. Radix/native callbacks and refs retain their upstream contracts. Forced colors use the system selection palette.
|
|
@@ -19,7 +19,9 @@ Tab lands on the selected tab. ← → move between tabs and select them (wrappi
|
|
|
19
19
|
WAI-ARIA tabs with automatic activation: `tablist`, `tab` (`aria-selected`, `aria-controls`, roving `tabIndex`) and `tabpanel` (`aria-labelledby`). Radix manages panel presence and selection. `keepMounted` maps to Radix `forceMount`; inactive panels remain hidden through their `data-state` styling.
|
|
20
20
|
|
|
21
21
|
## Props
|
|
22
|
-
- `tabs`: `{ id, label, content, count, disabled }`. `value` + `
|
|
22
|
+
- `tabs`: `{ id, label, content, count, disabled }`. `value` + `onValueChange`, or `defaultValue` (no selected tab unless supplied). `onValueChange(value)` is the native Radix callback. `label` (the list's accessible name). `keepMounted` keeps hidden panels rendered.
|
|
23
|
+
- Native Radix root props pass through, including `orientation`, `dir`, `activationMode`, attributes, and events. `activationMode` defaults to Radix's `automatic`; `manual` changes panels only on activation.
|
|
24
|
+
- `listProps` configures native list attributes and `loop` (true by default). The forwarded ref targets the root `div`.
|
|
23
25
|
|
|
24
26
|
## Rules
|
|
25
27
|
- Two to six tabs with short labels. Tabs never change the URL's page; use links for that.
|