@slashsuite/ui-react 0.12.0 → 0.13.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/MIGRATING.md +386 -8
- package/README.md +101 -44
- package/agent-docs/components/app-shell.md +139 -0
- package/agent-docs/components/article-layout.md +140 -0
- package/agent-docs/components/audio.md +42 -0
- package/agent-docs/components/avatar-stack.md +64 -0
- package/agent-docs/components/avatar.md +76 -0
- package/agent-docs/components/badge.md +62 -0
- package/agent-docs/components/body-text.md +169 -0
- package/agent-docs/components/bottom-sheet.md +105 -0
- package/agent-docs/components/breadcrumbs.md +66 -0
- package/agent-docs/components/bullet-list.md +54 -0
- package/agent-docs/components/button.md +135 -0
- package/agent-docs/components/call-to-action.md +59 -0
- package/agent-docs/components/callout.md +87 -0
- package/agent-docs/components/card-grid.md +116 -0
- package/agent-docs/components/card.md +128 -0
- package/agent-docs/components/cart-button.md +63 -0
- package/agent-docs/components/centered-layout.md +90 -0
- package/agent-docs/components/chat-composer.md +49 -0
- package/agent-docs/components/chat-message.md +61 -0
- package/agent-docs/components/chat-thread.md +49 -0
- package/agent-docs/components/checkbox.md +81 -0
- package/agent-docs/components/cluster.md +108 -0
- package/agent-docs/components/code-example.md +48 -0
- package/agent-docs/components/code.md +72 -0
- package/agent-docs/components/colour-scheme-toggle.md +98 -0
- package/agent-docs/components/colour-swatch.md +41 -0
- package/agent-docs/components/combobox.md +88 -0
- package/agent-docs/components/confirm-dialog.md +98 -0
- package/agent-docs/components/container.md +51 -0
- package/agent-docs/components/copy-button.md +63 -0
- package/agent-docs/components/copy-line.md +55 -0
- package/agent-docs/components/date-field.md +106 -0
- package/agent-docs/components/date-range-picker.md +108 -0
- package/agent-docs/components/date-time-field.md +73 -0
- package/agent-docs/components/detail-layout.md +147 -0
- package/agent-docs/components/dialog.md +132 -0
- package/agent-docs/components/disclosure.md +70 -0
- package/agent-docs/components/divider.md +62 -0
- package/agent-docs/components/docs-layout.md +164 -0
- package/agent-docs/components/drawer.md +137 -0
- package/agent-docs/components/embed-frame.md +48 -0
- package/agent-docs/components/empty-state.md +70 -0
- package/agent-docs/components/field-dialog.md +98 -0
- package/agent-docs/components/field.md +71 -0
- package/agent-docs/components/fieldset.md +82 -0
- package/agent-docs/components/file-drop.md +52 -0
- package/agent-docs/components/flow-diagram.md +87 -0
- package/agent-docs/components/form-layout.md +144 -0
- package/agent-docs/components/form-row.md +93 -0
- package/agent-docs/components/full-bleed-layout.md +114 -0
- package/agent-docs/components/headings.md +107 -0
- package/agent-docs/components/hero.md +68 -0
- package/agent-docs/components/icon-button.md +90 -0
- package/agent-docs/components/icon.md +59 -0
- package/agent-docs/components/image.md +74 -0
- package/agent-docs/components/input.md +84 -0
- package/agent-docs/components/kbd.md +38 -0
- package/agent-docs/components/key-value-list.md +84 -0
- package/agent-docs/components/lightbox.md +97 -0
- package/agent-docs/components/list-layout.md +152 -0
- package/agent-docs/components/list-row.md +119 -0
- package/agent-docs/components/loading.md +69 -0
- package/agent-docs/components/markdown.md +51 -0
- package/agent-docs/components/media-tile.md +101 -0
- package/agent-docs/components/menu.md +110 -0
- package/agent-docs/components/meta-list.md +69 -0
- package/agent-docs/components/morph.md +134 -0
- package/agent-docs/components/navigation-progress.md +56 -0
- package/agent-docs/components/number-field.md +75 -0
- package/agent-docs/components/outline-region.md +74 -0
- package/agent-docs/components/page-fade.md +117 -0
- package/agent-docs/components/page-header.md +93 -0
- package/agent-docs/components/pagination.md +64 -0
- package/agent-docs/components/pill.md +105 -0
- package/agent-docs/components/popover.md +63 -0
- package/agent-docs/components/price.md +49 -0
- package/agent-docs/components/product-tile.md +78 -0
- package/agent-docs/components/progress-bar.md +66 -0
- package/agent-docs/components/promo-banner.md +46 -0
- package/agent-docs/components/prose-layout.md +87 -0
- package/agent-docs/components/prose.md +41 -0
- package/agent-docs/components/radio-group.md +77 -0
- package/agent-docs/components/scroll-strip.md +48 -0
- package/agent-docs/components/segmented-control.md +135 -0
- package/agent-docs/components/select.md +70 -0
- package/agent-docs/components/show.md +120 -0
- package/agent-docs/components/side-column.md +74 -0
- package/agent-docs/components/sidebar-layout.md +134 -0
- package/agent-docs/components/site-footer.md +63 -0
- package/agent-docs/components/site-search.md +79 -0
- package/agent-docs/components/slider.md +59 -0
- package/agent-docs/components/sortable-list.md +112 -0
- package/agent-docs/components/split-bar.md +54 -0
- package/agent-docs/components/stack.md +197 -0
- package/agent-docs/components/stacked-bar.md +91 -0
- package/agent-docs/components/stat-tile.md +69 -0
- package/agent-docs/components/state-machine.md +95 -0
- package/agent-docs/components/status-pages.md +112 -0
- package/agent-docs/components/stepper.md +54 -0
- package/agent-docs/components/steps.md +74 -0
- package/agent-docs/components/sticky-bar.md +51 -0
- package/agent-docs/components/switch.md +79 -0
- package/agent-docs/components/table-of-contents.md +78 -0
- package/agent-docs/components/table.md +384 -0
- package/agent-docs/components/tabs.md +178 -0
- package/agent-docs/components/text-link.md +110 -0
- package/agent-docs/components/textarea.md +53 -0
- package/agent-docs/components/timeline.md +79 -0
- package/agent-docs/components/toast.md +91 -0
- package/agent-docs/components/trend-chart.md +61 -0
- package/agent-docs/components/video.md +49 -0
- package/agent-docs/llms.txt +174 -0
- package/dist/AppShell.d.ts +25 -9
- package/dist/AppShell.js +67 -33
- package/dist/AppShellMenu.d.ts +31 -18
- package/dist/AppShellMenu.js +72 -45
- package/dist/ArticleLayout.d.ts +36 -0
- package/dist/ArticleLayout.js +27 -0
- package/dist/Audio.d.ts +16 -0
- package/dist/Audio.js +11 -0
- package/dist/Badge.d.ts +2 -1
- package/dist/Badge.js +3 -2
- package/dist/BottomSheet.d.ts +17 -6
- package/dist/BottomSheet.js +62 -11
- package/dist/Breadcrumbs.d.ts +8 -6
- package/dist/Breadcrumbs.js +17 -7
- package/dist/Button.d.ts +1 -0
- package/dist/Button.js +4 -3
- package/dist/CallToAction.d.ts +25 -0
- package/dist/CallToAction.js +17 -0
- package/dist/Callout.d.ts +2 -2
- package/dist/Callout.js +2 -2
- package/dist/Card.d.ts +88 -31
- package/dist/Card.js +55 -92
- package/dist/CardBody.d.ts +2 -0
- package/dist/CardBody.js +33 -3
- package/dist/CardGrid.d.ts +32 -4
- package/dist/CardGrid.js +42 -8
- package/dist/CardParts.d.ts +7 -1
- package/dist/CardParts.js +7 -2
- package/dist/CartButton.d.ts +33 -0
- package/dist/CartButton.js +18 -0
- package/dist/ChatComposer.d.ts +10 -4
- package/dist/ChatComposer.js +35 -13
- package/dist/Checkbox.d.ts +21 -3
- package/dist/Checkbox.js +66 -20
- package/dist/Chevron.js +1 -1
- package/dist/Cluster.d.ts +28 -15
- package/dist/Cluster.js +21 -4
- package/dist/Code.d.ts +15 -3
- package/dist/Code.js +23 -3
- package/dist/CodeBlock.d.ts +4 -4
- package/dist/CodeBlock.js +2 -2
- package/dist/CodeBody.d.ts +1 -1
- package/dist/CodeBody.js +4 -10
- package/dist/CodeExample.d.ts +1 -1
- package/dist/CodeExample.js +3 -2
- package/dist/ColourSchemeToggle.d.ts +21 -5
- package/dist/ColourSchemeToggle.js +15 -9
- package/dist/ColourSwatch.d.ts +15 -0
- package/dist/ColourSwatch.js +14 -0
- package/dist/Combobox.d.ts +42 -0
- package/dist/Combobox.js +43 -0
- package/dist/ConfirmDialog.d.ts +40 -0
- package/dist/ConfirmDialog.js +36 -0
- package/dist/Container.d.ts +3 -3
- package/dist/Container.js +1 -1
- package/dist/CopyButton.d.ts +8 -2
- package/dist/CopyButton.js +38 -28
- package/dist/CopyLine.d.ts +4 -2
- package/dist/CopyLine.js +4 -4
- package/dist/DateCalendar.d.ts +2 -0
- package/dist/DateCalendar.js +11 -9
- package/dist/DateField.d.ts +52 -21
- package/dist/DateField.js +73 -37
- package/dist/DateFieldCalendar.d.ts +12 -8
- package/dist/DateFieldCalendar.js +37 -18
- package/dist/DateRangePicker.d.ts +23 -3
- package/dist/DateRangePicker.js +10 -8
- package/dist/DateTimeField.d.ts +31 -0
- package/dist/DateTimeField.js +19 -0
- package/dist/Dialog.d.ts +42 -6
- package/dist/Dialog.js +50 -12
- package/dist/Disclosure.js +9 -1
- package/dist/DocsLayout.d.ts +13 -5
- package/dist/DocsLayout.js +11 -9
- package/dist/Drawer.d.ts +22 -7
- package/dist/Drawer.js +89 -8
- package/dist/EmbedFrame.d.ts +36 -0
- package/dist/EmbedFrame.js +18 -0
- package/dist/Field.d.ts +41 -4
- package/dist/Field.js +61 -25
- package/dist/FieldDialog.d.ts +8 -3
- package/dist/FieldDialog.js +19 -9
- package/dist/Fieldset.d.ts +3 -3
- package/dist/Fieldset.js +7 -9
- package/dist/FileDrop.js +2 -1
- package/dist/FlowDiagram.d.ts +92 -0
- package/dist/FlowDiagram.js +100 -0
- package/dist/FormRow.d.ts +6 -4
- package/dist/FormRow.js +11 -9
- package/dist/Hero.d.ts +30 -7
- package/dist/Hero.js +23 -9
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +1 -1
- package/dist/IconButton.js +1 -1
- package/dist/Image.d.ts +33 -9
- package/dist/Image.js +61 -16
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +4 -4
- package/dist/InputShell.d.ts +7 -0
- package/dist/InputShell.js +18 -3
- package/dist/KeyValueList.d.ts +2 -2
- package/dist/Lightbox.js +5 -3
- package/dist/ListRow.d.ts +4 -5
- package/dist/ListRow.js +36 -26
- package/dist/Mark.d.ts +10 -0
- package/dist/Mark.js +9 -0
- package/dist/Markdown.d.ts +18 -4
- package/dist/Markdown.js +176 -37
- package/dist/MediaTile.d.ts +9 -3
- package/dist/MediaTile.js +8 -4
- package/dist/Menu.d.ts +19 -8
- package/dist/Menu.js +13 -11
- package/dist/MetaList.d.ts +4 -3
- package/dist/MetaList.js +12 -4
- package/dist/Morph.d.ts +15 -1
- package/dist/Morph.js +70 -22
- package/dist/NavigationProgress.d.ts +2 -2
- package/dist/NavigationProgress.js +7 -5
- package/dist/NumberField.d.ts +66 -0
- package/dist/NumberField.js +68 -0
- package/dist/OutlineRegion.d.ts +41 -10
- package/dist/OutlineRegion.js +31 -6
- package/dist/PageFade.d.ts +9 -5
- package/dist/PageFade.js +39 -8
- package/dist/PageLayouts.d.ts +15 -5
- package/dist/PageLayouts.js +3 -3
- package/dist/Pill.d.ts +9 -4
- package/dist/Pill.js +15 -6
- package/dist/Popover.d.ts +31 -0
- package/dist/Popover.js +43 -0
- package/dist/Price.d.ts +21 -0
- package/dist/Price.js +34 -0
- package/dist/ProductTile.d.ts +36 -0
- package/dist/ProductTile.js +31 -0
- package/dist/ProgressBar.js +4 -2
- package/dist/PromoBanner.d.ts +25 -0
- package/dist/PromoBanner.js +16 -0
- package/dist/RadioGroup.d.ts +18 -8
- package/dist/RadioGroup.js +42 -18
- package/dist/ScrollStrip.d.ts +1 -1
- package/dist/ScrollStrip.js +1 -1
- package/dist/SearchInput.d.ts +17 -2
- package/dist/SearchInput.js +72 -13
- package/dist/SegmentedField.d.ts +15 -0
- package/dist/SegmentedField.js +15 -0
- package/dist/Select.js +5 -4
- package/dist/Show.d.ts +1 -1
- package/dist/Show.js +1 -1
- package/dist/SideColumn.d.ts +42 -15
- package/dist/SideColumn.js +45 -19
- package/dist/SiteFooter.d.ts +3 -3
- package/dist/SiteFooter.js +4 -3
- package/dist/SiteSearch.d.ts +57 -27
- package/dist/SiteSearch.js +13 -93
- package/dist/Slider.d.ts +27 -0
- package/dist/Slider.js +58 -0
- package/dist/SortableList.d.ts +19 -35
- package/dist/SortableList.js +36 -88
- package/dist/Stack.d.ts +4 -4
- package/dist/StackedBar.d.ts +13 -4
- package/dist/StackedBar.js +12 -7
- package/dist/StateMachine.d.ts +65 -0
- package/dist/StateMachine.js +113 -0
- package/dist/StatusPages.d.ts +28 -10
- package/dist/StatusPages.js +10 -10
- package/dist/Stepper.d.ts +21 -0
- package/dist/Stepper.js +33 -0
- package/dist/Steps.js +4 -3
- package/dist/Switch.d.ts +3 -3
- package/dist/Switch.js +18 -14
- package/dist/Table.d.ts +32 -9
- package/dist/Table.js +50 -20
- package/dist/TableCells.d.ts +24 -21
- package/dist/TableCells.js +68 -27
- package/dist/TableEditCell.d.ts +1 -1
- package/dist/TableOfContents.d.ts +34 -0
- package/dist/TableOfContents.js +23 -0
- package/dist/Tabs.d.ts +31 -16
- package/dist/Tabs.js +97 -22
- package/dist/TextLink.d.ts +18 -5
- package/dist/TextLink.js +19 -6
- package/dist/Textarea.d.ts +12 -1
- package/dist/Textarea.js +15 -2
- package/dist/ToastRegion.d.ts +17 -9
- package/dist/ToastRegion.js +70 -13
- package/dist/Tooltip.d.ts +10 -2
- package/dist/Tooltip.js +32 -11
- package/dist/Video.d.ts +19 -4
- package/dist/Video.js +15 -5
- package/dist/cardContext.d.ts +7 -0
- package/dist/cardContext.js +14 -0
- package/dist/cardControl.d.ts +15 -0
- package/dist/cardControl.js +32 -0
- package/dist/cardForm.d.ts +39 -0
- package/dist/cardForm.js +81 -0
- package/dist/cardWait.js +2 -1
- package/dist/colourScheme.d.ts +12 -2
- package/dist/colourScheme.js +32 -6
- package/dist/control.d.ts +30 -8
- package/dist/control.js +74 -7
- package/dist/copyScript.d.ts +7 -8
- package/dist/copyScript.js +8 -9
- package/dist/cx.d.ts +22 -3
- package/dist/cx.js +22 -3
- package/dist/dateLocale.d.ts +17 -0
- package/dist/dateLocale.js +30 -0
- package/dist/density.d.ts +15 -1
- package/dist/density.js +27 -8
- package/dist/emptySlot.d.ts +1 -0
- package/dist/fieldAnnounce.d.ts +11 -0
- package/dist/fieldAnnounce.js +36 -0
- package/dist/fieldControl.d.ts +7 -2
- package/dist/fieldControl.js +6 -2
- package/dist/fieldWait.d.ts +3 -3
- package/dist/fieldWait.js +3 -4
- package/dist/flowLayout.d.ts +68 -0
- package/dist/flowLayout.js +105 -0
- package/dist/fromXState.d.ts +73 -0
- package/dist/fromXState.js +110 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +15 -0
- package/dist/index.d.ts +37 -11
- package/dist/index.js +24 -2
- package/dist/isoDate.d.ts +8 -1
- package/dist/isoDate.js +20 -1
- package/dist/labelWords.d.ts +16 -7
- package/dist/labelWords.js +14 -12
- package/dist/listRowProps.d.ts +17 -15
- package/dist/modal.d.ts +5 -0
- package/dist/modal.js +21 -1
- package/dist/navFold.js +6 -3
- package/dist/optionCard.d.ts +18 -0
- package/dist/optionCard.js +16 -0
- package/dist/scrollBody.d.ts +16 -0
- package/dist/scrollBody.js +15 -0
- package/dist/scrollEdges.d.ts +7 -0
- package/dist/scrollEdges.js +39 -5
- package/dist/scrollStop.d.ts +6 -2
- package/dist/scrollStop.js +24 -8
- package/dist/shownDate.d.ts +28 -10
- package/dist/shownDate.js +41 -22
- package/dist/siteSearchBody.d.ts +34 -0
- package/dist/siteSearchBody.js +117 -0
- package/dist/size.d.ts +7 -1
- package/dist/sortableDrop.d.ts +44 -0
- package/dist/sortableDrop.js +78 -0
- package/dist/sortableSlide.d.ts +9 -0
- package/dist/sortableSlide.js +70 -0
- package/dist/sortableTitle.d.ts +10 -0
- package/dist/sortableTitle.js +48 -0
- package/dist/stateMachineDots.d.ts +45 -0
- package/dist/stateMachineDots.js +162 -0
- package/dist/stickyColumn.d.ts +2 -2
- package/dist/stickyColumn.js +2 -2
- package/dist/switcher.d.ts +10 -5
- package/dist/switcher.js +7 -5
- package/dist/tableColumns.d.ts +17 -0
- package/dist/tableColumns.js +30 -2
- package/dist/tableEmpty.js +5 -5
- package/dist/tableRow.d.ts +26 -2
- package/dist/tableRow.js +23 -1
- package/dist/tableSort.d.ts +10 -5
- package/dist/tableSort.js +15 -4
- package/dist/target.d.ts +12 -0
- package/dist/target.js +12 -0
- package/dist/textBox.js +1 -1
- package/dist/truncated.d.ts +31 -0
- package/dist/truncated.js +51 -0
- package/dist/typography.d.ts +19 -11
- package/dist/typography.js +11 -13
- package/dist/useFlowLayout.d.ts +27 -0
- package/dist/useFlowLayout.js +119 -0
- package/package.json +7 -3
- package/skills/uislash/SKILL.md +20 -0
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> **Agents:** the docs for this version ship in this package as Markdown. Read `agent-docs/llms.txt` (the index) first, then only the `agent-docs/components/<slug>.md` pages your task needs.
|
|
2
|
+
|
|
1
3
|
# @slashsuite/ui-react
|
|
2
4
|
|
|
3
5
|
UISlash React components, written against Tailwind v4 utilities. They carry no theme: pair them
|
|
@@ -16,9 +18,10 @@ bun add @slashsuite/ui-react
|
|
|
16
18
|
# optional type peers: @types/react, @types/react-dom (install them in a TypeScript app)
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
Two runtime dependencies come with it: `react-aria-components` (and `@internationalized/date`),
|
|
20
22
|
for the date controls (`DateField`, `DateRangePicker`), `Menu`, `Disclosure`, `RadioGroup` and
|
|
21
|
-
`SortableList`'s keyboard and drag
|
|
23
|
+
`SortableList`'s keyboard and drag, and `@dagrejs/dagre`, which lays out `FlowDiagram`. Neither
|
|
24
|
+
brings CSS; the classes are ours.
|
|
22
25
|
|
|
23
26
|
Tailwind skips `node_modules`, so tell it to scan the build for the utilities the components use,
|
|
24
27
|
in the stylesheet that imports Tailwind (the path is relative to that file):
|
|
@@ -28,6 +31,16 @@ in the stylesheet that imports Tailwind (the path is relative to that file):
|
|
|
28
31
|
@source "../node_modules/@slashsuite/ui-react/dist";
|
|
29
32
|
```
|
|
30
33
|
|
|
34
|
+
## Agent skill
|
|
35
|
+
|
|
36
|
+
The package ships a skill, `skills/uislash/SKILL.md`, that tells a coding agent (Claude Code, or any agent that reads `.claude/skills`) to build with the docs that ship in the package, `agent-docs/`, and to typecheck when it is done. Copy it into your app once, from the app's root:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
mkdir -p .claude/skills && cp -r node_modules/@slashsuite/ui-react/skills/uislash .claude/skills/
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Copy it again after an upgrade, so it matches the installed docs.
|
|
43
|
+
|
|
31
44
|
## Use
|
|
32
45
|
|
|
33
46
|
```tsx
|
|
@@ -45,7 +58,7 @@ export const Example = () => (
|
|
|
45
58
|
|
|
46
59
|
No component takes `className` or `style`, as an own prop or through the HTML props it spreads
|
|
47
60
|
(`data-*`, `aria-*`, `id`, `title` and event props still pass). `Badge` pins to a corner with
|
|
48
|
-
`corner`, `
|
|
61
|
+
`corner`, a `Stack divided` draws the line between rows; a look the component lacks is a prop or variant
|
|
49
62
|
to propose, not a class to add. A router link is drawn by the app's `LinkProvider` (see Router links), never
|
|
50
63
|
by copying a component's classes.
|
|
51
64
|
|
|
@@ -58,9 +71,9 @@ root (`DateField`) puts `data-*` on its wrapper and `aria-describedby` on the fi
|
|
|
58
71
|
|
|
59
72
|
One scale runs through the library: `Size` is `"sm" | "md" | "lg"`, and `md` is the default
|
|
60
73
|
wherever a component takes `size`. The controls (`Button` (also as a link), `IconButton`,
|
|
61
|
-
`ColourSchemeToggle`, `Input` (also `type="search"`), `Select`, `Textarea`, `Checkbox`, `Switch`, `RadioGroup`,
|
|
74
|
+
`ColourSchemeToggle`, `Input` (also `type="search"`), `Select`, `Combobox`, `NumberField`, `Slider`, `Textarea`, `Checkbox`, `Switch`, `RadioGroup`,
|
|
62
75
|
`DateField` (also with `calendar`), `SegmentedControl`, `Tabs orientation="vertical"`)
|
|
63
|
-
share heights at each step (`sm` 26px, `md` 38px, `lg` 46px, the same on a `Select` and a `DateField` as on an `Input`; a Playwright check measures them side by side in every theme), so a row of mixed controls at one size lines up. The text of a `Button`, `Input`, `Select`, `Textarea`, `DateField`, `DateRangePicker`, `SegmentedControl` and vertical `Tabs` is `text-sm`, `text-base` and `text-lg` at `sm`, `md` and `lg`, one step down under `AppShell density="compact"`, and a field is never under 16px on a touch screen; a `Checkbox`, `Switch` or `RadioGroup` label
|
|
76
|
+
share heights at each step (`sm` 26px, `md` 38px, `lg` 46px, the same on a `Select` and a `DateField` as on an `Input`; a Playwright check measures them side by side in every theme), so a row of mixed controls at one size lines up. The text of a `Button`, `Input`, `Select`, `Textarea`, `DateField`, `DateRangePicker`, `SegmentedControl` and vertical `Tabs` is `text-sm`, `text-base` and `text-lg` at `sm`, `md` and `lg`, one step down under `AppShell density="compact"`, and a field is never under 16px on a touch screen; a `Checkbox`, `Switch` or `RadioGroup` label takes the type of a text control of its size. `RadioGroup` and `Checkbox` take `variant="card"` for option cards: a bordered box, the label its title and the hint its description. `Button`, `IconButton`, `SegmentedControl` and `Icon` also take a `ResponsiveSize`, `{ base, md }`, which changes at the `md` breakpoint in CSS. `Card`, `ListRow`,
|
|
64
77
|
`FileDrop`, `Dialog`, `Drawer`, `Avatar`, `SubsectionHeading`, `TextLink` and the bars take the
|
|
65
78
|
same three names. Where a scale goes past them, and the few defaults that are not `md`, are
|
|
66
79
|
listed once, on the `Size` type. `TextLink` with no `size` takes the size of the text around it. Upgrading: `MIGRATING.md`, shipped in the package (`node_modules/@slashsuite/ui-react/MIGRATING.md`).
|
|
@@ -77,24 +90,24 @@ disabled: leave it out, or say in the text why it is not there.
|
|
|
77
90
|
|
|
78
91
|
## What is exported
|
|
79
92
|
|
|
80
|
-
- Primitives: `Card` (a bordered panel; `title` and `count` make a small heading, `titleStyle="name"` sets the title in sentence case in the primary ink for a card that is a named thing (the default `overline` is small uppercase), and `status` (a `Pill` or any node) sits right after them, where `actions` sits at the far end; `flush` drops the padding and clips the corners, for a table that runs edge to edge; `bar` moves the title, count and `actions` into a tinted strip over the body; an empty state is an `EmptyState`, not a card form; `badge` pins a `Pill` to the top corner at the end edge over the content, on a panel or a link card
|
|
93
|
+
- Primitives: `Card` (a bordered panel; `title` and `count` make a small heading, `titleStyle="name"` sets the title in sentence case in the primary ink for a card that is a named thing (the default `overline` is small uppercase), and `status` (a `Pill` or any node) sits right after them, where `actions` sits at the far end; `flush` drops the padding and clips the corners, for a table that runs edge to edge; `bar` moves the title, count and `actions` into a tinted strip over the body; an empty state is an `EmptyState`, not a card form; `badge` pins a `Pill` to the top corner at the end edge over the content, on a panel or a link card; `icon` puts one of the `Icon` set's names above the title at `feature` size in the accent colour, decorative, on a panel or a link card but not a `bar` or `flush` one; `attention` draws the strong warn edge (`border-amber-600`) round a card that needs a look, with or without `tone="warn"`; `footer` puts a tinted strip under a hairline across the bottom, for the card's own actions or a total: it takes the padding off the root and gives it to the body, so the strip runs edge to edge and stays at the foot of a card stretched in a `CardGrid`; not on a card that is a link; `fill` takes the parent's full height: the title or bar and the `inset` band stay put and the body scrolls; the parent sets the height; not on a card that is a link; `inset` is a full-bleed band (a progress bar, a chart, an image) under the title and over the children, running edge to edge of a padded card; a bordered sub-card inside a card is a nested `Card tone="neutral"`; a panel (no `href` or `onPress`) with a `title` or an `aria-label` is an `article` and any other card a `div`; `hue` paints one of a set of peer cards in its own hue (`orange`, `violet`, `sky`, `green`, `yellow` or `blue`), not a status, and never with `tone`; `dashed` draws a dashed edge for a card that stands for something not real yet, its `bar` strip's edge dashed too; `width="sm"` caps a card at 24rem; `onPress` makes the whole card one button and `href` one link, each named by the title, and `more` adds a "Read more" line to a link card; the title is an `h2` on the page and an `h3` in a `Section`, and `level` sets it by hand; `size="sm"` makes a `Button`, `IconButton` or `Pill` inside with no `size` `sm` too, and a `Stack` in any card is `xs` apart; `id`, `data-*` and `aria-*` go on the root (on a link card too: the link inside takes only its own `aria-label`, `aria-labelledby`, `aria-current` and `aria-pressed`); a titled panel is named by its title through `aria-labelledby`, unless you pass your own `aria-label` or `aria-labelledby`; a Card with an `id` is an anchor target, scrolled clear of the sticky header and outlined in the accent colour while it is the `:target`), `Pill` (a small tinted label; `tone` is what it means, `neutral` (default), `info`, `positive`, `warn` or `danger`, or `accent` for a category that is none of those; `size` is `sm`, `md` (default) or `lg`, and left out it takes its container's; `dot`, `round` and `title` (its tooltip on hover, keyboard focus and a tap, and its description; a plain pill with one takes a tab stop); `name` makes it a two-tone `name: value` pill, the name keeping the tint and the children, the value, on the surface; `href` makes it a link and `onClick` a button; `onRemove` with `removeLabel` adds an x button, a separate button beside a link or button pill and never inside it), `Markdown` (a small, safe renderer for short notes; `md` (required) is the source; it supports `## ` and `### ` headings, `- ` or `* ` bullets, `**bold**` and paragraphs, rendered as React nodes, never as HTML; while `loading` with no `md` yet, it draws a paragraph of bones), `Badge` (a small red count for sitting on an icon; `count` above 99 reads `99+`, `corner` pins it to the top corner at the end edge of its `relative` parent; an `IconButton` takes `count` and does this itself).
|
|
81
94
|
- Data: `StatTile` (one headline figure: an uppercase `label` over a large tabular `value`, already formatted, an optional `hint` under it; `tone` is `neutral` (default), `positive`, `warn` or `danger`, and `accent` adds a bar across the top in the same tone; `trend` (numbers, oldest first) draws a small line under the value in its colour on a scale from 0; it is decoration, so say the trend in `hint` too), `ProgressBar` (a thin bar with a filled share of `max` (default 100); `label` names it for a screen reader, which also hears the percentage; `tone` is `accent` (default), `positive`, `warn` or `danger`), `SplitBar` (a bar split between `a` and `b` by their shares; `names` says whose is whose to a screen reader; `toneA` (default `danger`) and `toneB` (default `positive`)), `StackedBar` (any number of `items`, each `{ label, value, tone }`, sized by its share of the sum; `legend` draws a `Legend` under it), `TrendChart` (one or two series over ordered buckets, on a y axis from 0: `label` is its name and its table's caption, `buckets` the x labels in order, `series` one or two `{ label, tone, values }`, where a `null` or missing value draws nothing and breaks a line; `kind` is `bar` (default, a count per bucket) or `line` (a level over time); a hidden table holds the same figures for a screen reader, and two series draw a `Legend` under the chart) and `Legend` (a swatch, a `label` and an optional `detail` per item, the key to a chart's or a row stripe's colours). The three bars take `size`: `sm` 6px, `md` 8px (default), `lg` 12px.
|
|
82
|
-
- Media: `Image` (a picture in a fixed shape
|
|
83
|
-
- Chat: `ChatThread` (the scrolling box of a chat; it follows the newest content unless the reader has scrolled up; it is a named region, `label` (required), and a tab stop; `height` is `sm` 20rem, `md` 28rem (default), `lg` 40rem or `fill`, the height of a parent that sets one; `empty` is drawn when it has no children; it is deliberately not a live region: set `announce` when a message is finished, not on each token), `ChatMessage` (one bubble; `role` (required) is `user` (end edge, inset fill) or `assistant` (start edge, surface); `author` (required) is read first by a screen reader and is drawn nowhere, so a visible sender and time go in `meta`, a line above the bubble; `actions` is a row under the bubble; `streaming` sets `aria-busy` and draws a caret, which pulses unless reduced motion is on; with no children, the caret alone is the pending state) and `ChatComposer` (the message box and its button, which keeps its own text; `label` (required) is its unseen name, and `onSend` (required) gets the trimmed text; Enter sends and clears, Shift+Enter is a newline, and blank text does not send; `busy` turns the button into Stop, which calls `onStop`, and Enter does not send while typing carries on; with `busy` and no `onStop`, the button stays a disabled Send; `disabled` is for a chat that cannot take a message at all; `placeholder`, `sendLabel` ("Send") and `stopLabel` ("Stop") are also props).
|
|
95
|
+
- Media: `Video` (a native player with controls, full width, in a fixed shape, `aspect` `16:9` unless set, that loads metadata only and lazily; `captions` is a WebVTT track on by default), `Audio` (a native player at one fixed size, 20rem wide and narrower only in a narrower column; `label` (required) names it; it loads metadata only and lazily), `EmbedFrame` (a rounded, clipped frame with a hairline for an `<iframe>` or a map; `label` (required) names its region; `height` is `sm`, `md` (default) or `viewport`; `status` is `ready` (default), `loading` (a pulsing cover, `aria-busy`) or `error` (`errorLabel`, "Could not load.", announced)), `ColourSwatch` (a small square in a `#rrggbb` `value` with its `label` and the hex in mono; any other value draws an empty swatch), `Image` (a picture in a fixed shape that loads lazily, and first with `priority`; `alt` is required, and `""` marks decoration; `src` is a local path or data URL, and when it is missing or broken a same-sized placeholder with a picture mark stands in; `aspect` is `square`, `4:3` (default), `3:2`, `16:10`, `16:9`, `3:4`, `9:16` or `natural` (no crop, and no space reserved before it loads); `fit` is `cover` (default) or `contain`, and `crop="top"` keeps the top of a covered picture; `width` is `sm` 96px, `md` 160px, `lg` 256px, `xl` 448px or `full` (default); `mat="white"` puts it on a white mat in every theme, for a QR code or a logo, and `mat="page"` on one in the page's tone, for a screenshot, each always showing the whole picture, whatever `fit` says; `href` makes it a link to the full file in a new tab; while `loading` with no `src`, it is a bone of the same shape; a user's photo is an `Avatar`), `MediaTile` (a thumbnail tile with an optional `label` on the media scrim at its bottom edge and a muted `caption` under it; `alt` (required) is its name; `aspect` defaults to `3:4`, not `4:3`, and `width` defaults to `md`; `onClick` makes the whole tile one button, from which the app opens a `Lightbox`; `href` makes it one link instead (`external` too); with neither, it is a plain block; `onRemove` adds a separate remove button on the top corner, named by `removeLabel` ("Remove") and `alt`; `video` draws a play mark; `badge` is a short word in the top corner on the scrim), `ScrollStrip` (one row that scrolls sideways, with snapping and a themed scrollbar, for `MediaTile`s or `Avatar`s; `label` (required) names it; `gap` is `xs`, `sm` (default) or `md`; items never shrink or wrap; it takes keyboard focus, so the arrow keys scroll it; a wrapping grid is a `CardGrid` or `Cluster`), `Lightbox` (a full-screen photo or video viewer on a native `<dialog>` opened on mount, so render it only while it is open; `label` and `onClose` are required, and `children` is one `<img>` or `<video>`; `title` sits above the media, `meta` is a muted line under the title, and `caption` sits under the media; Esc, a click on the scrim and the close button all call `onClose`; `onPrevious` and `onNext` add step buttons and bind ArrowLeft and ArrowRight, so leave one out at the end of the list; `closeLabel`, `previousLabel` and `nextLabel` are for other languages; the scrim stays near-black in every theme) and `RegionFrame` (a picture, `alt` required and `src` left out while `loading`, with the `OutlineRegion`s as its `children` laid over it; `aspect` defaults to `natural`, and any other value letterboxes the picture, never crops it; `width` is as for `Image`; `onLoad`, `id`, `data-*` and `aria-*` go to the `<img>`) with `OutlineRegion` (an accent outline over one area; `rect` (`{ x, y, width, height }`) is in the picture's own units and `within` (`{ width, height }`) is the picture's full size, so it stays in place at any scale; `label` is a small tag at the top left; `hatched` stripes an area that is left out; `tone` (`accent` default, `positive`, `warn`, `danger`) colours it by what the area is, `dashed` marks one proposed or approximate, `active` draws a heavier edge for the one the app has selected; it takes no pointer events).
|
|
96
|
+
- Chat: `ChatThread` (the scrolling box of a chat; it follows the newest content unless the reader has scrolled up; it is a named region, `label` (required), and a tab stop; `height` is `sm` 20rem, `md` 28rem (default), `lg` 40rem or `fill`, the height of a parent that sets one; `empty` is drawn when it has no children; it is deliberately not a live region: set `announce` when a message is finished, not on each token), `ChatMessage` (one bubble; `role` (required) is `user` (end edge, inset fill) or `assistant` (start edge, surface); `author` (required) is read first by a screen reader and is drawn nowhere, so a visible sender and time go in `meta`, a line above the bubble; `actions` is a row under the bubble; `streaming` sets `aria-busy` and draws a caret, which pulses unless reduced motion is on; with no children, the caret alone is the pending state) and `ChatComposer` (the message box and its button, which keeps its own text; `label` (required) is its unseen name, and `onSend` (required) gets the trimmed text; Enter sends and clears, Shift+Enter is a newline, and blank text does not send: Send stays enabled and an empty send shows `emptyReason` ("Write a message first.") under the box until the next keystroke; the box grows with its text from 2 rows to 8; `busy` turns the button into Stop, which calls `onStop`, and Enter does not send while typing carries on; with `busy` and no `onStop`, the button stays a disabled Send; `disabled` is for a chat that cannot take a message at all; `placeholder`, `sendLabel` ("Send") and `stopLabel` ("Stop") are also props).
|
|
84
97
|
- Status pages: `NotFound` (404), `ErrorPage` (500 or any failure; `detail` is error text shown in a `CodeBlock`, never a stack trace, and `onRetry` adds "Try again"), `Offline` (`onRetry` too), `Maintenance` and `Forbidden` (403). Each is a whole page with default copy: `title` and `children` replace the heading and the body, `actions` are the page's own buttons, before the home link. Every page but `Maintenance` links "Back to home", to `LinkProvider`'s `home` (`/` by default): say where home is once, on the provider, never on a page. `Maintenance` has none, since home is the site that is down.
|
|
85
|
-
- Layout (see Layout): `AppShell`, `AppShellBrand`, `appShellRootClassFor`, `Container`, `PageHeader`, `Hero`, `Stack`, `Section`, `Cluster`, `ClusterGrow`, `SideColumn`, `CardGrid`, `StickyBar`, `Show`, `SiteFooter`, and the page layouts `ListLayout`, `DetailLayout`, `FormLayout`, `ProseLayout`, `SidebarLayout`, `DocsLayout`, `FullBleedLayout`, `CenteredLayout`.
|
|
98
|
+
- Layout (see Layout): `AppShell`, `AppShellBrand`, `appShellRootClassFor`, `Container`, `PageHeader`, `Hero`, `Stack`, `Section`, `Cluster`, `ClusterGrow`, `SideColumn`, `CardGrid`, `CardGridRow`, `TableOfContents` (a page's "On this page" list of its headings, the one being read marked), `StickyBar`, `Show`, `SiteFooter`, and the page layouts `ListLayout`, `DetailLayout`, `FormLayout`, `ProseLayout`, `SidebarLayout`, `DocsLayout`, `FullBleedLayout`, `CenteredLayout`.
|
|
86
99
|
- `Prose` (a `div` for long-form content, a docs page or an article, never an app screen: it sets the long line height (leading-7) and puts `Text`, `SectionHeading`, `SubsectionHeading` and the `Callout` text on the long-form scale inside it, body 16, h4 16 semibold, h3 20 and h2 24; every other role keeps its size, and a `Dialog`, `Drawer` or `EmptyState` inside it keeps the app sizes; it takes no `className`, `style` or size prop).
|
|
87
100
|
- Typography roles (each pins size, weight and ink, and takes an `as`): `Display`, `Lead`,
|
|
88
101
|
`PageHeading`, `SectionHeading`, `SubsectionHeading`, `Overline`, `Text`, `Caption`. `Text` and
|
|
89
102
|
`Caption` are a `<p>`; `as="span"` is their inline form, inside a row, a cell or a sentence. Opt-in props, none changing today's look: `SectionHeading rule`
|
|
90
|
-
(a hairline under it, with its spacing), `SubsectionHeading size` (`sm`, `md` default, `lg`) and `
|
|
103
|
+
(a hairline under it, with its spacing), `SubsectionHeading size` (`sm`, `md` default, `lg`) and `lines` (`lines={1}` is one line with an ellipsis),
|
|
91
104
|
`Text strong` (font-medium in the primary ink, for emphasis), `Text preserveNewlines` (keeps a
|
|
92
105
|
note's line breaks). The three inline roles (`Text`, `Caption`, `Overline`) also take `tone`, the one ink prop (`neutral`, the default, is the role's own ink;
|
|
93
106
|
`muted` and `accent`, or `info`, `positive`, `warn`, `danger`, the same text colours as a `TableCell` tone; pair the colour with a word, as in "Saved."),
|
|
94
107
|
`numeric` (tabular figures), `mono` (the monospace face) and `align` (`start`, `center`, `end`);
|
|
95
108
|
`Text` and `Caption` also take `lines` (1 to 4, then an ellipsis, the full plain text in a
|
|
96
109
|
`title`), `italic` and `breakWords` (a long URL or token breaks where its container ends).
|
|
97
|
-
- Controls: `Button` (`variant` is `primary` (default), `outline`, `ghost`, `link` or `dashed`, the link having no box: text with an underline on hover, for an in-line action, and the dashed one a dashed outline in muted text that fills its container, like a standalone `EmptyState`, for an "add another" row, ignoring `tone`; `icon` puts one of the `Icon` set's names before the label; `size="sm"` is compact, for table rows and toolbars, `size="lg"` larger, with more padding (see Sizes); `tone="danger"` is red, for delete and clear, and `tone="positive"` green, for accept and approve; `disabledReason` greys it flat and blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` in a browser without CSS anchor positioning); `busy` disables it with `aria-busy` and keeps its colour, and a string (`busy={saving && "Saving"}`) is also the label while busy; `pressed` makes it a toggle with `aria-pressed`, on `outline` and `ghost` neutral when off and filled in the tone's primary colour when on, so an `outline` `size="sm"` Button with `pressed` is a filter chip; `count` puts a small number chip after the label, part of the button's name ("Splits, 3"), and a button that opens something also takes `aria-expanded`; with `href` it is a link with the same look (through the app's `LinkProvider`), `external` opening a new tab), `ButtonGroup` (a wrapping row of buttons; `end` is one item pushed to the far side, `label` makes it a named `role="group"`), `IconButton` (a square button holding one icon of the set, `icon` (required, no children); `label` is required and becomes its `aria-label` and its tooltip on hover and keyboard focus; `variant` is `outline` (default) or `ghost`, `tone` is `neutral` (default) or `danger`, `size` matches a `Button`'s height; `count` puts a red count on its corner, not shown at 0; `disabledReason` dims it, blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` without CSS anchor positioning), in place of the label; with `href` it is a link, `external` opening a new tab), `Icon` (one bare `<svg>` sized to fill a box, or `name` for one of the set's own icons (`diff`, `baseline`, `review`, `ci`, `self-host`, `privacy`, `capture`, `branch`, `theme`, `speed`, `search`, `chevron-right`, `chevron-down`, `close`, `external-link`, `settings`, `bell`, `check`, `plus`, `more`, `grid`, `window`, `type`, `card`, `pointer`, `field`, `table`, `compass`, `page`, `briefcase`: feature ideas and UI glyphs on one 24 grid, a 1.5 stroke, round caps and joins, each the idea or action, not a product): `size` `sm` 14px, `md` 16px (default), `lg` 20px or `feature` 32px; `tone` is a text tone, and left out the icon takes the text colour around it; `aria-hidden` unless `label` names it as `role="img"`), `Menu` (a button that opens a short list of actions, for the overflow menu of a row, a card or a header: `label` (required) names the trigger and the menu; `items` (required) are data, each a `label` with `onSelect`, or a link with `href` (through the app's `LinkProvider`) and `external`, plus an optional `icon`, `tone` (`neutral` default, `danger` red, put last) and `disabled`; `trigger` is `icon` (default, a ghost three-dot button) or `button` (an outline button reading `label`); `size` is the trigger's height; the keyboard is the menu button pattern, and inside a `Dialog` it opens in the dialog), `ColourSchemeToggle` (a light/dark switch on `<html>`; `id`, `data-*` and other button props go on the button, `store={false}` skips `localStorage`; see Light and dark), `Input` (a text input; `icon` names a leading icon of the `Icon` set inside the field; `prefix` is short text inside the border before the value, a currency symbol, on a plain field only; `type="search"` drops the browser's search look and shows a clear button while the field has a value, named by `clearLabel` (default "Clear search")), `Textarea` (a multi-line text input, `rows` defaults to 3), `Select` (a native `<select>` in the control look over its `items`, `{ value, label, disabled? }`, keeping the browser's arrow). `Input`, `Select`, `Textarea` and `Checkbox` take a `ref` to the native element. `Input`, `Select` and `Textarea` take `size` (`md` default, `sm`: compact, less padding, for dense forms and table rows, or `lg`: larger, more padding) and `width` (`full` default, except a `Select` outside a `Field`, which is `auto`; the fixed `xs` 5rem, `sm` 7rem, `md` 9rem, `lg` 12rem, `fill`: grows to the room left in a flex row and can shrink to nothing, so the buttons beside it stay on the line, or `auto`: no width class, as wide as the browser makes it); a fixed width replaces `w-full`, so there is no class to collide with. `Input` also takes `numeric`, a field for a figure: an amount (`<Input prefix="R" numeric />`) or a count (`numeric inputMode="numeric"`), the value right-aligned in tabular figures with `inputMode="decimal"` unless you pass your own, still a text field so the value is kept as typed; never `type="number"` for a figure a person types. `size` replaces the native `size` attribute, so a multi-row `<select size={4}>` is not reachable through `Select`. `Checkbox` (a real `<input type="checkbox">` with its label, drawn by the library as an empty outlined box and a filled accent one with a check mark, so it reads the same in every theme and browser; other props go on the input; `size="sm"` is compact with a smaller box and `size="lg"` larger with a larger one (see Sizes); the box sits on the label's first line; `checked` or `defaultChecked`, and `onChange(checked)`; with no `label` it is a bare box for a table cell, named by `aria-label`; `hint` is a muted line under the label, the box's `aria-describedby`, and `error` replaces it in red with `role="alert"` and marks the box `aria-invalid`; `disabledReason` dims it and blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` without CSS anchor positioning)). `Switch` (an on/off setting that acts at once, usually by saving to a server: a native `<button role="switch" aria-checked>`, with `checked` or `defaultChecked` and `onChange(checked)`; give it a `label` (the whole label is the click target) or, with none, an `aria-label`: one is required; `hint` is a muted line under the label and its `aria-describedby`, and `error` replaces it as on a `Checkbox`; `size` is `sm`, `md` (default) or `lg`; `busy` is the save in flight: `aria-busy`, a click or key does nothing, it keeps its colour and its focus; `disabled` is the native one, washed out; `disabledReason` washes it out and blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` without CSS anchor positioning); a value sent with a form stays a `Checkbox`). `RadioGroup` and `Radio` (one choice from a few options: the group has a `label`, `value`/`onChange` or `defaultValue`, `name`, `disabled`, `required`, `hint` (a line under the group's label), `size` (`sm`, `md` default, `lg`, as `Checkbox`) and an `error` shown like `Field`'s with `role="alert"`; each `Radio` has a `value`, a `label`, an optional `hint` and `disabled`; one tab stop, the arrow keys move and choose). `Disclosure` (a summary button with a chevron and `aria-expanded` over a body that opens and closes; `summary`, `children`, `defaultOpen`; it keeps its own state, or the app holds it with `open` and `onOpenChange`; it replaces `<details>`). `FileDrop` (a dashed drop zone, a `<label>` around a file input that covers it, so a click opens the dialog and a dropped file lands on the input; `children` is the prompt, `accept`, `multiple`, `name`, `disabled` and `onChange` on the input). `CopyButton` (a small text button that writes `text` to the clipboard and shows `copiedLabel` ("Copied") in place of `label` ("Copy") for two seconds, by a CSS animation, not a timer; its accessible name stays `label` and a status region beside it announces `copiedLabel` on each copy; every other button prop, `disabled` included, goes on the `<button>`). `CopyLine` (one line of mono text in a box with a `CopyButton` beside it; `disabled` disables the button; other props go on the root `<div>`). `Field` (a label above an `Input`, `Select`, `Textarea` or `FileDrop`, which takes the label, the hint or error as `aria-describedby`, and with an error `aria-invalid` and a red edge, by itself, so neither `htmlFor` nor the control's `id` is needed; `htmlFor` gives the control a fixed id; `labelHidden` keeps the label for assistive tech and draws no text, for a control whose purpose is plain from what surrounds it, and makes `layout="row"` a column; a `hint` sits under it, and an `error` replaces the hint with a `role="alert"` line; `span="full"` runs it across both columns of a `FormGrid`). `FormGrid` (two columns of `Field`s from `md`, one below it), `FormRow` (an inline-edit row: `FormRowField`s side by side, `actions` after them, and one `hint` or `error` under the whole row; see Layout) and `FormRowField` (a compact label over one control, `span` 1 to 4). `Callout` (a tinted notice box; `tone` is `neutral` (default), `info`, `positive`, `warn` or `danger`; `icon` sets one of the `Icon` names at the start; an optional `title` sits in bold above the body; `actions` puts a button or link at the end of the row; `banner` makes it a flat strip, bottom border only and no radius, for the top of a `Card flush`). `ToastRegion` (the page's toasts, short notices fixed to the bottom of the viewport, from a list the app holds: mount it once at the root beside `AppShell`; `toasts` (required) is the list, oldest first, each a `Toast` with `id`, `title`, an optional `body`, `tone` (a `Callout` tone, `neutral` by default) and `actions` (one `Button size="sm"`); `onDismiss(id)` (required) is called by a toast's close button and when a self-hiding toast's time is up, and the app drops it from the list; a `neutral`, `info` or `positive` toast with no `actions` leaves on its own after five seconds by a CSS animation, not a timer, paused on hover and focus and kept under reduced motion without the fade, and any other stays until dismissed; `label` names the region ("Notifications") and `dismissLabel` the close button ("Dismiss"); the region is a landmark with a polite `role="status"`, and a toast raised while a `Dialog` or `Drawer` is open sits under it). `ListRow` (a full-width row that is a `<button>` with `onClick`, or a link with `href`, with a hover fill, a left-aligned label and `trailing` content; `divided` draws a hairline above the row, to separate rows in a `Card flush`; `expanded` makes it the header of a collapsible section: `aria-expanded` and a chevron, the caller owning the state and the section; `leading` is content before the label (an `Avatar`), and `leadingWidth="thumbnail"` gives it a fixed width so rows with and without a picture line up; `size` sets the padding (`sm` dense, `md` default, `lg`); `focused` draws the focus ring on the row the keyboard cursor is on, for a list moved with the arrow keys while focus stays on the list; `selected` marks the row in view with an accent fill and `aria-current="true"`; a button or link row can hold its own link, button or `Checkbox` in `trailing`, with its own click; `secondary` is a second, muted line under the label; with no `href` and no `onClick` it is a plain `<div>`, for a row that holds its own buttons, and takes `actions`, buttons after `trailing`, and `revealOnHover`, which shows them only on hover or focus inside the row and always on a touch screen, and `panel`, content under the row lined up with the label, for a row that opens in place; a compact bordered list is `Card flush` around such rows at `size="sm"`, `divided` after the first (no separate part); `highlighted` marks the row the pointer or the keyboard is on, with a fill one step deeper than hover and the `revealOnHover` actions shown, for a list that follows both through the row's `onPointerEnter`, `onPointerLeave` and `onFocus`, which every row passes through; a button row takes `disabledReason`, which fades the row and blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` without CSS anchor positioning)). `SortableList` (a list the user puts in order: `label` (required) names it, and `onReorder(move)` (required) is called once per drop with a `SortableMove`, `{ id, section?, target? }`, which the app applies to its own data; the list never reorders itself; its children are `SortableSection`s (`id` (required, the move's `section`), `title`, and `emptyLabel`, "Drop here" by default, the row an empty section shows) or `SortableItem`s directly; a `SortableItem` takes an `id` (required, the move's `id` and `target`), a `title` and, as children, a meta line under it; a pointer drags the row, and the keyboard uses its grip handle: Enter, the arrow keys, Enter to drop, Escape to cancel). `Tabs` (underline tabs for switching a view in place: a row over a bottom rule, the current tab underlined in the accent; `items` are `{ value, label }` buttons, with `value` the current one's `value` and `onChange(value)` the caller's state, one tab stop and the arrow keys, Home and End moving between enabled tabs, or `{ label, href, selected?, external? }` links in a `<nav>` with `aria-current="page"` on the current one (`selected`, or the item whose `value` is `value`); `label` names the group; a button tab takes `disabled` and `controls`, the id of its `role="tabpanel"`, which is the caller's; `orientation="vertical"` is the pill rail instead, the current tab filled, with no rule, stacked in one column for a `SidebarLayout` `aside`, and only the rail takes `size`; there is no `variant`: across is always underline, a `PageHeader` `tabs` slot and an `AppShell` `nav` included; `disabled` on the row disables every tab, e.g. until hydration). `SegmentedControl` (a joined pill group, one option filled; the same `items`, `value`, `onChange`, `disabled` and `label` as `Tabs`, as a `radiogroup` with `aria-checked` on each `radio`). On both an item takes `data-*` attributes (typed `data-${string}`) onto its button or link; on `Tabs` and `SegmentedControl` an item takes `count` (a small muted number after the label, part of its name: "Shots 12") and `title`; a button option takes `disabledReason`: it is `aria-disabled`, the arrow keys reach it and choose nothing, and the reason is its tooltip on hover, keyboard focus and a tap, read out as its description; a bare `disabled` option is `aria-disabled` too, and the arrow keys, Home and End skip it. `Dialog` (a modal on the browser's `<dialog>`, opened on mount, so render it only while open: `title` is its name, `description` a line under it, `footer` the right-aligned actions; Esc, the backdrop or a `<form method="dialog">` call `onClose`; `width` is `sm` (320px, a list), `md` (440px, default, a form), `lg` (640px, a wider form or a table) or `full` (the whole screen, for media or a player: the body fills the height between the title and the footer and scrolls if taller; there is no backdrop to click, so put a close button on a `<form method="dialog">` in the `footer`); `onSubmit` makes it a form (one `<form noValidate>` round the body, the `error` and the footer, so a submit button or Enter submits; no `<form method="dialog">` in its footer then); `error` is the whole submit's error, a danger `Callout` above the footer). `FieldDialog` (a `Dialog` with one text field and Cancel and submit buttons, every string passed in: `title`, `description`, `label` (which names the input), `placeholder`, `hint`, `emptyReason`, `submit` and `busyLabel`; `onSubmit` gets the trimmed value and a resolved promise closes it, a rejection shows its message). `Drawer` (a modal slide-over on the right edge, on a native `<dialog>` opened on mount like `Dialog`, so render it only while open: `title` is its name, `description` a line under it, a close button sits beside it, `children` scroll between the header and an optional pinned `footer`; Esc, the scrim and the close button call `onClose`; `width` is `sm`, `md` (default) or `lg`; `closeLabel` names the close button). `BottomSheet` (a non-modal panel docked to the bottom of its positioned parent, over a view such as a map or a canvas that stays usable behind it; nothing is made inert and focus never moves; `label` (required) names the region and its handle; `snaps` (required, at least two, lowest first) are shares of the parent's height from 0 to 1, or `"120px"` strings; `snap` (required) is the current index, and `onSnapChange` (required) is told which snap to move to; the handle steps through the snaps with Enter and Space, a drag releases to the nearest snap, and Escape returns it to the first; `header` stays put, `children` scroll, and `footer` is pinned under the body; `onHeightChange(px)` reports its resting height, so a map camera can be padded by it; it is full width below `md` and a panel at the start edge from `md` up). `Pagination` (page links for a long list, in a `<nav>` named by `label` (required): `page` (from 1, drawn clamped into range) of `pageCount` (one page draws nothing), each page a link to `pageHref(page)` through the app's `LinkProvider`, so the page lives in the URL; Previous and Next in the outline `sm` look, plain text at the first and last page; a window of at most seven numbers (the first, the last, the current and its neighbours, `…` for a run of hidden pages), the current one `aria-current="page"`; below `sm` the numbers give way to `pageLabel` ("Page 4 of 12"); `previousLabel` and `nextLabel` for another language). `Breadcrumbs` (a `<nav>` named by `label`, "Breadcrumb" by default, over an ordered list; `items` are nodes, or `{ label, href, external? }` for one that links; the last is the current page and is never a link and gets `aria-current="page"`, and each crumb truncates). `SiteSearch` (a header button that opens a search dialog over links to the matching pages; put it in `AppShell`'s `controls`, render it once per page, and pass every page as `items` (`{ label, href, description?, keywords? }`, in rail order); `label` (required) is the dialog's title and the phone icon button's name; Ctrl+K (Cmd K on a Mac) opens it from anywhere; typing matches the label, then `keywords`, then the description; Enter opens the first result, the arrow keys move, and Esc closes it and returns focus; `resultsLabel` ("Results") is also a prop). `Table` (a list of records in a rounded, bordered card around a full-width `<table>` that scrolls sideways on a narrow screen; `label` (required) names it for assistive tech and is not drawn; a `TableHeaderCell` with `sort` and `onSort` makes its column sortable (the app sorts the rows), `TableRow selected` marks the row whose detail is open (`aria-current`), a `TableExpandCell` opens a row whose panel is a `TableCell span="full"`, and `TableBody empty` takes an `EmptyState` across every column; `size` is the row padding, `sm` by default, and the buttons and pills in its rows take the same size; inside a `Card` it is plain: no card of its own, no head strip and no row hover, only the row dividers; compose it from `TableHead`, `TableBody`, `TableFoot`, `TableRow`, `TableHeaderCell` (`numeric` declares a column of figures once, so the title and every cell under it are end aligned and the cells in tabular figures; `align` `start`, `center` or `end`; `label` is a visually hidden column name, in place of children, for a column of row actions: "Actions") and `TableCell` (`align`, `indent` of 1 to 3 to set a start-aligned cell in, for a line under a parent row, `tone` `neutral` (the default), `strong` or `muted`, or the tones `info`, `positive`, `warn` or `danger` for an amount that means something, in the tone's text colour and with no fill, so pair the colour with a sign or a word; `numeric` for a figure, end aligned in tabular figures (a cell under a `numeric` head cell is one already), `mono` for a small mono face, `truncate` to cap a long value's width, cut it with an ellipsis and put the full text in a `title`, so its content is text (strings and numbers); `secondary` for a second, muted line under the content; `colSpan` passes through, so a `TableCell` with `colSpan` in a row of its own is a full-width panel, an empty state or a note, centred with `align="center"`); `TableEditCell` (a `TableCell` whose value opens an editor in place: `children` is the value, drawn as a button; a click, Enter or Space swaps it for `renderEditor(close)`, a plain control in the cell and not a popover of its own, and moves the focus into it; `close` and Esc put the focus back on the value, and a press outside or Tab out of it closes it too, so the control saves on its own change or submit; `label` names the button and the editor; it takes the `TableCell` props except `truncate`); `InlineEdit` (the same edit trigger without the cell, for a `TableCell` that holds other content too: `label`, `renderEditor(close)` and `children`, with the same keyboard and focus behaviour); `TableFoot` (the `<tfoot>` for totals: its cells are strong by default and each row has a firmer line above it, alone and in a card alike); `TableGroupRow` (a full-width group header in the body: `label` spans `colSpan` columns, the table's column count, which is required; optional `trailing` content sits at the far end, and the group's rows follow it); `tone` on a `TableRow` in the body marks the row with a stripe on its leading edge over a soft fill: `neutral`, `info`, `positive`, `warn` or `danger`, as `Callout`, or `muted`, which only fades the row (a transfer, a row that is not the point); a bold subtotal is not a tone: `emphasis` on a `TableRow` in the body gives it a `TableFoot` row's look among the other rows; `stripe` (a text tone) draws the leading stripe alone, with no fill; a row takes one of `tone`, `stripe` and `emphasis`; `selected` on a `TableRow` marks the current one with the `ListRow` selected fill and `aria-current`, and wins over a tone; every table element passes `id`, `data-*` and `aria-*` through, and none takes a `className` or `style`). `Timeline` (a named `<ol>` of events; `label` is its `aria-label`, `empty` is drawn instead when there are no items) with `TimelineItem` (a `title`, an already-formatted `time`, the `children` as a note, and `tone`, a Callout tone for the marker dot, `neutral` by default). `KeyValueList` (a `<dl>` of label/value rows; each `KeyValue` takes a `label` and its value as children, the value right-aligned in tabular figures; `total` makes it the sum row, a firm rule above and strong text, and `tone` (a text tone: `muted`, `accent`, `info`, `positive`, `warn`, `danger`) colours the value on any row, so `total tone="warn"` is a total that does not reconcile; `align="start"` puts the values left-aligned in one column beside the labels instead). `Avatar` (a badge of the initials of `name`, titled with the name and `aria-hidden`; with `src` (the app's own local image path, never a remote one) it is a cropped `<img alt={name}>` instead, and if that image fails to load it shows the initials; `size` is `xs` (16px, for an inline mention), `sm`, `md` (default), `lg`, `xl` (56px), `2xl` (64px) or `3xl` (96px); `onClick` makes it one button named by `name`; `shape` is `round` (default, a person) or `square` (an org or a team); `href` makes it one link (`external` too); a row of overlapping avatars is an `AvatarStack`; the colour is one of seven stock background classes picked by a hash of the name, remapped by each theme). `AvatarStack` (a row of overlapping avatars, each in a ring of the page colour; `items` (required) is `{ name, src? }[]`, in order, with full names; `max` shows that many and then a "+N" chip of the same size and shape; `size` (default `md`) and `shape` (`round` default, or `square`) are as for `Avatar`; the row is one image to assistive tech, named by the people in it; while `loading` with no `items`, it draws three bones). `TextLink` (an inline text link in the accent colour; `href` is required and an in-app one goes through the app's `LinkProvider`, `external` adds `target="_blank"` and `rel="noreferrer"`, `stretch` covers the nearest `relative` ancestor so a whole row or card is the click target, `size` (`sm`, `md` or `lg`) pins the type size where it would otherwise follow the text around it, `mono` sets the monospace face, `tone` (`warn`, `danger`, `positive`, `info` or `muted`) gives it a meaning's colour in place of the accent (`neutral` and `accent` keep the accent), every other anchor prop passes through). `MetaList` (a wrapping row of facts or links in muted small text, joined by an `aria-hidden` `separator`: `·` (default), `•` or `none`; branch · SHA · date, or a footer's Privacy · Terms; an item is text, a `Code` or a `TextLink`, and never breaks inside itself; `mono` sets the row in the monospace face, for ids and paths). `PageFade` (the page's content area, named for the View Transitions API so a route change cross-fades it while the frame around it stays put; wrap what changes between pages, once per page, or give each a `name` (a CSS identifier) when there are two; it fades when the navigation runs in a view transition, through `startPageTransition(update)` (flushes a synchronous state change inside `document.startViewTransition`) or a router's own option such as TanStack Router `viewTransition`, and otherwise, in a browser without View Transitions, or under `prefers-reduced-motion: reduce`, it swaps with no fade; it renders a small `<style>`, with no colour in it, and the div is a stacking context, so portal an overlay that must rise above the frame). `Morph` (a `<div>` that grows into its counterpart on the next page and shrinks back on Back, through the View Transitions API, over 450 ms; wrap the list card and the detail element, each with the same `name` (required) and the record's id as `item` (required); one `name` and `item` pair may appear only once per page; it morphs only inside a view transition (`startPageTransition`, TanStack Router `defaultViewTransition: true` or a `Link`'s `viewTransition`), and otherwise, and under reduced motion, it swaps with no animation; while it is named it is a stacking context, so overlays inside it portal to the body; `refreshMorphs()` measures every mounted Morph again: call it after a router restores scroll after the render, with TanStack Router `router.subscribe("onRendered", () => refreshMorphs())`, subscribed after the router is created; it does nothing on the server). `NavigationProgress` (a thin indeterminate accent bar fixed along the top edge of the viewport, over the header, for a route change under way; `loading` is the router's pending flag (TanStack Router: `useRouterState({ select: (s) => s.status === "pending" })`), `label` its accessible name (default "Loading page"); it draws the bar while `loading` is true and nothing otherwise, with the bar invisible for its first 150ms so a fast navigation shows nothing; render it once per app, beside the page frame, and pair it with `PageFade`; a still bar under `prefers-reduced-motion: reduce`; it adds nothing to the layout and has no router dependency). `EmptyState` (what a page or list shows when it has nothing yet: a centred `title`, the `children` as the explanation under it, and `actions` in a centred row; a named `<section>`, which draws its own dashed frame on its own and none inside a `Card`; `icon` sets a mark above the title; `level` is the title's heading level, one below the heading that holds it, and does not change its look; for one muted line inside a card, `Text tone="muted"`). `Steps` (a numbered `<ol>` of `Step`s, each a `title` and the `children` as a detail line, the numbers counted by CSS in an accent disc; for a "get started" list, not for progress). `Divider` (a hairline `<hr>` in the theme's line colour; spacing comes from the layout around it). `BulletList` (a `<ul>` with discs, an indent and a small gap; its children are `BulletItem`s, each an `<li>` in the body text). `Code` (inline code: mono, on a subtle background). `CodeBlock` (a block of code, no client JS: the text is `children` (a string) or `lines` (one entry per line), `language` (`text` (default, one colour), `tsx`, `ts`, `js`, `json`, `bash`, `console`, `css`, `html` or `yaml`) colours it, `console` being a shell session where a `$ ` line is a command and the rest is output, and `copy` then copies only the commands; `label` is a caption naming the language or file; long lines wrap by default, so nothing is cut off and a command copies as one line, and `overflow="scroll"` keeps lines whole and scrolls them under a thin scrollbar in the theme's muted ink; `copy` adds a copy button beside the code, which copies it exactly as given; on a static page it needs `copyScript` (see Copy on a static page); other props go on the root `<figure>`). `CodeExample` (one framed example: the rendered `children` over the `code` that makes them, coloured as TSX, in one bordered box, with an optional `caption` as its last band; a wide preview or long code scrolls inside the frame under the same thin scrollbar; `copy` adds a button that copies the code; no client JS without `copy`). `Video` (a full-width, rounded `<video>` with controls that loads metadata only; `src` is required, `poster` and a WebVTT `captions` track are optional, children are the fallback). `Kbd` (a keyboard key in mono; its border takes the surrounding text colour, so it reads on a filled button too). `Fieldset` (a `<fieldset>` named by its `label`, drawn as its legend in the `Field` label's look, over its children in one column: `Checkbox`es for one question, `Field`s in a `FormGrid`, or a `ButtonGroup` of `outline` `sm` `Button`s with `pressed` for filter chips; `hint` is a muted line under it and its `aria-describedby`, `error` replaces it in red with `role="alert"`; `disabled` disables every control inside; a `RadioGroup` is its own group and never goes in one). `DateField` and `DateRangePicker` (see Dates).
|
|
110
|
+
- Controls: `Button` (`variant` is `primary` (default), `outline`, `ghost`, `link` or `dashed`, the link having no box: text with an underline on hover, for an in-line action, and the dashed one a dashed outline in muted text that fills its container, like a standalone `EmptyState`, for an "add another" row, ignoring `tone`; `icon` puts one of the `Icon` set's names before the label; `size="sm"` is compact, for table rows and toolbars, `size="lg"` larger, with more padding (see Sizes); `tone="danger"` is red, for delete and clear, and `tone="positive"` green, for accept and approve; `disabledReason` greys it flat and blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` in a browser without CSS anchor positioning); `busy` disables it with `aria-busy` and keeps its colour, and a string (`busy={saving && "Saving"}`) is also the label while busy; `pressed` makes it a toggle with `aria-pressed`, on `outline` and `ghost` neutral when off and filled in the tone's primary colour when on, so an `outline` `size="sm"` Button with `pressed` is a filter chip; `count` puts a small number chip after the label, part of the button's name ("Splits, 3"), and a button that opens something also takes `aria-expanded`; with `href` it is a link with the same look (through the app's `LinkProvider`), `external` opening a new tab), `ButtonGroup` (a wrapping row of buttons; `end` is one item pushed to the far side, `label` makes it a named `role="group"`), `IconButton` (a square button holding one icon of the set, `icon` (required, no children); `label` is required and becomes its `aria-label` and its tooltip on hover and keyboard focus; `variant` is `outline` (default) or `ghost`, `tone` is `neutral` (default) or `danger`, `size` matches a `Button`'s height; `count` puts a red count on its corner, not shown at 0; `disabledReason` dims it, blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` without CSS anchor positioning), in place of the label; with `href` it is a link, `external` opening a new tab), `Icon` (one bare `<svg>` sized to fill a box, or `name` for one of the set's own icons (`diff`, `baseline`, `review`, `ci`, `self-host`, `privacy`, `capture`, `branch`, `theme`, `speed`, `search`, `chevron-right`, `chevron-down`, `close`, `external-link`, `settings`, `bell`, `check`, `plus`, `more`, `grid`, `window`, `type`, `card`, `pointer`, `field`, `table`, `compass`, `page`, `briefcase`: feature ideas and UI glyphs on one 24 grid, a 1.5 stroke, round caps and joins, each the idea or action, not a product): `size` `sm` 14px, `md` 16px (default), `lg` 20px or `feature` 32px; `tone` is a text tone, and left out the icon takes the text colour around it; `aria-hidden` unless `label` names it as `role="img"`), `Menu` (a button that opens a short list of actions, for the overflow menu of a row, a card or a header: `label` (required) names the trigger and the menu; `items` (required) are data, each a `label` with `onClick`, or a link with `href` (through the app's `LinkProvider`) and `external`, plus an optional `icon`, `tone` (`neutral` default, `danger` red, put last) and `disabledReason` (shown dimmed with the reason under its label, and skipped by the arrows); `trigger` is `icon` (default, a ghost three-dot button) or `button` (an outline button reading `label`); `size` is the trigger's height; the keyboard is the menu button pattern, and inside a `Dialog` it opens in the dialog), `ColourSchemeToggle` (a light/dark switch on `<html>`; `id`, `data-*` and other button props go on the button, `store={false}` skips `localStorage`; see Light and dark), `Input` (a text input; `icon` names a leading icon of the `Icon` set inside the field; `prefix` is short text inside the border before the value, a currency symbol, on a plain field only; `type="search"` drops the browser's search look and shows a clear button while the field has a value, named by `clearLabel` (default "Clear search"), and Escape clears it, closing a dialog around it only once the field is empty), `Textarea` (a multi-line text input, `rows` defaults to 3), `Select` (a native `<select>` in the control look over its `items`, `{ value, label, disabled? }`, keeping the browser's arrow). `Input`, `Select`, `Textarea` and `Checkbox` take a `ref` to the native element. `Input`, `Select` and `Textarea` take `size` (`md` default, `sm`: compact, less padding, for dense forms and table rows, or `lg`: larger, more padding) and `width` (`full` default, except a `Select` outside a `Field`, which is `auto`; the fixed `xs` 5rem, `sm` 7rem, `md` 9rem, `lg` 12rem, `fill`: grows to the room left in a flex row and can shrink to nothing, so the buttons beside it stay on the line, or `auto`: no width class, as wide as the browser makes it); a fixed width replaces `w-full`, so there is no class to collide with. `Input` also takes `numeric`, a field for a figure: an amount (`<Input prefix="R" numeric />`) or a count (`numeric inputMode="numeric"`), the value right-aligned in tabular figures with `inputMode="decimal"` unless you pass your own, still a text field so the value is kept as typed; never `type="number"` for a figure a person types. `size` replaces the native `size` attribute, so a multi-row `<select size={4}>` is not reachable through `Select`. `Checkbox` (a real `<input type="checkbox">` with its label, drawn by the library as an empty outlined box and a filled accent one with a check mark, so it reads the same in every theme and browser; other props go on the input; `size="sm"` is compact with a smaller box and `size="lg"` larger with a larger one (see Sizes); the box sits on the label's first line; `checked` or `defaultChecked`, and `onChange(checked)`; with no `label` it is a bare box for a table cell, named by `aria-label`; `hint` is a muted line under the label, the box's `aria-describedby`, and `error` replaces it in red with `role="alert"` and marks the box `aria-invalid`; `disabledReason` dims it and blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` without CSS anchor positioning)). `Switch` (an on/off setting that acts at once, usually by saving to a server: a native `<button role="switch" aria-checked>`, with `checked` or `defaultChecked` and `onChange(checked)`; give it a `label` (the whole label is the click target) or, with none, an `aria-label`: one is required; `hint` is a muted line under the label and its `aria-describedby`, and `error` replaces it as on a `Checkbox`; `size` is `sm`, `md` (default) or `lg`; `busy` is the save in flight: `aria-busy`, a click or key does nothing, it keeps its colour and its focus; `disabled` is the native one, washed out; `disabledReason` washes it out and blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` without CSS anchor positioning); a value sent with a form stays a `Checkbox`). `RadioGroup` and `Radio` (one choice from a few options: the group has a `label`, `value`/`onChange` or `defaultValue`, `name`, `disabled`, `required`, `hint` (a line under the group's label), `size` (`sm`, `md` default, `lg`, as `Checkbox`) and an `error` shown like `Field`'s with `role="alert"`; each `Radio` has a `value`, a `label`, an optional `hint` and `disabled`; one tab stop, the arrow keys move and choose). `Disclosure` (a summary button with a chevron and `aria-expanded` over a body that opens and closes; `summary`, `children`, `defaultOpen`; it keeps its own state, or the app holds it with `open` and `onOpenChange`; it replaces `<details>`). `FileDrop` (a dashed drop zone, a `<label>` around a file input that covers it, so a click opens the dialog and a dropped file lands on the input; `children` is the prompt, `accept`, `multiple`, `name`, `disabled` and `onChange` on the input). `CopyButton` (a small text button that writes `text` to the clipboard and shows `copiedLabel` ("Copied") in place of `label` ("Copy") for two seconds, by a Web Animation, not a timer, or `failedLabel` ("Failed") when the clipboard refuses; its accessible name stays `label` and a status region beside it announces the outcome on each press; no `<style>` element, so it works under a strict CSP; every other button prop, `disabled` included, goes on the `<button>`). `CopyLine` (one line of mono text in a box with a `CopyButton` beside it; `label` (required) says what the line is, and the button is named "Copy <label>"; `disabled` disables the button; other props go on the root `<div>`). `Field` (a label above an `Input`, `Select`, `Textarea` or `FileDrop`, which takes the label, the hint or error as `aria-describedby`, and with an error `aria-invalid` and a red edge, by itself, so neither `htmlFor` nor the control's `id` is needed; `htmlFor` gives the control a fixed id; `labelHidden` keeps the label for assistive tech and draws no text, for a control whose purpose is plain from what surrounds it, and makes `layout="row"` a column; a `hint` sits under it, and an `error` replaces the hint with a `role="alert"` line; `span="full"` runs it across both columns of a `FormGrid`). `FormGrid` (two columns of `Field`s once the grid is 36rem wide, by its own width rather than the viewport's, one below it), `FormRow` (an inline-edit row: `FormRowField`s side by side, `actions` after them, and one `hint` or `error` under the whole row; see Layout) and `FormRowField` (a compact label over one control, `span` 1 to 4). `Callout` (a tinted notice box; `tone` is `neutral` (default), `info`, `positive`, `warn` or `danger`; `icon` sets one of the `Icon` names at the start; an optional `title` sits in bold above the body; `actions` puts a button or link at the end of the row; `banner` makes it a flat strip, bottom border only and no radius, for the top of a `Card flush`). `ToastRegion` (the page's toasts, short notices fixed to the bottom of the viewport, from a list the app holds: mount it once at the root beside `AppShell`; `items` (required) is the list, oldest first, each a `Toast` with `id`, `title`, an optional `description`, `tone` (a `Callout` tone, `neutral` by default) and `actions` (one `Button size="sm"`); `onDismiss(id)` (required) is called by a toast's close button and when a self-hiding toast's time is up, and the app drops it from the list; a `neutral`, `info` or `positive` toast with no `actions` leaves on its own after eight seconds by a CSS animation, not a timer, paused on hover and focus and kept under reduced motion without the fade, and any other stays until dismissed; `label` names the region ("Notifications") and `dismissLabel` the close button ("Dismiss"); the region is a landmark with a polite `role="status"` that reads each new toast's text once, and "Actions available" (`actionsLabel`) after one with actions; dismissing the toast that holds focus moves focus to the next toast, or back where it was; a toast raised while a `Dialog`, `Drawer` or `Lightbox` is open is held back and shown once the modal closes, and those already shown stay). `ListRow` (a full-width row that is a `<button>` with `onClick`, or a link with `href`, with a hover fill, a left-aligned label and `trailing` content; `expanded` makes it the header of a collapsible section: `aria-expanded` and a chevron, the caller owning the state and the section; `leading` is content before the label (an `Avatar`), and `leadingWidth="thumbnail"` gives it a fixed width so rows with and without a picture line up; `size` sets the padding (`sm` dense, `md` default, `lg`); `focused` draws the focus ring on the row the keyboard cursor is on, for a list moved with the arrow keys while focus stays on the list; `selected` marks the row in view with an accent fill and `aria-current="true"`; a button or link row can hold its own link, button or `Checkbox` in `trailing`, with its own click; `secondary` is a second, muted line under the label; with no `href` and no `onClick` it is a plain `<div>`, for a row that holds its own buttons, and takes `actions`, buttons after `trailing`, always shown, and `panel`, content under the row lined up with the label, for a row that opens in place; a compact bordered list is `Card flush` around a `Stack divided` of such rows at `size="sm"` (no separate part); `highlighted` marks the row the pointer or the keyboard is on, with a fill one step deeper than hover, for a list that follows both through the row's `onPointerEnter`, `onPointerLeave` and `onFocus`, which every row passes through; a button row takes `disabledReason`, which fades the row and blocks it with `aria-disabled` while it stays in the tab order, and shows the reason as a tooltip on hover, keyboard focus and a tap, read out as its description (its native `title` without CSS anchor positioning)). `SortableList` (a list the user puts in order: `label` (required) names it, and `onReorder(move)` (required) is called once per drop with a `SortableMove`, `{ id, section?, target? }`, which the app applies to its own data; the list never reorders itself; its children are `SortableSection`s (`id` (required, the move's `section`), `title`, and `emptyLabel`, "Drop here" by default, the row an empty section shows) or `SortableItem`s directly; a `SortableItem` takes an `id` (required, the move's `id` and `target`), a `title` and, as children, a meta line under it; a pointer drags the row, and the keyboard uses its grip handle: Enter, the arrow keys, Enter to drop, Escape to cancel). `Tabs` (underline tabs for switching a view in place: a row over a bottom rule, the current tab underlined in the accent; `items` are `{ value, label }` buttons, with `value` the current one's `value` and `onChange(value)` the caller's state, one tab stop and the arrow keys, Home and End moving between enabled tabs, or `{ label, href, selected?, external? }` links in a `<nav>` with `aria-current="page"` on the current one (`selected`, or the item whose `value` is `value`); `label` names the group; a button tab takes `disabled` and `controls`, the id of its `role="tabpanel"`, which is the caller's; `orientation="vertical"` is the pill rail instead, the current tab filled, with no rule, stacked in one column for a `SidebarLayout` `aside`, and only the rail takes `size`; there is no `variant`: across is always underline, a `PageHeader` `tabs` slot and an `AppShell` `nav` included; `disabled` on the row disables every tab, e.g. until hydration). `SegmentedControl` (a joined pill group, one option filled; the same `items`, `value`, `onChange`, `disabled` and `label` as `Tabs`, as a `radiogroup` with `aria-checked` on each `radio`). On both an item takes `data-*` attributes (typed `data-${string}`) onto its button or link; on `Tabs` and `SegmentedControl` an item takes `count` (a small muted number after the label, part of its name: "Shots 12") and `title`; a button option takes `disabledReason`: it is `aria-disabled`, the arrow keys reach it and choose nothing, and the reason is its tooltip on hover, keyboard focus and a tap, read out as its description; a bare `disabled` option is `aria-disabled` too, and the arrow keys, Home and End skip it. `Dialog` (a modal on the browser's `<dialog>`, opened on mount, so render it only while open: `title` is its name, `description` a line under it, `footer` the right-aligned actions; a close button sits in the top corner (`closeLabel`, "Close"); Esc, the backdrop, the close button or a `<form method="dialog">` call `onClose`; the body scrolls and the page behind never does; `width` is `sm` (320px, a list), `md` (440px, default, a form), `lg` (640px, a wider form or a table) or `full` (the whole screen, for media or a player: the body fills the height between the title and the footer and scrolls if taller; there is no backdrop to click, so put a close button on a `<form method="dialog">` in the `footer`); `onSubmit` makes it a form (one `<form noValidate>` round the body, the `error` and the footer, so a submit button or Enter submits; no `<form method="dialog">` in its footer then); `error` is the whole submit's error, a danger `Callout` above the footer). `FieldDialog` (a `Dialog` with one text field and Cancel and submit buttons, every string passed in: `title`, `description`, `label` (which names the input), `placeholder`, `hint`, `emptyReason` (the field's error on an empty submit: the submit button is never disabled), `submit` and `busyLabel`; `onSubmit` gets the trimmed value and a resolved promise closes it, a rejection shows its message). `Drawer` (a modal slide-over on the right edge, on a native `<dialog>` opened on mount like `Dialog`, so render it only while open: `title` is its name, `description` a line under it, a close button sits beside it, `children` scroll between the header and an optional pinned `footer`; Esc, the scrim and the close button call `onClose`; `width` is `sm`, `md` (default) or `lg`; `closeLabel` names the close button). `BottomSheet` (a non-modal panel docked to the bottom of its positioned parent, over a view such as a map or a canvas that stays usable behind it; nothing is made inert and focus never moves; `label` (required) names the region and its handle; `snaps` (required, at least two, lowest first) are shares of the parent's height from 0 to 1, or `"120px"` strings; `snap` (required) is the current index, and `onSnapChange` (required) is told which snap to move to; the handle steps through the snaps with Enter and Space, a drag releases to the nearest snap, and Escape returns it to the first; `header` stays put, `children` scroll, and `footer` is pinned under the body; `onHeightChange(px)` reports its resting height, so a map camera can be padded by it; it is full width below `md` and a panel at the start edge from `md` up; ArrowUp and ArrowDown on the handle step a snap up or down, and `onHeightChange` also reports each height through a drag; `inlineFrom` (`md` or `lg`) renders it as plain content in the parent's flow from that width, with no handle, for a list beside the map), `ConfirmDialog` (a yes-or-no question before an action: an `alertdialog` that opens on Cancel; `title` is the question, `description` the consequence, `confirm` the action's verb; `tone` is `danger` (default, a red confirm) or `neutral`; `onConfirm` runs the action, and a returned promise keeps the button busy (`busyLabel`) until it settles: resolving closes it, and a rejection or a throw shows its message and keeps it open; `cancel` and `closeLabel` translate the other buttons), `Popover` (a button that opens a small panel of content beside it, a detail, a short list or a filter, on the browser's own popover rendered in place: a click outside, Esc or the trigger closes it and focus goes back to the trigger; not modal; `label` (required) names the trigger and the panel, `icon` makes the trigger a ghost icon button with `label` as its tooltip, `size` is the trigger's height; a list of actions is a `Menu`, a question to answer first a `Dialog`). `Pagination` (page links for a long list, in a `<nav>` named by `label` (required): `page` (from 1, drawn clamped into range) of `pageCount` (one page draws nothing), each page a link to `pageHref(page)` through the app's `LinkProvider`, so the page lives in the URL; Previous and Next in the outline `sm` look, plain text at the first and last page; a window of at most seven numbers (the first, the last, the current and its neighbours, `…` for a run of hidden pages), the current one `aria-current="page"`; below `sm` the numbers give way to `pageLabel` ("Page 4 of 12"); `previousLabel` and `nextLabel` for another language). `Breadcrumbs` (a `<nav>` named by `label`, "Breadcrumb" by default, over an ordered list; `items` are nodes, or `{ label, href, external? }` for one that links; the last is the current page and is never a link and gets `aria-current="page"`, and each crumb truncates). `SiteSearch` (a header button that opens a search dialog over links to the matching pages; put it in `AppShell`'s `controls`, render it once per page, and pass every page as `items` (`{ label, href, description?, keywords? }`, in rail order); `label` (required) is the dialog's title and the phone icon button's name; Ctrl+K (Cmd K on a Mac) opens it from anywhere; typing matches the label, then `keywords`, then the description; Enter opens the first result, the arrow keys move, and Esc closes it and returns focus; `resultsLabel` ("Results") is also a prop). `Table` (a list of records in a rounded, bordered card around a full-width `<table>` that scrolls sideways on a narrow screen; `label` (required) names it for assistive tech and is not drawn; a `TableHeaderCell` with `sort` and `onSort` makes its column sortable (the app sorts the rows), `TableRow selected` marks the row whose detail is open (`aria-current`), a `TableExpandCell` opens a row whose panel is a `TableCell span="full"`, and `TableBody empty` takes an `EmptyState` across every column; `size` is the row padding, `sm` by default, and the buttons and pills in its rows take the same size; inside a `Card` it is plain: no card of its own, no head strip and no row hover, only the row dividers; compose it from `TableHead`, `TableBody`, `TableFoot`, `TableRow`, `TableHeaderCell` (`numeric` declares a column of figures once, so the title and every cell under it are end aligned and the cells in tabular figures; `align` `start`, `center` or `end`; `label` is a visually hidden column name, in place of children, for a column of row actions: "Actions") and `TableCell` (`align`, `indent` of 1 to 3 to set a start-aligned cell in, for a line under a parent row, `tone` `neutral` (the default), `strong` or `muted`, or the tones `info`, `positive`, `warn` or `danger` for an amount that means something, in the tone's text colour and with no fill, so pair the colour with a sign or a word; `numeric` for a figure, end aligned in tabular figures (a cell under a `numeric` head cell is one already), `mono` for a small mono face, `lines={1}` to cap a long value to one line, cut it with an ellipsis and show the full text in a tooltip while it is cut, so its content is text (strings and numbers); `secondary` for a second, muted line under the content; `colSpan` passes through, so a `TableCell` with `colSpan` in a row of its own is a full-width panel, an empty state or a note, centred with `align="center"`); `TableEditCell` (a `TableCell` whose value opens an editor in place: `children` is the value, drawn as a button; a click, Enter or Space swaps it for `renderEditor(close)`, a plain control in the cell and not a popover of its own, and moves the focus into it; `close` and Esc put the focus back on the value, and a press outside or Tab out of it closes it too, so the control saves on its own change or submit; `label` names the button and the editor; it takes the `TableCell` props except `lines`); `InlineEdit` (the same edit trigger without the cell, for a `TableCell` that holds other content too: `label`, `renderEditor(close)` and `children`, with the same keyboard and focus behaviour); `TableFoot` (the `<tfoot>` for totals: its cells are strong by default and each row has a firmer line above it, alone and in a card alike); `TableGroupRow` (a full-width group header in the body: `label` spans `colSpan` columns, the table's column count, which is required; optional `trailing` content sits at the far end, and the group's rows follow it); `tone` on a `TableRow` in the body marks the row with a stripe on its leading edge over a soft fill: `neutral`, `info`, `positive`, `warn` or `danger`, as `Callout`, or `muted`, which only fades the row (a transfer, a row that is not the point); a bold subtotal is not a tone: `emphasis` on a `TableRow` in the body gives it a `TableFoot` row's look among the other rows; `stripe` (a text tone) draws the leading stripe alone, with no fill; a row takes one of `tone`, `stripe` and `emphasis`; `selected` on a `TableRow` marks the current one with the `ListRow` selected fill and `aria-current`, and wins over a tone; every table element passes `id`, `data-*` and `aria-*` through, and none takes a `className` or `style`). `Timeline` (a named `<ol>` of events; `label` is its `aria-label`, `empty` is drawn instead when there are no items) with `TimelineItem` (a `title`, an already-formatted `time`, the `children` as a note, and `tone`, a Callout tone for the marker dot, `neutral` by default). `KeyValueList` (a `<dl>` of label/value rows; each `KeyValue` takes a `label` and its value as children, the value right-aligned in tabular figures; `total` makes it the sum row, a firm rule above and strong text, and `tone` (a text tone: `muted`, `accent`, `info`, `positive`, `warn`, `danger`) colours the value on any row, so `total tone="warn"` is a total that does not reconcile; `align="start"` puts the values left-aligned in one column beside the labels instead). `Avatar` (a badge of the initials of `name`, titled with the name and `aria-hidden`; with `src` (the app's own local image path, never a remote one) it is a cropped `<img alt={name}>` instead, and if that image fails to load it shows the initials; `size` is `xs` (16px, for an inline mention), `sm`, `md` (default), `lg`, `xl` (56px), `2xl` (64px) or `3xl` (96px); `onClick` makes it one button named by `name`; `shape` is `round` (default, a person) or `square` (an org or a team); `href` makes it one link (`external` too); a row of overlapping avatars is an `AvatarStack`; the colour is one of seven stock background classes picked by a hash of the name, remapped by each theme). `AvatarStack` (a row of overlapping avatars, each in a ring of the page colour; `items` (required) is `{ name, src? }[]`, in order, with full names; `max` shows that many and then a "+N" chip of the same size and shape; `size` (default `md`) and `shape` (`round` default, or `square`) are as for `Avatar`; the row is one image to assistive tech, named by the people in it; while `loading` with no `items`, it draws three bones). `TextLink` (an inline text link in the accent colour; `href` is required and an in-app one goes through the app's `LinkProvider`, `external` adds `target="_blank"` and `rel="noreferrer"`, `stretch` covers the nearest `relative` ancestor so a whole row or card is the click target, `size` (`sm`, `md` or `lg`) pins the type size where it would otherwise follow the text around it, `mono` sets the monospace face, `tone` (`warn`, `danger`, `positive`, `info` or `muted`) gives it a meaning's colour in place of the accent (`neutral` and `accent` keep the accent), or `quiet`, the primary ink that turns the accent on hover, for a row or list of links and never inside a sentence; `icon` puts a decorative icon after the words; every other anchor prop passes through). `Mark` (a highlighted run inside text, a `<mark>` on the warn tint, for the words a search matched). `MetaList` (a wrapping row of facts or links in muted small text, joined by an `aria-hidden` `separator`: `·` (default), `•` or `none`; branch · SHA · date, or a footer's Privacy · Terms; an item is text, a `Code` or a `TextLink`, and never breaks inside itself; `mono` sets the row in the monospace face, for ids and paths). `PageFade` (the page's content area, named for the View Transitions API so a route change cross-fades it while the frame around it stays put; wrap what changes between pages, once per page, or give each a `name` (a CSS identifier) when there are two; it fades when the navigation runs in a view transition, through `startPageTransition(update)` (flushes a synchronous state change inside `document.startViewTransition`) or a router's own option such as TanStack Router `viewTransition`, and otherwise, in a browser without View Transitions, or under `prefers-reduced-motion: reduce`, it swaps with no fade; it renders a small `<style>`, with no colour in it, and the div is a stacking context, so portal an overlay that must rise above the frame). `Morph` (a `<div>`, or an `<li>` with `as="li"`, that grows into its counterpart on the next page and shrinks back on Back, through the View Transitions API, over 450 ms; wrap the list card and the detail element, each with the same `name` (required) and the record's id as `item` (required); `active={false}` leaves a second copy of one record unnamed, and two active ones with the same pair warn in development; one `name` and `item` pair may appear only once per page; it morphs only inside a view transition (`startPageTransition`, TanStack Router `defaultViewTransition: true` or a `Link`'s `viewTransition`), and otherwise, and under reduced motion, it swaps with no animation; while it is named it is a stacking context, so overlays inside it portal to the body; `refreshMorphs()` measures every mounted Morph again: call it after a router restores scroll after the render, with TanStack Router `router.subscribe("onRendered", () => refreshMorphs())`, subscribed after the router is created; it does nothing on the server). `NavigationProgress` (a thin indeterminate accent bar fixed along the top edge of the viewport, over the header, for a route change under way; `loading` is the router's pending flag (TanStack Router: `useRouterState({ select: (s) => s.status === "pending" })`), `label` its accessible name (default "Loading page"); it draws the bar while `loading` is true and nothing otherwise, with the bar invisible for its first 150ms so a fast navigation shows nothing; render it once per app, beside the page frame, and pair it with `PageFade`; a still bar under `prefers-reduced-motion: reduce`; it adds nothing to the layout and has no router dependency). `EmptyState` (what a page or list shows when it has nothing yet: a centred `title`, the `children` as the explanation under it, and `actions` in a centred row; a named `<section>`, which draws its own dashed frame on its own and none inside a `Card`; `icon` sets a mark above the title; `level` is the title's heading level, one below the heading that holds it, and does not change its look; `size="sm"` is one muted line, the empty line inside a card). `Steps` (a numbered `<ol>` of `Step`s, each a `title` and the `children` as a detail line, the numbers counted by CSS in an accent disc; for a "get started" list, not for progress). `Divider` (a hairline `<hr>` in the theme's line colour; spacing comes from the layout around it). `BulletList` (a `<ul>` with discs, an indent and a small gap; its children are `BulletItem`s, each an `<li>` in the body text). `Code` (inline code: mono, on a subtle background; `lines={1}` keeps a long value on one line with an ellipsis and its whole text in a tooltip while it is cut, `breakWords` breaks it at the edge of its box instead). `CodeBlock` (a block of code, no client JS: the text is `children` (a string) or `lines` (one entry per line), `language` (`text` (default, one colour), `tsx`, `ts`, `js`, `json`, `bash`, `console`, `css`, `html` or `yaml`) colours it, `console` being a shell session where a `$ ` line is a command and the rest is output, and `copy` then copies only the commands; `label` is a caption naming the language or file; long lines wrap by default, so nothing is cut off and a command copies as one line, and `overflow="scroll"` keeps lines whole and scrolls them under a scrollbar in the theme's muted ink; `copy` adds a copy button beside the code, which copies it exactly as given; on a static page it needs `copyScript` (see Copy on a static page); other props go on the root `<figure>`). `CodeExample` (one framed example: the rendered `children` over the `code` that makes them, coloured as TSX, in one bordered box, with an optional `caption` as its last band; a wide preview or long code scrolls inside the frame under the same themed scrollbar; `copy` adds a button that copies the code; no client JS without `copy`). `Kbd` (a keyboard key in mono; its border takes the surrounding text colour, so it reads on a filled button too). `Fieldset` (a `<fieldset>` named by its `label`, drawn as its legend in the `Field` label's look, over its children in one column: `Checkbox`es for one question, `Field`s in a `FormGrid`, or a `ButtonGroup` of `outline` `sm` `Button`s with `pressed` for filter chips; `hint` is a muted line under it and its `aria-describedby`, `error` replaces it in red with `role="alert"`; `disabled` disables every control inside; a `RadioGroup` is its own group and never goes in one). `DateField` and `DateRangePicker` (see Dates).
|
|
98
111
|
- Dates: `toISODate`, `fromISODate`, and the `CalendarDate` type.
|
|
99
112
|
|
|
100
113
|
## Loading
|
|
@@ -126,7 +139,7 @@ import { DateField, fromISODate, toISODate, type CalendarDate } from "@slashsuit
|
|
|
126
139
|
<DateField
|
|
127
140
|
calendar
|
|
128
141
|
label="Date of birth"
|
|
129
|
-
hint="
|
|
142
|
+
hint="As on your ID document."
|
|
130
143
|
defaultValue={fromISODate("1990-05-17")}
|
|
131
144
|
maxValue={fromISODate("2026-10-23")}
|
|
132
145
|
onChange={(date: CalendarDate | null) => save(toISODate(date))}
|
|
@@ -135,13 +148,15 @@ import { DateField, fromISODate, toISODate, type CalendarDate } from "@slashsuit
|
|
|
135
148
|
/>;
|
|
136
149
|
```
|
|
137
150
|
|
|
138
|
-
- `DateField` is a segmented
|
|
139
|
-
`
|
|
151
|
+
- `DateField` is a segmented date field in the browser's locale: 11/29/2026 in en-US, 29/11/2026
|
|
152
|
+
in en-GB. `locale` (a BCP 47 tag) overrides it for the order, the month names and the messages;
|
|
153
|
+
an `I18nProvider` from `react-aria-components` around the app does the same for every field.
|
|
154
|
+
`name` posts `YYYY-MM-DD` whatever the locale. `calendar` adds a calendar button. The popover has ‹ › month steps, month and year dropdowns,
|
|
140
155
|
Monday-first weeks and a Clear action. `defaultOpen` opens it on mount.
|
|
141
156
|
- Without `calendar` it is typed only, for a date the person knows by heart.
|
|
142
157
|
- It takes `label`, `hint`, `error`, `value` / `defaultValue` / `onChange`, `minValue`,
|
|
143
158
|
`maxValue`, `disabled`, `required`, `size` and `name` (the form posts `YYYY-MM-DD`). With `calendar`,
|
|
144
|
-
`monthLabel` and `yearLabel` name the dropdowns (default `Month` and `Year`).
|
|
159
|
+
`monthLabel` and `yearLabel` name the dropdowns (default `Month` and `Year`), and `clearLabel` the Clear button (default `Clear`).
|
|
145
160
|
Values are `CalendarDate`s (from `@internationalized/date`, re-exported as a type).
|
|
146
161
|
- `toISODate(date)` gives `"1990-05-17"` (`""` for `null`); `fromISODate(text)` gives a
|
|
147
162
|
`CalendarDate`, or `null` for a malformed or impossible date such as `"1990-02-31"`.
|
|
@@ -156,10 +171,14 @@ import { DateField, fromISODate, toISODate, type CalendarDate } from "@slashsuit
|
|
|
156
171
|
error once the field loses focus.
|
|
157
172
|
- An impossible date such as 31/02/1990 shows "February 1990 has 28 days." and stays exactly as
|
|
158
173
|
typed, focus leaving included, until it is fixed.
|
|
159
|
-
- `error` is an error from outside the field, a server's say: it shows
|
|
160
|
-
|
|
174
|
+
- `error` is an error from outside the field, a server's say: it shows under the hint, in red
|
|
175
|
+
and announced politely (as `Field`'s `error` does), and marks the field invalid. It wins over
|
|
161
176
|
the built-in messages; clear it when the date changes.
|
|
162
|
-
- `
|
|
177
|
+
- `DateTimeField` is a date and a time, to the minute, in the same segments: a 24-hour clock where
|
|
178
|
+
the locale uses one (en-GB), AM/PM where it does not (en-US). Its value is a `CalendarDateTime`;
|
|
179
|
+
`name` posts `YYYY-MM-DDTHH:mm` on the 24-hour clock, and `toISODateTime` / `fromISODateTime`
|
|
180
|
+
convert. It has no calendar.
|
|
181
|
+
- `DateRangePicker` is a from and to date in one field, each side in the locale's order, with a
|
|
163
182
|
calendar button that opens one month, where two presses pick the range.
|
|
164
183
|
- Its value is a `DateRange`, `{ start, end }`, or `null`; `onChange` reports a range only when both
|
|
165
184
|
sides are complete, real, within `minValue` / `maxValue` and in order, and `null` otherwise.
|
|
@@ -167,7 +186,7 @@ import { DateField, fromISODate, toISODate, type CalendarDate } from "@slashsuit
|
|
|
167
186
|
- `presets` are `DateRangePreset`s, `{ label, value }`, a row of buttons above the month. The app
|
|
168
187
|
builds them from its own today; the picker never reads the clock.
|
|
169
188
|
- `label`, `hint`, `error`, `minValue`, `maxValue`, `required`, `disabled`, `size`, `defaultOpen`,
|
|
170
|
-
`monthLabel` and `yearLabel` work as on a `DateField`.
|
|
189
|
+
`locale`, `monthLabel` and `yearLabel` work as on a `DateField`.
|
|
171
190
|
|
|
172
191
|
## Router links
|
|
173
192
|
|
|
@@ -309,21 +328,23 @@ import {
|
|
|
309
328
|
`actions` beside it and the same `width`.
|
|
310
329
|
- **`Cluster`** spaces items in a row, the counterpart of `Stack`: `gap` is `xs` (`gap-2`), `sm`
|
|
311
330
|
(`gap-4`, the default) or `md` (`gap-6`), `align` the cross axis (`center` (default), `baseline`,
|
|
312
|
-
`start` or `end`), `justify` the main axis (`start` (default), `between` or `end`), and the row
|
|
331
|
+
`start` or `end`), `justify` the main axis (`start` (default), `center`, `between` or `end`), and the row
|
|
313
332
|
flows onto more lines when it runs out of room (`wrap={false}` keeps it on one line). Wrap the one item that
|
|
314
333
|
should take the room left in **`ClusterGrow`**, an input beside its buttons say: it can shrink to
|
|
315
334
|
nothing, so the items beside it stay on the line; `minWidth` (`sm` 12rem, `md` 17rem) gives it a
|
|
316
335
|
floor instead, so in a Cluster that wraps it drops under the others rather than squashing. An empty `ClusterGrow` is a spacer that pushes
|
|
317
336
|
what follows it to the end. `ButtonGroup` stays the row for buttons; `Cluster` is any other row.
|
|
337
|
+
`as="ul"` or `as="ol"` is a wrapping list (tags, chips): pass the items, and the Cluster puts each
|
|
338
|
+
in its own `<li>`. `as="nav"` is a row of links, a `<nav>` named by its required `aria-label`.
|
|
318
339
|
It is a separate part, not `Stack direction="row"`, because a row has no `lg`, `xl` or
|
|
319
340
|
`width` and a column has no `align` or `justify`.
|
|
320
|
-
- **`FormGrid`** is the two-column form: `Field`s in two columns
|
|
341
|
+
- **`FormGrid`** is the two-column form: `Field`s in two columns once the grid is 36rem wide (its own width, not the viewport's), one below. A `Field`
|
|
321
342
|
with `span="full"` (a textarea, a long hint) runs across both. **`FormRow`** is an inline-edit
|
|
322
343
|
row of **`FormRowField`**s (a compact `text-xs` label over a control; `span` 1, 2, 3 or 4 is its
|
|
323
344
|
share of the row, so 2, 1 and 1 give a half and two quarters) with optional `actions` after
|
|
324
345
|
them (a save button, kept at its own width). Every control sits on the bottom edge, so the actions
|
|
325
|
-
line up with them, and
|
|
326
|
-
width of a `FormGrid`. Its `hint`
|
|
346
|
+
line up with them, and narrower than 36rem (its own width) the fields and the actions stack. A `FormRow` is always the full
|
|
347
|
+
width of a `FormGrid`. Its `hint` and `error` (under the hint, announced politely) sit under
|
|
327
348
|
the whole row; a `FormRowField` has no note of its own, so the controls beside each other stay
|
|
328
349
|
level. Closed spans, no `col-span` or width to pass.
|
|
329
350
|
|
|
@@ -331,14 +352,18 @@ import {
|
|
|
331
352
|
`4`: one column on a phone, two from `sm`, `columns` from `lg`. `columns="auto"` instead fits as
|
|
332
353
|
many per row as the width allows, each at least `minWidth` wide: `md` (17rem, default) or `sm`
|
|
333
354
|
(12rem); `minWidth` is only for `auto`. Every tile is one width: a main card beside a narrower one is a `SideColumn`. `align="start"` keeps each card its own height; the
|
|
334
|
-
default stretches every card to the tallest in its row
|
|
335
|
-
|
|
355
|
+
default stretches every card to the tallest in its row; `align="regions"` also lines up each
|
|
356
|
+
card's header, body and footer with its neighbours' across the row (CSS subgrid).
|
|
357
|
+
`minColumns={2}` keeps two small tiles to a row on a phone. `as="ul"` makes it a list, each child
|
|
358
|
+
wrapped in an `<li>`. A `CardGridRow` spans every column, for a heading over a group or one wide
|
|
359
|
+
card in the run. Every cell shrinks to its column, so a long name truncates instead of widening it.
|
|
336
360
|
- **`SideColumn`**: use this when part of a page is a main area beside a side column of a known width,
|
|
337
361
|
such as a thread beside an assistant. `children` are the main area and `aside` the column; from `lg`
|
|
338
|
-
the aside is `asideWidth` wide on the right (`sm` 18rem, `md` 24rem, the default) and the
|
|
339
|
-
takes the room left, and below `lg` the aside stacks under it
|
|
362
|
+
the aside is `asideWidth` wide on the right (`xs` 12rem, `sm` 18rem, `md` 24rem, the default) and the
|
|
363
|
+
main area takes the room left, and below `lg` the aside stacks under it; `side="start"` puts it on
|
|
364
|
+
the left and first. `asideLabel` names the `<aside>` landmark, and `fold` folds the aside, closed,
|
|
340
365
|
behind a native disclosure of that name below `lg` (the aside stays mounted, so state inside it is
|
|
341
|
-
kept)
|
|
366
|
+
kept); from `lg` it is the same column, always shown. It sets no page width, padding or header of
|
|
342
367
|
its own, so it sits inside a layout or a card; a share of a page under a `PageHeader` is
|
|
343
368
|
`DetailLayout`'s aside. A `Stack` with `rowFrom` and a `ClusterGrow` sizes the side by its content
|
|
344
369
|
and is not a fixed column. A grid of fields, one row per item, is a `Table` in a `Card`.
|
|
@@ -352,9 +377,9 @@ import {
|
|
|
352
377
|
script. Hidden is `display: none`, so the content leaves the accessibility tree and the tab
|
|
353
378
|
order. Shown, the wrapper adds no box, so the children take the parent's gap. Hidden content
|
|
354
379
|
stays mounted, so two `Show`s of the same content mount it twice; a stateful panel that folds is
|
|
355
|
-
a `SideColumn
|
|
380
|
+
a `SideColumn fold`. `as="span"` is for use inside phrasing content.
|
|
356
381
|
- **`SiteFooter`**: the footer that goes in `AppShell`'s `footer` slot. `brand` is the site's mark,
|
|
357
|
-
linked to `brandHref` (default `/`) and named by `brandLabel`. `children` is the contact line
|
|
382
|
+
linked to `brandHref` (default: the `LinkProvider`'s `home`, else `/`) and named by `brandLabel`. `children` is the contact line
|
|
358
383
|
beside it. `links` (`{ label, href, external? }[]`) is one wrapping row. `notes` are lines of
|
|
359
384
|
fine print, one paragraph each. It is not a `<footer>`: the shell draws the one `contentinfo`
|
|
360
385
|
landmark. No link columns, newsletter form or social icons.
|
|
@@ -377,7 +402,7 @@ padding. `ListLayout`, `DetailLayout`, `FormLayout` and `ProseLayout` take the `
|
|
|
377
402
|
landmark.
|
|
378
403
|
- **`FormLayout`**: use this for a create or edit page. A `max-w-3xl` `<form>` that starts at the
|
|
379
404
|
Container's start edge (it is not re-centred, so the title does not jump), with an `actions` row at
|
|
380
|
-
the end. Other props (`onSubmit`, `action`) go on the `<form>`.
|
|
405
|
+
the end and an optional `note`, a muted line set apart under it. Other props (`onSubmit`, `action`) go on the `<form>`.
|
|
381
406
|
- **`ProseLayout`**: use this for a text page (privacy, terms, a CV, an about page). One `narrow`
|
|
382
407
|
(`max-w-3xl`) column that starts at the Container's start edge (not re-centred, so the title does
|
|
383
408
|
not jump): the header, then `children` in a `Stack` (`gap` prop, `md` by default). Unlike
|
|
@@ -392,7 +417,7 @@ padding. `ListLayout`, `DetailLayout`, `FormLayout` and `ProseLayout` take the `
|
|
|
392
417
|
the rail then folds, closed, behind a disclosure of that name, so a phone shows the page first;
|
|
393
418
|
`asideLabel` also names the rail's `<aside>` landmark.
|
|
394
419
|
- **`DocsLayout`**: use this for a docs page. It is a `SidebarLayout` whose rail is `nav` (required,
|
|
395
|
-
`{ title?, items }[]`, each group's title over a vertical pill list), named by `
|
|
420
|
+
`{ title?, items }[]`, each group's title over a vertical pill list), named by `asideLabel`
|
|
396
421
|
(required). Below `md` the rail folds behind a disclosure of that name. The canvas holds
|
|
397
422
|
`breadcrumbs`, the `title` (required, the `h1`), `description` (a `Lead`), an "On this page" list
|
|
398
423
|
of `contents` (`{ id, label, level: 2 | 3 }[]`; none with fewer than two; named by
|
|
@@ -442,22 +467,41 @@ copy it once between them, so the script is safe on a hydrated page too.
|
|
|
442
467
|
## Light and dark
|
|
443
468
|
|
|
444
469
|
A dark theme does its colour work under `.dark`; this only decides whether `.dark` is on `<html>`.
|
|
445
|
-
Two states
|
|
446
|
-
`prefers-color-scheme` decides
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
470
|
+
Two states: the system's scheme, with nothing stored, and the other one, stored. With nothing stored
|
|
471
|
+
the system's `prefers-color-scheme` decides, and the page follows it live when the system switches.
|
|
472
|
+
A click to the other scheme stores it; a click back to the system's scheme forgets it, so the page
|
|
473
|
+
follows the system again. A choice made in one tab reaches the others. Which dark theme is loaded
|
|
474
|
+
stays your CSS import.
|
|
475
|
+
|
|
476
|
+
1. **Put the scheme meta and inline `colourSchemeScript` in `<head>`**, before the stylesheet, so the
|
|
477
|
+
class is right at first paint and neither scheme flashes the other. The script is a few hundred
|
|
478
|
+
bytes of plain JavaScript. `<meta name="color-scheme" content="light dark">` tells the browser
|
|
479
|
+
the page draws both, so the canvas, form controls and scrollbars it paints before the CSS loads
|
|
480
|
+
follow the system rather than flashing white on a dark system:
|
|
450
481
|
|
|
451
482
|
```tsx
|
|
452
483
|
import { colourSchemeScript } from "@slashsuite/ui-react";
|
|
453
484
|
|
|
454
485
|
<head>
|
|
486
|
+
<meta name="color-scheme" content="light dark" />
|
|
455
487
|
<script dangerouslySetInnerHTML={{ __html: colourSchemeScript }} />
|
|
456
488
|
</head>;
|
|
457
489
|
```
|
|
458
490
|
|
|
459
491
|
In Astro, use `<script is:inline set:html={colourSchemeScript} />`.
|
|
460
492
|
|
|
493
|
+
Two more lines belong in the same `<head>`. A browser bar tinted to the page takes one
|
|
494
|
+
`theme-color` per scheme, each your theme's page colour (`AppShell`'s canvas); these follow the
|
|
495
|
+
system's scheme, not a stored choice:
|
|
496
|
+
|
|
497
|
+
```html
|
|
498
|
+
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#eff1f5" />
|
|
499
|
+
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1e1e2e" />
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
And `<meta name="text-scale" content="scale">` opts the page in to the reader's OS text size, so
|
|
503
|
+
the components' rem sizes grow with it. A browser that does not know it ignores it.
|
|
504
|
+
|
|
461
505
|
2. **Drop the hard-coded `class="dark"`** from `<html>`. The script sets and removes it (and
|
|
462
506
|
`color-scheme`, so native controls and scrollbars follow). For a server-rendered `<html>`, add
|
|
463
507
|
`suppressHydrationWarning` (React) because the script changes its `class` before React hydrates.
|
|
@@ -472,8 +516,9 @@ Two states, light and dark. The stored choice wins; with nothing stored the syst
|
|
|
472
516
|
|
|
473
517
|
It is an icon button showing the scheme you would switch *to* (a sun on a dark page, a moon on a
|
|
474
518
|
light one), labelled "Switch to light theme" / "Switch to dark theme". A click applies the scheme
|
|
475
|
-
to `<html>` and stores it under `localStorage["hackcove:colour-scheme"]
|
|
476
|
-
|
|
519
|
+
to `<html>` and stores it under `localStorage["hackcove:colour-scheme"]`, or, when it lands on the
|
|
520
|
+
system's scheme, removes that key; a storage error (private mode) is swallowed and the page still
|
|
521
|
+
switches. `onChange` gets the new scheme and `followsSystem`, true when it is the system's. It reads the current state from the `dark` class
|
|
477
522
|
when it mounts, so it agrees with the script and renders the same on the server and the client.
|
|
478
523
|
It draws both icons and a small `<style>` shows one from the class on `<html>`, so a dark visitor
|
|
479
524
|
with no cookie and no `defaultValue` sees the sun from the first frame, not the server's light-page moon;
|
|
@@ -506,20 +551,32 @@ Two states, light and dark. The stored choice wins; with nothing stored the syst
|
|
|
506
551
|
<ColourSchemeToggle
|
|
507
552
|
store={false}
|
|
508
553
|
defaultValue={scheme} // read from the cookie on the server
|
|
509
|
-
onChange={(next) => {
|
|
510
|
-
document.cookie =
|
|
554
|
+
onChange={(next, followsSystem) => {
|
|
555
|
+
document.cookie = followsSystem
|
|
556
|
+
? "scheme=; path=/; max-age=0" // forget it: the page follows the system again
|
|
557
|
+
: `scheme=${next}; path=/; max-age=31536000; samesite=lax`;
|
|
511
558
|
// or POST it to the server, which sets the cookie
|
|
512
559
|
}}
|
|
513
560
|
/>
|
|
514
561
|
```
|
|
515
562
|
|
|
563
|
+
With `store={false}` the toggle does not follow the system or other tabs: the app owns the choice.
|
|
564
|
+
|
|
516
565
|
The toggle takes `id`, `data-*` and the rest of a button's props, which go on its button. It has no
|
|
517
566
|
`aria-pressed`: its label already says what a click does ("Switch to dark theme"), and a pressed state on a
|
|
518
567
|
button whose label changes would say it twice.
|
|
519
568
|
|
|
520
569
|
Without React, `applyColourScheme(scheme, root?, schemes?)`, `readColourScheme(fallback?)`,
|
|
521
|
-
`storeColourScheme(scheme)` and `schemeClass(scheme, schemes?)` are
|
|
522
|
-
`"light" | "dark"` and `ColourSchemeClasses` is the `schemes` shape.
|
|
570
|
+
`storeColourScheme(scheme)` (`"system"` forgets the choice) and `schemeClass(scheme, schemes?)` are
|
|
571
|
+
exported too; `ColourScheme` is `"light" | "dark"` and `ColourSchemeClasses` is the `schemes` shape.
|
|
572
|
+
|
|
573
|
+
**With JavaScript off.** The scheme is a class on `<html>`, so with no script a page gets the scheme
|
|
574
|
+
its server rendered. A server that renders the page can still follow the system in Chromium, from
|
|
575
|
+
the `Sec-CH-Prefers-Color-Scheme` client hint: answer with `Accept-CH: Sec-CH-Prefers-Color-Scheme`,
|
|
576
|
+
`Critical-CH: Sec-CH-Prefers-Color-Scheme` and `Vary: Sec-CH-Prefers-Color-Scheme`, then render
|
|
577
|
+
`schemeClass(hint === "dark" ? "dark" : "light")` on `<html>` when no cookie holds a choice. Other
|
|
578
|
+
browsers send no hint and get the server's default; with the script on, every browser follows the
|
|
579
|
+
system.
|
|
523
580
|
|
|
524
581
|
## Palette
|
|
525
582
|
|
|
@@ -547,4 +604,4 @@ A theme remaps every utility in `palette.json`; a component uses no colour utili
|
|
|
547
604
|
From the workspace root: `bunx moon run ui-react:typecheck ui-react:lint ui-react:test ui-react:build` and
|
|
548
605
|
`bunx moon run ui-react:pack-check` (the tarball is `dist/` plus `package.json`, `README.md`, `LICENSE`; it also typechecks the tarball in a
|
|
549
606
|
consumer app: `scripts/consumer-types.ts`).
|
|
550
|
-
The
|
|
607
|
+
The docs' code examples live in `docs/examples`, one module per component; the site's docs and the Storybook stories both render them.
|