@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
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
## Body text
|
|
2
|
+
|
|
3
|
+
Group: Text
|
|
4
|
+
|
|
5
|
+
When to use: Every run of text that is not a heading: a paragraph, a supporting line, a note, a label.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
Body copy is `Text`, with `Text strong` for emphasis inside it and `Caption` for the fine print.
|
|
9
|
+
```tsx
|
|
10
|
+
import { Caption, Stack, Text } from "@slashsuite/ui-react";
|
|
11
|
+
|
|
12
|
+
<Stack gap="xs">
|
|
13
|
+
<Text>
|
|
14
|
+
Invoice{" "}
|
|
15
|
+
<Text as="span" strong>
|
|
16
|
+
INV-204
|
|
17
|
+
</Text>{" "}
|
|
18
|
+
is due on Friday.
|
|
19
|
+
</Text>
|
|
20
|
+
<Caption>Sent 2 minutes ago</Caption>
|
|
21
|
+
</Stack>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Do
|
|
25
|
+
- Set a paragraph in `Text`, a `<p>`. Inside a row, a cell or a sentence it is `Text as="span"`. A block of it stops at a readable line length.
|
|
26
|
+
- Emphasise a run with `Text strong` inside the `Text`: font-medium in the primary ink. `Mark` highlights a run on the warn tint, such as the words a search matched; it is not emphasis. Use `Caption` for fine print and metadata, `Caption as="span"` inside a row.
|
|
27
|
+
- Put a `Text` under a heading and `Lead` under a `Display`. `Overline` is the small all-caps label above a group, not a title.
|
|
28
|
+
- A Card, a table or a list with nothing in it yet takes an `EmptyState` in its `empty` slot, which draws it as one muted line there; a muted `Text` is not an empty state.
|
|
29
|
+
- `tone` is the one ink prop: `neutral`, the default, the role's own ink; `muted` and `accent` for the hierarchy of the text; and `positive`, `warn`, `danger` or `info` for what a run means. The words still say it, so colour is never the only signal.
|
|
30
|
+
- `numeric` sets tabular figures so a column of amounts lines up and `mono` the monospace face for an id or a path. `lines` (1 to 4) on `Text` or `Caption` shows at most that many lines and ends in an ellipsis: `lines={1}` cuts a run where its box ends, `lines={3}` clamps a long description. A "Show all" is your own state: `lines={open ? undefined : 3}` beside a `Button`.
|
|
31
|
+
- `align` sets a run at `start`, `center` or `end` of its block, for a table header or a right-hand column. `minWidth="amount"` on `Text` fixes a width and right-aligns a money figure in it, so a column of amounts lines up.
|
|
32
|
+
- `italic` on `Text` or `Caption` sets a muted hint or a caption in italic. `breakWords` breaks a long unbroken string, such as a URL or a token, at the edge of its box.
|
|
33
|
+
|
|
34
|
+
### Don't
|
|
35
|
+
- Never write a bare `<p>`, `<span>`, `<strong>` or `<small>`: they carry none of the theme's type scale or colour.
|
|
36
|
+
|
|
37
|
+
Plain HTML text elements carry no size, weight or colour of the theme. Every run of text is a typography part.
|
|
38
|
+
```tsx
|
|
39
|
+
import { Stack } from "@slashsuite/ui-react";
|
|
40
|
+
|
|
41
|
+
<Stack gap="xs">
|
|
42
|
+
<p>
|
|
43
|
+
Invoice <strong>INV-204</strong> is due on Friday.
|
|
44
|
+
</p>
|
|
45
|
+
<small>Sent 2 minutes ago</small>
|
|
46
|
+
</Stack>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`muted` and `accent` are the hierarchy of text, not its meaning: an error in the accent ink reads as a link, and in muted grey as nothing at all.
|
|
50
|
+
```tsx
|
|
51
|
+
import { Stack, Text } from "@slashsuite/ui-react";
|
|
52
|
+
|
|
53
|
+
<Stack gap="xs">
|
|
54
|
+
<Text tone="accent">Saved.</Text>
|
|
55
|
+
<Text tone="muted">Could not save: the name is taken.</Text>
|
|
56
|
+
</Stack>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
An `Overline` is a `span`, not a heading: a section titled by one has no place in the page outline. Use `SectionHeading`.
|
|
60
|
+
```tsx
|
|
61
|
+
import { Overline, Stack, Text } from "@slashsuite/ui-react";
|
|
62
|
+
|
|
63
|
+
<Stack gap="xs">
|
|
64
|
+
<Overline>Invoices</Overline>
|
|
65
|
+
<Text>Two invoices are due this week.</Text>
|
|
66
|
+
</Stack>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
A muted `Text` looks like the empty line but is only words: it is not an empty state. Use `EmptyState size="sm"`.
|
|
70
|
+
```tsx
|
|
71
|
+
import { Card, Text } from "@slashsuite/ui-react";
|
|
72
|
+
|
|
73
|
+
<Card title="Done" count={0}>
|
|
74
|
+
<Text tone="muted">Nothing finished yet.</Text>
|
|
75
|
+
</Card>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
One muted line is not a view: with a button under it nothing says what the page is for. Use `EmptyState`.
|
|
79
|
+
```tsx
|
|
80
|
+
import { Button, Stack, Text } from "@slashsuite/ui-react";
|
|
81
|
+
|
|
82
|
+
<Stack>
|
|
83
|
+
<Text tone="muted">No projects yet.</Text>
|
|
84
|
+
<Button>Create a project</Button>
|
|
85
|
+
</Stack>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Accessibility
|
|
89
|
+
- `Text`, `Caption` and `Lead` render a `p`, and `Overline` a `span`. `as` changes the element: a `span` for `Text` or `Caption` inside a row or a sentence, or an `li`. A field's label is the `Field`'s, never an `Overline`.
|
|
90
|
+
- `Overline` is a label, not a heading: it adds nothing to the page outline. A small section title is `Section size="sm"`, not `Overline as="h2"`.
|
|
91
|
+
- `lines` sets the full text as the `title` when the content is plain text, so a pointer user can read what was cut. Give a `title` of your own when the content is not.
|
|
92
|
+
- A `tone` changes only the colour. The wording has to carry the meaning.
|
|
93
|
+
- `Mark` renders a `<mark>`. Most screen readers do not announce it, so the highlight is a help to the eye, never the only way to find the match.
|
|
94
|
+
|
|
95
|
+
### Props
|
|
96
|
+
### Text
|
|
97
|
+
Running text. A paragraph (`p`; `as="span"` for a run inside a row, a cell or a sentence), text-base/6 normal, secondary (text-sm/5 under an `AppShell density="compact"`, text-base/7 inside a `Prose`). A block of it stops at a readable line length (`max-w-[72ch]`), wherever it sits. `strong` emphasises it: font-medium in the primary ink, unless `tone` says otherwise. `preserveNewlines` keeps the line breaks in the text (a user-typed note); runs of spaces still collapse. `tone` colours it by meaning (`positive` for "Saved.", `danger` for an error, `muted` for a quieter line), `numeric` sets tabular figures, `mono` the monospace face, and `lines` shows at most 1 to 4 lines, ending in an ellipsis (the full text becomes its `title`). `align` sets it at `start`, `center` or `end`. `italic` slants it, `breakWords` breaks a long unbroken string at the edge of its box, and `minWidth="amount"` fixes a width and right-aligns the figure in it (a column of amounts lines up); it does not take `align`.
|
|
98
|
+
- align: "center" | "end" | "start". Set the text at `start`, `center` or `end` of its block. The run becomes block-level, so the
|
|
99
|
+
alignment has a box to act on (a table header cell, a right-hand column).
|
|
100
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
101
|
+
- breakWords: boolean. Break a long unbroken string (a URL, a token) where the container ends, instead of overflowing.
|
|
102
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
103
|
+
- italic: boolean. Italic: a muted hint or a caption.
|
|
104
|
+
- lines: 2 | 3 | 4 | 1. Show at most this many lines (1 to 4) and end in an ellipsis: `1` cuts the run where its
|
|
105
|
+
container ends, `2` to `4` wrap and stop. With plain-text content the full text becomes the
|
|
106
|
+
`title`. A "Show all" toggle is the app's own state: `lines={open ? undefined : 3}`.
|
|
107
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
108
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
109
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
110
|
+
- minWidth: "amount". A fixed width: `amount` is a right-aligned money figure, min-w-24, in tabular figures.
|
|
111
|
+
- mono: boolean. The monospace face, for an id, a path or a command.
|
|
112
|
+
- numeric: boolean. Tabular figures, so a column of amounts lines up.
|
|
113
|
+
- preserveNewlines: boolean. Keep the line breaks in the text (a user-typed note); runs of spaces still collapse.
|
|
114
|
+
- strong: boolean. Emphasis: font-medium in the primary ink (`tone` still wins).
|
|
115
|
+
- title: string. The full text on hover, for a run that `lines` cuts and whose content is not plain text.
|
|
116
|
+
- tone: "muted" | "neutral" | "info" | "positive" | "warn" | "danger" | "accent". The ink: `neutral`, the default, is the role's own; `muted` and `accent` set the hierarchy of
|
|
117
|
+
the text; `positive`, `warn`, `danger` and `info` say what a run means (see `TextTone`).
|
|
118
|
+
|
|
119
|
+
### Caption
|
|
120
|
+
Fine print / metadata. A paragraph (`p`; `as="span"` inline), text-sm/5 normal, tertiary (text-xs/4 under an `AppShell density="compact"`). Takes `tone`, `numeric`, `mono`, `lines` and `align` like `Text`, and `italic` for a muted hint and `breakWords` for a long unbroken string such as a URL.
|
|
121
|
+
- align: "center" | "end" | "start". Set the text at `start`, `center` or `end` of its block. The run becomes block-level, so the
|
|
122
|
+
alignment has a box to act on (a table header cell, a right-hand column).
|
|
123
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
124
|
+
- breakWords: boolean. Break a long unbroken string (a URL, a token) where the container ends, instead of overflowing.
|
|
125
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
126
|
+
- italic: boolean. Italic: a muted hint or a caption.
|
|
127
|
+
- lines: 2 | 3 | 4 | 1. Show at most this many lines (1 to 4) and end in an ellipsis: `1` cuts the run where its
|
|
128
|
+
container ends, `2` to `4` wrap and stop. With plain-text content the full text becomes the
|
|
129
|
+
`title`. A "Show all" toggle is the app's own state: `lines={open ? undefined : 3}`.
|
|
130
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
131
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
132
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
133
|
+
- mono: boolean. The monospace face, for an id, a path or a command.
|
|
134
|
+
- numeric: boolean. Tabular figures, so a column of amounts lines up.
|
|
135
|
+
- title: string. The full text on hover, for a run that `lines` cuts and whose content is not plain text.
|
|
136
|
+
- tone: "muted" | "neutral" | "info" | "positive" | "warn" | "danger" | "accent". The ink: `neutral`, the default, is the role's own; `muted` and `accent` set the hierarchy of
|
|
137
|
+
the text; `positive`, `warn`, `danger` and `info` say what a run means (see `TextTone`).
|
|
138
|
+
|
|
139
|
+
### Overline
|
|
140
|
+
Small all-caps label above a group. `span`, text-xs semibold uppercase, tertiary. `tone`, `numeric`, `mono` and `align` are opt-in, as on `Text`.
|
|
141
|
+
- align: "center" | "end" | "start". Set the text at `start`, `center` or `end` of its block. The run becomes block-level, so the
|
|
142
|
+
alignment has a box to act on (a table header cell, a right-hand column).
|
|
143
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
144
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
145
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
146
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
147
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
148
|
+
- mono: boolean. The monospace face, for an id, a path or a command.
|
|
149
|
+
- numeric: boolean. Tabular figures, so a column of amounts lines up.
|
|
150
|
+
- tone: "muted" | "neutral" | "info" | "positive" | "warn" | "danger" | "accent". The ink: `neutral`, the default, is the role's own; `muted` and `accent` set the hierarchy of
|
|
151
|
+
the text; `positive`, `warn`, `danger` and `info` say what a run means (see `TextTone`).
|
|
152
|
+
|
|
153
|
+
### Lead
|
|
154
|
+
The supporting sentence under a `Display`. `p`, text-lg/7 normal, secondary.
|
|
155
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
156
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
157
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
158
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
159
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
160
|
+
|
|
161
|
+
### Mark
|
|
162
|
+
A highlighted run inside text: a `<mark>`, on the warn tint, such as the words a search matched in a result. It takes the surrounding size and weight. Mark the words that matter to what the reader is doing, not emphasis: that is `Text strong`.
|
|
163
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
164
|
+
|
|
165
|
+
### Types
|
|
166
|
+
- TextAlign: `"end" | "start" | "center"`. Where a run of text sits across its block.
|
|
167
|
+
- TextLines: `2 | 3 | 4 | 1`. How many lines a clamped run shows before it ends in an ellipsis.
|
|
168
|
+
- TextMinWidth: `"amount"`. A fixed width for a run of text: `amount` is a money figure, right-aligned, at a width that lines a column up.
|
|
169
|
+
- TextTone: `Tone | "accent" | "muted"`. The meaning of a run of inline text: the library's `Tone`, plus `muted` for a quieter line and `accent` for the theme's accent ink. `neutral` (the default) is the role's own ink. Colour alone does not say a meaning, so the words do too.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
## BottomSheet
|
|
2
|
+
|
|
3
|
+
Group: Feedback
|
|
4
|
+
|
|
5
|
+
When to use: A list or details over a full-screen view (a map, a canvas) that must stay usable behind it.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- Dialog (dialog.md): A question must be answered before going on: modal.
|
|
9
|
+
- Drawer (drawer.md): A record or a long form, modal, beside the page.
|
|
10
|
+
|
|
11
|
+
### The one right way
|
|
12
|
+
The heading and the count go in `header`: they stay put while the list scrolls under them.
|
|
13
|
+
```tsx
|
|
14
|
+
import { useState } from "react";
|
|
15
|
+
import { BottomSheet, ListRow, Pill, SectionHeading, Stack } from "@slashsuite/ui-react";
|
|
16
|
+
|
|
17
|
+
function Example() {
|
|
18
|
+
const [snap, setSnap] = useState(1);
|
|
19
|
+
return (
|
|
20
|
+
<BottomSheet
|
|
21
|
+
label="Shops"
|
|
22
|
+
snaps={[0.3, 0.75]}
|
|
23
|
+
snap={snap}
|
|
24
|
+
onSnapChange={setSnap}
|
|
25
|
+
header={
|
|
26
|
+
<>
|
|
27
|
+
<SectionHeading>Shops nearby</SectionHeading>
|
|
28
|
+
<Pill>12</Pill>
|
|
29
|
+
</>
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
<Stack divided>
|
|
33
|
+
{Array.from({ length: 12 }, (_, i) => (
|
|
34
|
+
<ListRow key={i} trailing={`${i + 2}00 m`}>
|
|
35
|
+
Shop {i + 1}
|
|
36
|
+
</ListRow>
|
|
37
|
+
))}
|
|
38
|
+
</Stack>
|
|
39
|
+
</BottomSheet>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Do
|
|
45
|
+
- Put it in a positioned parent (`relative`) that holds the full-screen view; it docks to that parent's bottom edge, full width on a phone and a panel at the start edge from `md` up.
|
|
46
|
+
- Hold `snap` in your state and set it in `onSnapChange`: `<BottomSheet snap={snap} onSnapChange={setSnap} …>`.
|
|
47
|
+
- List `snaps` lowest first, at least two: a number from 0 to 1 is a share of the parent's height, a `"120px"` string is pixels.
|
|
48
|
+
- The heading and a count go in `header`, never first in the body, so they stay put while the list scrolls.
|
|
49
|
+
- Pad the map camera by the height `onHeightChange` reports, so a pin is never hidden under the sheet. It reports on every move of a drag as well as at rest, so the camera follows the finger.
|
|
50
|
+
- Where a wide screen has room for the list beside the view, set `inlineFrom="md"` (or `"lg"`): from that width up it renders in the page's flow, in the column you give it, with no handle and no snaps. Below it, it is a sheet.
|
|
51
|
+
- A record or a form that stops the page is a `Drawer`; a question is a `Dialog`.
|
|
52
|
+
- Render the first snap first: the server render, and a page with no JavaScript, show a static panel at it.
|
|
53
|
+
|
|
54
|
+
### Don't
|
|
55
|
+
Do not put the heading first in the body: it scrolls away with the list.
|
|
56
|
+
```tsx
|
|
57
|
+
import { useState } from "react";
|
|
58
|
+
import { BottomSheet, ListRow, SectionHeading, Stack } from "@slashsuite/ui-react";
|
|
59
|
+
|
|
60
|
+
function Example() {
|
|
61
|
+
const [snap, setSnap] = useState(1);
|
|
62
|
+
return (
|
|
63
|
+
<BottomSheet label="Shops" snaps={[0.3, 0.75]} snap={snap} onSnapChange={setSnap}>
|
|
64
|
+
<SectionHeading>Shops nearby</SectionHeading>
|
|
65
|
+
<Stack divided>
|
|
66
|
+
{Array.from({ length: 12 }, (_, i) => (
|
|
67
|
+
<ListRow key={i} trailing={`${i + 2}00 m`}>
|
|
68
|
+
Shop {i + 1}
|
|
69
|
+
</ListRow>
|
|
70
|
+
))}
|
|
71
|
+
</Stack>
|
|
72
|
+
</BottomSheet>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Accessibility
|
|
78
|
+
- It is a region named by `label`.
|
|
79
|
+
- The handle is a button named by `label`, with `aria-expanded` and `aria-controls` on the body. Enter and Space step through the snaps, ArrowUp and ArrowDown move one snap up or down, and Escape inside the sheet returns it to the first.
|
|
80
|
+
- Nothing behind it is inert, and focus is never trapped or moved.
|
|
81
|
+
- The settle between snaps is switched off under `prefers-reduced-motion: reduce`.
|
|
82
|
+
- The body scrolls on its own and never scrolls the page.
|
|
83
|
+
|
|
84
|
+
### Props
|
|
85
|
+
### BottomSheet
|
|
86
|
+
A non-modal panel docked to the bottom edge of its positioned parent, over a full-screen view (a map, a canvas) that stays usable behind it. It rests at one of its `snaps`; the handle steps through them (Enter and Space; ArrowUp and ArrowDown one up or down), a drag of the handle moves it and releases to the nearest snap (a fling steps on), and Escape inside it returns it to the first. Nothing is made inert and focus never moves. Full width below `md`, a panel at the start edge from `md` up, or, with `inlineFrom`, plain content in the page from that width.
|
|
87
|
+
- children: ReactNode. The scrolling body.
|
|
88
|
+
- footer: ReactNode. Actions pinned under the scrolling body.
|
|
89
|
+
- header: ReactNode. The row under the handle: a heading and a count. It stays put while the body scrolls.
|
|
90
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
91
|
+
- inlineFrom: "md" | "lg". From this width up the sheet is no sheet: its header, body and footer sit in the page's flow
|
|
92
|
+
with no handle, no snaps and no height of its own, so the parent's grid places it (a list
|
|
93
|
+
column beside a map). Below it, it is the sheet. One tree, switched by CSS: nothing renders
|
|
94
|
+
twice, so `onHeightChange` still reports the snap's height: there the view has nothing under
|
|
95
|
+
the list to pad. Without it the sheet is a panel at the start edge from `md` up.
|
|
96
|
+
- label: string (required). The sheet's accessible name, as a region, and its handle button's.
|
|
97
|
+
- onHeightChange: (px: number) => void. Called with the sheet's height (px): on mount, on every change of `snap`, when the parent
|
|
98
|
+
resizes, and on every move of a drag, so a map camera padded by it follows the finger.
|
|
99
|
+
- onSnapChange: (snap: number) => void (required). Called with the snap to move to: from the handle, a drag, or Escape (back to 0). Set `snap` here.
|
|
100
|
+
- snap: number (required). The current snap, an index into `snaps`. Render the first (0) first and a page with no JavaScript shows it.
|
|
101
|
+
- snaps: readonly [BottomSheetSnap, BottomSheetSnap, ...BottomSheetSnap[]] (required). The heights it rests at, lowest first, at least two: a number from 0 to 1 is a share of the
|
|
102
|
+
parent's height, a `"120px"` string is pixels. A snap taller than the parent is held at its height.
|
|
103
|
+
|
|
104
|
+
### Types
|
|
105
|
+
- BottomSheetSnap: `number | `${number}px``. A snap height: a number from 0 to 1 is a share of the parent's height, a `"120px"` string is pixels.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
## Breadcrumbs
|
|
2
|
+
|
|
3
|
+
Group: Navigation
|
|
4
|
+
|
|
5
|
+
When to use: A page several levels deep that needs a way back up: org, project, build, snapshot.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- TableOfContents (table-of-contents.md): The reader moves between the sections of this page.
|
|
9
|
+
|
|
10
|
+
### The one right way
|
|
11
|
+
A parent crumb is `{ label, href }` and the last is plain text: the trail that leads back up, ending at the current page.
|
|
12
|
+
```tsx
|
|
13
|
+
import { Breadcrumbs } from "@slashsuite/ui-react";
|
|
14
|
+
|
|
15
|
+
<Breadcrumbs
|
|
16
|
+
items={[
|
|
17
|
+
{ label: "Projects", href: "#projects" },
|
|
18
|
+
{ label: "Launch film", href: "#launch-film" },
|
|
19
|
+
"Shots",
|
|
20
|
+
]}
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Do
|
|
25
|
+
- Give the trail in order, parents first. A crumb that links is `{ label, href }`, drawn through the app's `LinkProvider` for an in-app path; the last crumb is the current page.
|
|
26
|
+
- Breadcrumbs show a hierarchy. Peer sections are `Tabs` of links.
|
|
27
|
+
- A trail too long for its row wraps; a long parent truncates, and the current page is never cut.
|
|
28
|
+
- Put the trail in the `breadcrumbs` slot of a `PageHeader`.
|
|
29
|
+
|
|
30
|
+
### Don't
|
|
31
|
+
Parents given as plain text look like the trail but lead nowhere, so a reader cannot go back up.
|
|
32
|
+
```tsx
|
|
33
|
+
import { Breadcrumbs } from "@slashsuite/ui-react";
|
|
34
|
+
|
|
35
|
+
<Breadcrumbs items={["Projects", "Launch film", "Shots"]} />
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Siblings are not a hierarchy: switching between peer sections is `Tabs` of links.
|
|
40
|
+
```tsx
|
|
41
|
+
import { Breadcrumbs } from "@slashsuite/ui-react";
|
|
42
|
+
|
|
43
|
+
<Breadcrumbs
|
|
44
|
+
items={[
|
|
45
|
+
{ label: "Quotes", href: "#quotes" },
|
|
46
|
+
{ label: "Invoices", href: "#invoices" },
|
|
47
|
+
"Receipts",
|
|
48
|
+
]}
|
|
49
|
+
/>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Accessibility
|
|
53
|
+
- `<nav aria-label="Breadcrumb">` around an ordered list.
|
|
54
|
+
- The last crumb is the current page: given an `href` it is a link to this page with `aria-current="page"`, else its item carries it.
|
|
55
|
+
- The `/` separators are `aria-hidden`.
|
|
56
|
+
- A parent cut short shows its whole name in a tooltip on hover, a tap and keyboard focus: on its link, or on the crumb itself, which becomes a tab stop while it is cut. The tooltip is hidden from assistive tech, which reads the whole name already.
|
|
57
|
+
|
|
58
|
+
### Props
|
|
59
|
+
### Breadcrumbs
|
|
60
|
+
`org / project / build / snapshot`: the last crumb is the current page. A crumb is a node, or a `Crumb` object when it links. A trail too long for its row wraps onto the next line; a long parent truncates, showing its whole label in a tooltip on hover, focus and a tap, and the current page is never cut: its words wrap instead.
|
|
61
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
62
|
+
- items: (ReactNode | Crumb)[] (required). The trail, first to current: a node, or a `Crumb` (`{ label, href, external? }`) for one that links. The last is the current page; a `Crumb` there links to it with `aria-current="page"`.
|
|
63
|
+
- label: string (default Breadcrumb). The trail's accessible name, on its `<nav>`, for an app in another language.
|
|
64
|
+
|
|
65
|
+
### Types
|
|
66
|
+
- Crumb: `{ label: ReactNode; href: string; external?: boolean }`. A crumb that links: `href`, drawn by the app's router link through `LinkProvider` for an in-app path, else a plain `<a>`. `external` opens in a new tab. The last crumb is the current page: given an `href` it is a link to this page with `aria-current="page"`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
## BulletList
|
|
2
|
+
|
|
3
|
+
Group: Text
|
|
4
|
+
|
|
5
|
+
When to use: Items that read as a list of points: what changed, what to bring.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- Steps (steps.md): The items are a sequence the reader follows in order.
|
|
9
|
+
- Timeline (timeline.md): The items are a history, each with when it happened.
|
|
10
|
+
|
|
11
|
+
### The one right way
|
|
12
|
+
A list is a `BulletList` of `BulletItem`s: the list owns the discs, the indent and the gap.
|
|
13
|
+
```tsx
|
|
14
|
+
import { BulletItem, BulletList } from "@slashsuite/ui-react";
|
|
15
|
+
|
|
16
|
+
<BulletList>
|
|
17
|
+
<BulletItem>Moved the nightly build from cron to a queue.</BulletItem>
|
|
18
|
+
<BulletItem>Cut the cold start from nine seconds to two.</BulletItem>
|
|
19
|
+
<BulletItem>Wrote the runbook the team still uses.</BulletItem>
|
|
20
|
+
</BulletList>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Do
|
|
24
|
+
- Give a `BulletList` `BulletItem` children: each is an `<li>` in the body text.
|
|
25
|
+
- Steps a reader follows in order are a `BulletList ordered`: a numbered `<ol>` with the same indent and gap.
|
|
26
|
+
- Items that have a label and a value are a `KeyValueList`; a list of records is a `Table` or a `ListRow`.
|
|
27
|
+
|
|
28
|
+
### Don't
|
|
29
|
+
- Never type a hyphen into a paragraph to make a list.
|
|
30
|
+
|
|
31
|
+
Hyphens typed into paragraphs are not a list: no discs, no indent and no list for a screen reader.
|
|
32
|
+
```tsx
|
|
33
|
+
import { Stack, Text } from "@slashsuite/ui-react";
|
|
34
|
+
|
|
35
|
+
<Stack gap="xs">
|
|
36
|
+
<Text>- Moved the nightly build from cron to a queue.</Text>
|
|
37
|
+
<Text>- Cut the cold start from nine seconds to two.</Text>
|
|
38
|
+
<Text>- Wrote the runbook the team still uses.</Text>
|
|
39
|
+
</Stack>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Accessibility
|
|
43
|
+
- A `BulletList` renders a `<ul>` (an `<ol>` with `ordered`), so a screen reader announces a list and the number of items.
|
|
44
|
+
- `id`, `aria-*` and `data-*` go on the list, or on one item.
|
|
45
|
+
|
|
46
|
+
### Props
|
|
47
|
+
### BulletList
|
|
48
|
+
A bulleted `<ul>`: discs, indented, a small gap between items. `ordered` makes it a numbered `<ol>` (steps a reader follows in order), with the same indent and gap. Its children are `BulletItem`s.
|
|
49
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
50
|
+
- ordered: boolean (default false). A numbered `<ol>` instead of the bulleted `<ul>`, for items whose order matters.
|
|
51
|
+
|
|
52
|
+
### BulletItem
|
|
53
|
+
One item of a `BulletList`: an `<li>` in the body text's size and ink (the long-form scale inside a `Prose`). A long unbroken string (a URL, a token) breaks at the edge instead of overflowing.
|
|
54
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
## Button
|
|
2
|
+
|
|
3
|
+
Group: Actions
|
|
4
|
+
|
|
5
|
+
When to use: An action that changes something in place: save, cancel, delete, retry.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- Fieldset (fieldset.md): Toggles that filter a list: a `Fieldset` round a `ButtonGroup` of pressed `Button`s, one per facet.
|
|
9
|
+
- TextLink (text-link.md): The link is a destination in running text.
|
|
10
|
+
|
|
11
|
+
### The one right way
|
|
12
|
+
One primary action per view: the quieter variants carry the rest.
|
|
13
|
+
```tsx
|
|
14
|
+
import { Button, ButtonGroup } from "@slashsuite/ui-react";
|
|
15
|
+
|
|
16
|
+
<ButtonGroup>
|
|
17
|
+
<Button>Save</Button>
|
|
18
|
+
<Button variant="outline">Cancel</Button>
|
|
19
|
+
</ButtonGroup>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Do
|
|
23
|
+
- Put one primary Button in a view. The other actions use `variant="outline"`, `"ghost"` or `"link"`; `variant="dashed"` is the full-width "add another" row at the foot of a list.
|
|
24
|
+
- Group the actions in a `ButtonGroup`, so the row spaces and wraps the same everywhere; `end` pushes one item, such as a Back link, to the far side, and `label` names the group.
|
|
25
|
+
- Say why a button cannot be pressed with `disabledReason`; use `busy` while the work is in flight.
|
|
26
|
+
- Going to another page is a `Button` with `href`: a real `<a>` with the same look, drawn by the app's router link through `LinkProvider`.
|
|
27
|
+
- A destructive action is `tone="danger"`, an accept is `tone="positive"`; `size="sm"` is for a button inside a row or a card header, `size="lg"` for the one action of a hero or a sign-in form.
|
|
28
|
+
- `pressed` makes a toggle. `busy` disables it while the work is in flight, and `busy="Saving"` also shows that label: one prop, `busy={saving && "Saving"}`.
|
|
29
|
+
- An icon-only action is an `IconButton`, not a Button holding a glyph.
|
|
30
|
+
- `variant="link"` is only for a `<button>`, an action, that sits in running text. A destination in text is a `TextLink`, and one that must look like a button is a `Button` with `href`.
|
|
31
|
+
|
|
32
|
+
### Don't
|
|
33
|
+
Two primaries compete for the eye, and nobody can tell which action the view is about.
|
|
34
|
+
```tsx
|
|
35
|
+
import { Button, ButtonGroup } from "@slashsuite/ui-react";
|
|
36
|
+
|
|
37
|
+
<ButtonGroup>
|
|
38
|
+
<Button>Save</Button>
|
|
39
|
+
<Button>Save and close</Button>
|
|
40
|
+
</ButtonGroup>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
A bare `disabled` leaves the user guessing why nothing happens.
|
|
44
|
+
```tsx
|
|
45
|
+
import { Button } from "@slashsuite/ui-react";
|
|
46
|
+
|
|
47
|
+
<Button disabled>Save</Button>
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
A button that sets `location` loses middle-click, the status-bar URL and crawlability.
|
|
52
|
+
```tsx
|
|
53
|
+
import { Button } from "@slashsuite/ui-react";
|
|
54
|
+
|
|
55
|
+
<Button variant="outline" onClick={() => location.assign("#quotes")}>
|
|
56
|
+
Open quotes
|
|
57
|
+
</Button>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
A delete in the primary look reads as the safe, expected action; the tone is what warns.
|
|
61
|
+
```tsx
|
|
62
|
+
import { Button, ButtonGroup } from "@slashsuite/ui-react";
|
|
63
|
+
|
|
64
|
+
<ButtonGroup>
|
|
65
|
+
<Button>Delete quote</Button>
|
|
66
|
+
<Button variant="outline">Cancel</Button>
|
|
67
|
+
</ButtonGroup>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Buttons loose in a div have no gap, do not wrap as one row, and the group has no name.
|
|
71
|
+
```tsx
|
|
72
|
+
import { Button } from "@slashsuite/ui-react";
|
|
73
|
+
|
|
74
|
+
<div>
|
|
75
|
+
<Button>Save</Button>
|
|
76
|
+
<Button variant="outline">Preview</Button>
|
|
77
|
+
<Button href="#quotes" variant="ghost">
|
|
78
|
+
Back
|
|
79
|
+
</Button>
|
|
80
|
+
</div>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Accessibility
|
|
84
|
+
- A Button is a native `<button>` and defaults to `type="button"`, so it never submits a form by accident.
|
|
85
|
+
- `disabledReason` blocks the button with `aria-disabled` and keeps it in the tab order, so a keyboard reaches it; a click, Enter and Space do nothing, and the reason shows as a tooltip on hover, keyboard focus and a tap, read out as the button's description. In a browser without CSS anchor positioning the reason is its native `title`.
|
|
86
|
+
- `busy` sets `aria-busy` and disables the button until the work is done.
|
|
87
|
+
- Every Button has a focus ring from the component, so the keyboard focus is always visible.
|
|
88
|
+
- The `count` chip is part of the button's name: `Splits, 3` (a `count` of 0 is shown as `Splits, 0`). Pass `aria-expanded` on a button that opens something, so a screen reader hears whether it is open.
|
|
89
|
+
|
|
90
|
+
### Props
|
|
91
|
+
### Button
|
|
92
|
+
A button in the primary, outline, ghost, link or dashed style (the link has no box: text with an underline on hover, for an in-line action; `dashed` is the full-width "add" row, a dashed outline with muted text that fills its container). `icon` puts an `Icon` before the label. `size="sm"` is compact and `size="lg"` larger, `size={{ base: "md", md: "lg" }}` changes at 48rem, and with no `size` it takes its container's; `tone="positive"` is green and `tone="danger"` is red; `pressed` makes it a toggle: neutral when off, the tone's fill when on. `count` puts a small number chip after the label; the chip is part of the name, and a button that opens something also takes `aria-expanded`. Defaults to `type="button"`. `disabledReason` and `busy` are the two disabled states that say more than a plain `disabled`, which keeps its half-opacity look; `busy="Saving"` also swaps the label. `ref` reaches the `<button>` or the `<a>`. `href` makes it a link instead, with the same look (the app's router link through `LinkProvider` for an in-app path, else a plain `<a>`; `external` opens a new tab).
|
|
93
|
+
- busy: string | boolean. The work is in flight: disabled, `aria-busy`, keeps its colour. Wins over `disabledReason`. A
|
|
94
|
+
string is also the label while busy, in place of the children: `busy={saving && "Saving"}`.
|
|
95
|
+
- count: number. A small number in a chip after the label: how many are behind the button (the splits a row
|
|
96
|
+
has, the comments on a thread). It is part of the button's name, "Splits, 3", and `0` is
|
|
97
|
+
shown. For a button that opens something, also pass `aria-expanded`.
|
|
98
|
+
|
|
99
|
+
Pass `aria-controls` for what it opens too; the caller owns that state.
|
|
100
|
+
- disabled: boolean (native). Disables the button; say why with `disabledReason` instead where there is a reason.
|
|
101
|
+
- disabledReason: string. Why the button cannot be pressed: greys it flat and blocks it (`aria-disabled`, its click,
|
|
102
|
+
Enter and Space do nothing) while it stays in the tab order, and shows the reason as its
|
|
103
|
+
tooltip on hover, keyboard focus and a tap, read out as its description.
|
|
104
|
+
- external: boolean. Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
|
|
105
|
+
- href: string. Makes the button a link to this URL; an in-app path goes through the app's `LinkProvider`.
|
|
106
|
+
- icon: "page" | "grid" | "search" | "alert" | "table" | "type" | "diff" | "baseline" | "review" | "ci" | "self-host" | "privacy" | "capture" | "branch" | "theme" | "speed" | "chevron-right" | "chevron-down" | "close" | "external-link" | "settings" | "bell" | "check" | "plus" | "minus" | "more" | "window" | "card" | "pointer" | "field" | "compass" | "briefcase" | "cart" | "pause" | "play". An icon from the `Icon` set before the label, decorative, at the button's size.
|
|
107
|
+
- pressed: boolean. A toggle: sets `aria-pressed`. On `outline` and `ghost`, `false` draws the neutral off look
|
|
108
|
+
and `true` the tone's primary fill, so a row of filter chips shows the selected one plainly.
|
|
109
|
+
Left out, the button is not a toggle, has no `aria-pressed` and keeps its variant's look.
|
|
110
|
+
- ref: ((instance: HTMLButtonElement | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<HTMLButtonElement | null> | ((instance: HTMLAnchorElement | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<...> | null. Reaches the `<button>`, or the `<a>` of a link button, to focus it or measure it.
|
|
111
|
+
- size: Size | ResponsiveSize (default md). `sm` is compact, for table rows and toolbars; `lg` is larger, for a hero call to action. Left
|
|
112
|
+
out, a Button takes the size of the `Card`, `ListRow` or `Table` it sits in, else `md`.
|
|
113
|
+
`{ base: "md", md: "lg" }` changes size at the `md` breakpoint (48rem), in CSS: `md` on a phone,
|
|
114
|
+
`lg` from 48rem up.
|
|
115
|
+
|
|
116
|
+
The first load paints the right size. Give every control in the row the same value, so it stays
|
|
117
|
+
aligned.
|
|
118
|
+
- tone: "neutral" | "positive" | "danger" (default neutral). `positive` is green, for accept and approve; `danger` is red, for delete and clear. Not for
|
|
119
|
+
`dashed`, which has the one look.
|
|
120
|
+
- type: string (native). `"button"` by default; `"submit"` submits the form the button is in.
|
|
121
|
+
- variant: "link" | "primary" | "outline" | "ghost" | "dashed" (default primary). `primary` is filled, for the one main action; `outline` and `ghost` are quieter; `link` is
|
|
122
|
+
text with an underline on hover; `dashed` is an "add another" row that fills its container.
|
|
123
|
+
|
|
124
|
+
### ButtonGroup
|
|
125
|
+
A wrapping row of buttons with one optional item pushed to the far end (a Back link, say). On a narrow viewport the row wraps and `end` stays at the end of the last line. `label` makes it a named `role="group"`. Directly in a `Card` footer it spans the footer, so `end` reaches the far edge.
|
|
126
|
+
- end: ReactNode. One item, pushed to the end of the row.
|
|
127
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
128
|
+
- label: string. The accessible name of the group: sets `role="group"` and `aria-label`.
|
|
129
|
+
|
|
130
|
+
### Types
|
|
131
|
+
- ButtonSize: `"sm" | "md" | "lg"`. A Button's height and text, on the library's one `Size` scale.
|
|
132
|
+
- ButtonTone: `"neutral" | "positive" | "danger"`. A Button's tones: `neutral` (the accent fill, the default), `positive` and `danger`.
|
|
133
|
+
- ButtonVariant: `"primary" | "outline" | "ghost" | "link" | "dashed"`. A Button's look: `primary` the one main action, `outline` and `ghost` the others, `link` text in running text, `dashed` the add-another row.
|
|
134
|
+
- ResponsiveSize: `{ base: Size; md: Size }`. A size that changes with the screen: `base` at every width, `md` from Tailwind's `md` breakpoint (48rem) up. Done in CSS, so a server-rendered page paints the right size on its first load.
|
|
135
|
+
- Size: `"sm" | "md" | "lg"`. The one size scale of the library: `sm`, `md` and `lg`, with `md` the default. This is the one list of where it goes further and where the default is not `md`; the README and the docs point here rather than count them again. Past `sm`, `md` and `lg`, only where there is a real use, and no scale skips `md`: - `Avatar` and `AvatarStack` `size`: also `xs`, `xl`, `2xl` and `3xl`. - The gap scale (`Stack`, `Section` and `ProseLayout` `gap`): also `xs` and `xl`. - `Cluster` and `ScrollStrip` `gap`: `xs`, `sm` and `md`, the first steps of the gap scale. - `Icon` `size`: also `feature`, the mark of a feature card. - `Dialog` `width`: also `full`, the whole screen. `ChatThread` `height`: also `fill`, its parent's. - `ImageWidth` (`Image`, `RegionFrame` and `MediaTile` `width`): also `xl` and `full`, the parent's width; `sm`, `md`, `lg` and `xl` are 96, 160, 256 and 448px. Defaults that are not `md`: - `Table` `size` is `sm`, its row padding, and the buttons and pills in a table take that size; a field keeps `md`. - `Cluster` and `ScrollStrip` `gap` are `sm`: the items of a row sit closer than the blocks of a column. - `Stack` and `Section` `gap` are `xs` inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`. - `Image` and `RegionFrame` `width` are `full`: a picture fills its column unless it is a thumbnail. `MediaTile` `width` is `md`, one tile of a grid of them. - A `Pill`, `Button` or `IconButton` with no `size` takes the size of the `Card`, `ListRow` or `Table` it sits in; an `EmptyState` takes its slot's. A responsive size, `{ base, md }` (`ResponsiveSize`), changes at Tailwind's `md` breakpoint (48rem) in CSS, with no script: `Button`, `IconButton`, `SegmentedControl` and `Icon` take it, and so do the text fields, `Input`, `Select`, `Textarea`, `DateField`, `DateTimeField` and `DateRangePicker`, so a field and the button beside it stay aligned at both widths. With no `size` at all, because they take the size of the text or the control they sit on: `Callout`, `CopyButton`, `Kbd`, `Badge` and `Breadcrumbs`.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
## CallToAction
|
|
2
|
+
|
|
3
|
+
Group: Content
|
|
4
|
+
|
|
5
|
+
When to use: The last block of a landing or product page, before the footer: the one place the page asks the reader to act.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
The page's closing ask: one title, one sentence, a primary action and a quieter one.
|
|
9
|
+
```tsx
|
|
10
|
+
import { Button, CallToAction } from "@slashsuite/ui-react";
|
|
11
|
+
|
|
12
|
+
<CallToAction
|
|
13
|
+
overline="Ready when you are"
|
|
14
|
+
title="Start your first review today"
|
|
15
|
+
description="Free for open source, and a minute to set up."
|
|
16
|
+
actions={
|
|
17
|
+
<>
|
|
18
|
+
<Button href="#start">Get started</Button>
|
|
19
|
+
<Button href="#pricing" variant="outline">
|
|
20
|
+
See pricing
|
|
21
|
+
</Button>
|
|
22
|
+
</>
|
|
23
|
+
}
|
|
24
|
+
/>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Do
|
|
28
|
+
- `title` is the ask, one line; `description` one sentence under it; `actions` a primary `Button` and, if it has one, an `outline` or `ghost` one.
|
|
29
|
+
- One per page, as the last block of the page's `Stack`, before the `SiteFooter`. Its surface, edge and text are the theme's, held to AA in every theme.
|
|
30
|
+
|
|
31
|
+
### Don't
|
|
32
|
+
- Do not make the closing ask from a `Card` and a `Button`: it reads as one more feature card, not the page's ask.
|
|
33
|
+
- Do not put one after every section: a section's own actions go in its `Section`'s `actions`.
|
|
34
|
+
|
|
35
|
+
A Card with buttons in it reads as one more feature, not the page's closing ask.
|
|
36
|
+
```tsx
|
|
37
|
+
import { Button, Card, Cluster } from "@slashsuite/ui-react";
|
|
38
|
+
|
|
39
|
+
<Card title="Start your first review today">
|
|
40
|
+
<Cluster>
|
|
41
|
+
<Button href="#start">Get started</Button>
|
|
42
|
+
</Cluster>
|
|
43
|
+
</Card>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Accessibility
|
|
47
|
+
- It is a `<section>` named by its title (`aria-labelledby`), so it is a region.
|
|
48
|
+
- Its title is an `h2` on the page, one below the heading that holds it; `level` sets it by hand.
|
|
49
|
+
- `id`, `data-*` and `aria-*` go on the band.
|
|
50
|
+
|
|
51
|
+
### Props
|
|
52
|
+
### CallToAction
|
|
53
|
+
The closing ask of a landing page: a rounded band on the subtle surface with a hairline edge, its overline, title, one sentence and one or two actions centred in it. It is a `<section>` named by its title. One per page, as the last block before the footer; a section's own actions stay in its `Section`.
|
|
54
|
+
- actions: ReactNode (required). One or two actions: a primary `Button` and, if it has one, an `outline` or `ghost` one.
|
|
55
|
+
- description: ReactNode. One sentence under the title, as a `Lead`.
|
|
56
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
57
|
+
- level: 2 | 3 | 4 | 5 | 6 (default one below the heading that holds the band: 2 on the page). The title's heading level, 2 to 6. It does not change how the title looks.
|
|
58
|
+
- overline: ReactNode. A small label above the title, set in the monospace face.
|
|
59
|
+
- title: ReactNode (required). The ask, one line: "Start your first review today". Its heading names the band.
|