@slashsuite/ui-react 0.12.1 → 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 +89 -44
- package/agent-docs/components/app-shell.md +9 -6
- package/agent-docs/components/article-layout.md +140 -0
- package/agent-docs/components/audio.md +42 -0
- package/agent-docs/components/badge.md +2 -1
- package/agent-docs/components/body-text.md +26 -15
- package/agent-docs/components/bottom-sheet.md +27 -17
- package/agent-docs/components/breadcrumbs.md +10 -6
- package/agent-docs/components/button.md +2 -2
- package/agent-docs/components/call-to-action.md +59 -0
- package/agent-docs/components/callout.md +4 -3
- package/agent-docs/components/card-grid.md +15 -7
- package/agent-docs/components/card.md +33 -18
- package/agent-docs/components/cart-button.md +63 -0
- package/agent-docs/components/chat-composer.md +4 -3
- package/agent-docs/components/checkbox.md +11 -5
- package/agent-docs/components/cluster.md +10 -8
- package/agent-docs/components/code-example.md +2 -2
- package/agent-docs/components/code.md +7 -5
- package/agent-docs/components/colour-scheme-toggle.md +12 -6
- 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 +2 -1
- package/agent-docs/components/copy-button.md +7 -5
- package/agent-docs/components/copy-line.md +6 -5
- package/agent-docs/components/date-field.md +14 -11
- package/agent-docs/components/date-range-picker.md +16 -9
- package/agent-docs/components/date-time-field.md +73 -0
- package/agent-docs/components/dialog.md +22 -68
- package/agent-docs/components/disclosure.md +4 -0
- package/agent-docs/components/docs-layout.md +10 -6
- package/agent-docs/components/drawer.md +13 -4
- package/agent-docs/components/embed-frame.md +48 -0
- package/agent-docs/components/empty-state.md +4 -1
- package/agent-docs/components/field-dialog.md +6 -5
- package/agent-docs/components/field.md +10 -7
- package/agent-docs/components/fieldset.md +4 -4
- package/agent-docs/components/flow-diagram.md +87 -0
- package/agent-docs/components/form-layout.md +4 -1
- package/agent-docs/components/form-row.md +7 -7
- package/agent-docs/components/full-bleed-layout.md +0 -2
- package/agent-docs/components/headings.md +13 -7
- package/agent-docs/components/hero.md +11 -2
- package/agent-docs/components/icon-button.md +1 -3
- package/agent-docs/components/icon.md +6 -13
- package/agent-docs/components/image.md +24 -14
- package/agent-docs/components/input.md +8 -7
- package/agent-docs/components/key-value-list.md +4 -1
- package/agent-docs/components/lightbox.md +1 -1
- package/agent-docs/components/list-layout.md +5 -7
- package/agent-docs/components/list-row.md +37 -34
- package/agent-docs/components/loading.md +2 -2
- package/agent-docs/components/markdown.md +13 -13
- package/agent-docs/components/media-tile.md +8 -4
- package/agent-docs/components/menu.md +19 -12
- package/agent-docs/components/meta-list.md +2 -2
- package/agent-docs/components/morph.md +11 -5
- package/agent-docs/components/navigation-progress.md +2 -2
- package/agent-docs/components/number-field.md +75 -0
- package/agent-docs/components/outline-region.md +19 -8
- package/agent-docs/components/page-fade.md +2 -1
- package/agent-docs/components/pill.md +7 -6
- 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/promo-banner.md +46 -0
- package/agent-docs/components/prose-layout.md +1 -1
- package/agent-docs/components/radio-group.md +9 -6
- package/agent-docs/components/scroll-strip.md +3 -3
- package/agent-docs/components/segmented-control.md +4 -2
- package/agent-docs/components/select.md +8 -3
- package/agent-docs/components/show.md +2 -2
- package/agent-docs/components/side-column.md +13 -9
- package/agent-docs/components/sidebar-layout.md +1 -1
- package/agent-docs/components/site-footer.md +4 -4
- package/agent-docs/components/site-search.md +21 -9
- package/agent-docs/components/slider.md +59 -0
- package/agent-docs/components/sortable-list.md +15 -10
- package/agent-docs/components/stack.md +3 -3
- package/agent-docs/components/stacked-bar.md +7 -4
- package/agent-docs/components/state-machine.md +95 -0
- package/agent-docs/components/status-pages.md +13 -6
- package/agent-docs/components/stepper.md +54 -0
- package/agent-docs/components/switch.md +4 -4
- package/agent-docs/components/table-of-contents.md +78 -0
- package/agent-docs/components/table.md +35 -24
- package/agent-docs/components/tabs.md +24 -26
- package/agent-docs/components/text-link.md +12 -7
- package/agent-docs/components/textarea.md +4 -2
- package/agent-docs/components/toast.md +19 -14
- package/agent-docs/components/video.md +7 -2
- package/agent-docs/llms.txt +22 -3
- 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 +3 -2
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
## ArticleLayout
|
|
2
|
+
|
|
3
|
+
Group: Page layouts
|
|
4
|
+
|
|
5
|
+
When to use: A blog post, a news item or a recipe: writing with an author and a date.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
A blog post is an `ArticleLayout`: the byline, the picture and the related posts each have their place.
|
|
9
|
+
```tsx
|
|
10
|
+
import { ArticleLayout, Card, Image, SectionHeading, Text } from "@slashsuite/ui-react";
|
|
11
|
+
|
|
12
|
+
<ArticleLayout
|
|
13
|
+
title="Brewing a pale ale at home"
|
|
14
|
+
description="Everything you need for a first brew, and what to do on the day."
|
|
15
|
+
author="Sam Mokoena"
|
|
16
|
+
date="12 November 2026"
|
|
17
|
+
dateTime="2026-11-12"
|
|
18
|
+
readingTime="6 min read"
|
|
19
|
+
image={
|
|
20
|
+
<Image
|
|
21
|
+
src={sampleScenes[0]?.src}
|
|
22
|
+
alt="A brew kettle on the stove"
|
|
23
|
+
aspect="16:9"
|
|
24
|
+
width="full"
|
|
25
|
+
/>
|
|
26
|
+
}
|
|
27
|
+
related={["Stout in a weekend", "Dry hopping, step by step", "Your first lager"].map(
|
|
28
|
+
(title) => (
|
|
29
|
+
<Card key={title} title={title}>
|
|
30
|
+
<Text>A recipe and the kit that brews it.</Text>
|
|
31
|
+
</Card>
|
|
32
|
+
),
|
|
33
|
+
)}
|
|
34
|
+
>
|
|
35
|
+
<SectionHeading>What you need</SectionHeading>
|
|
36
|
+
<Text>A 20 litre kettle, a fermenter with an airlock, and the pale ale kit.</Text>
|
|
37
|
+
<SectionHeading>On the day</SectionHeading>
|
|
38
|
+
<Text>Heat the water to 67°C, stir in the grain and hold it there for an hour.</Text>
|
|
39
|
+
</ArticleLayout>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Full page
|
|
43
|
+
A whole blog post: the shell with its brand and nav, then the article and its related posts.
|
|
44
|
+
```tsx
|
|
45
|
+
import {
|
|
46
|
+
AppShell,
|
|
47
|
+
ArticleLayout,
|
|
48
|
+
Card,
|
|
49
|
+
Image,
|
|
50
|
+
SectionHeading,
|
|
51
|
+
Tabs,
|
|
52
|
+
Text,
|
|
53
|
+
} from "@slashsuite/ui-react";
|
|
54
|
+
|
|
55
|
+
<AppShell
|
|
56
|
+
brand={<a href="#">Hack Cove</a>}
|
|
57
|
+
nav={
|
|
58
|
+
<Tabs
|
|
59
|
+
label="Main"
|
|
60
|
+
items={[
|
|
61
|
+
{ label: "Shop", href: "#shop" },
|
|
62
|
+
{ label: "Blog", href: "#blog", selected: true },
|
|
63
|
+
]}
|
|
64
|
+
/>
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
<ArticleLayout
|
|
68
|
+
title="Brewing a pale ale at home"
|
|
69
|
+
description="Everything you need for a first brew, and what to do on the day."
|
|
70
|
+
author="Sam Mokoena"
|
|
71
|
+
date="12 November 2026"
|
|
72
|
+
dateTime="2026-11-12"
|
|
73
|
+
readingTime="6 min read"
|
|
74
|
+
image={
|
|
75
|
+
<Image
|
|
76
|
+
src={sampleScenes[0]?.src}
|
|
77
|
+
alt="A brew kettle on the stove"
|
|
78
|
+
aspect="16:9"
|
|
79
|
+
width="full"
|
|
80
|
+
/>
|
|
81
|
+
}
|
|
82
|
+
related={["Stout in a weekend", "Dry hopping, step by step", "Your first lager"].map(
|
|
83
|
+
(title) => (
|
|
84
|
+
<Card key={title} title={title}>
|
|
85
|
+
<Text>A recipe and the kit that brews it.</Text>
|
|
86
|
+
</Card>
|
|
87
|
+
),
|
|
88
|
+
)}
|
|
89
|
+
>
|
|
90
|
+
<SectionHeading>What you need</SectionHeading>
|
|
91
|
+
<Text>A 20 litre kettle, a fermenter with an airlock, and the pale ale kit.</Text>
|
|
92
|
+
<SectionHeading>On the day</SectionHeading>
|
|
93
|
+
<Text>Heat the water to 67°C, stir in the grain and hold it there for an hour.</Text>
|
|
94
|
+
</ArticleLayout>
|
|
95
|
+
</AppShell>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Do
|
|
99
|
+
- The body is the `children`: `Prose`, or `SectionHeading`s and `Text` paragraphs, spaced `md` apart.
|
|
100
|
+
- `author`, `date` and `readingTime` make the byline under the lede. Pass `dateTime` (`2026-11-12`) with `date` so it is a `<time>`; the app works out the reading time.
|
|
101
|
+
- `image` is the lead picture: an `Image` at `width="full"`.
|
|
102
|
+
- `related` is a `.map` of `Card`s or `ProductTile`s, three to a row under "More like this"; `relatedTitle` names it another way.
|
|
103
|
+
- A page of text with no author or date (privacy, terms, help) is a `ProseLayout`.
|
|
104
|
+
|
|
105
|
+
### Don't
|
|
106
|
+
A `ProseLayout` with a hand-made byline and no related posts: the date is a loose caption, nobody wrote it, and the reader is left at a dead end.
|
|
107
|
+
```tsx
|
|
108
|
+
import { Caption, ProseLayout, SectionHeading, Text } from "@slashsuite/ui-react";
|
|
109
|
+
|
|
110
|
+
<ProseLayout title="Brewing a pale ale at home">
|
|
111
|
+
<Caption>12 November 2026</Caption>
|
|
112
|
+
<SectionHeading>What you need</SectionHeading>
|
|
113
|
+
<Text>A 20 litre kettle, a fermenter with an airlock, and the pale ale kit.</Text>
|
|
114
|
+
</ProseLayout>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Accessibility
|
|
118
|
+
- The article is an `<article>` and its title the page's `h1`.
|
|
119
|
+
- The related posts are a `section` named by their heading, and a list of cards.
|
|
120
|
+
- `data-*` and `aria-*` go on the page's wrapper.
|
|
121
|
+
|
|
122
|
+
### Props
|
|
123
|
+
### ArticleLayout
|
|
124
|
+
A blog article: the title (the page's `h1`) and its lede, a byline of the author, the date and the reading time in muted text, the lead picture, the body, and a "More like this" row of cards at the foot. The article sits in the reading column (`max-w-3xl`) at the Container's start edge, and the related cards take the Container's whole width under it. The date is a `<time>` when `dateTime` says which day it is. Every part but the title is optional. While `loading` it owns the wait and passes it to everything inside, the header too.
|
|
125
|
+
- author: ReactNode. Who wrote it: a name, or a `TextLink` to their page.
|
|
126
|
+
- breadcrumbs: ReactNode. A `Breadcrumbs` above the title.
|
|
127
|
+
- children: ReactNode. The article itself: `Prose`, or `SectionHeading`s and `Text` paragraphs, spaced `md` apart.
|
|
128
|
+
- date: string. When it was published, as the reader reads it: "12 November 2026".
|
|
129
|
+
- dateTime: string. The same day as an ISO date (`2026-11-12`), for the `<time>` a machine reads.
|
|
130
|
+
- description: ReactNode. The lede under the title: a `Lead`, so it outranks the body text after it.
|
|
131
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
132
|
+
- image: ReactNode. The lead picture under the byline: an `Image` at `width="full"`.
|
|
133
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
134
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
135
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
136
|
+
- readingTime: string. How long it takes to read, worked out by the app: "6 min read".
|
|
137
|
+
- related: ReactNode. The cards at the foot under "More like this", three to a row from `lg`: a `.map` of `Card`s or
|
|
138
|
+
`ProductTile`s. Left out, there is no foot.
|
|
139
|
+
- relatedTitle: string (default More like this). The heading over `related`, for an app in another language or another word ("Recipes for this kit").
|
|
140
|
+
- title: ReactNode (required). The page's `h1`.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
## Audio
|
|
2
|
+
|
|
3
|
+
Group: Content
|
|
4
|
+
|
|
5
|
+
When to use: Playing a voice note, a recording or a clip that your app serves.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- Video (video.md): The recording has pictures: the video player.
|
|
9
|
+
|
|
10
|
+
### The one right way
|
|
11
|
+
`label` names the player, since a voice note has no visible title; `children` is the text for a browser that cannot play it.
|
|
12
|
+
```tsx
|
|
13
|
+
import { Audio } from "@slashsuite/ui-react";
|
|
14
|
+
|
|
15
|
+
<Audio src="/media/voice-note.ogg" label="Voice note from Anna, 0:14">
|
|
16
|
+
Your browser cannot play audio.
|
|
17
|
+
</Audio>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Do
|
|
21
|
+
- `src` is your own audio file. It loads only the metadata until it is played, and lazily where the browser can.
|
|
22
|
+
- `label` names the player, as "Voice note from Anna, 0:14": a clip has no visible title, so say what it is and how long.
|
|
23
|
+
- The player is full width up to 20rem, one size everywhere: set it in a `Stack` or a `Card`.
|
|
24
|
+
- The children are the text for a browser that cannot play the file.
|
|
25
|
+
|
|
26
|
+
### Don't
|
|
27
|
+
A bare `<audio>` has no name, loads the whole file up front and takes whatever size the browser picks.
|
|
28
|
+
```tsx
|
|
29
|
+
<audio src="/media/voice-note.ogg" controls />
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Accessibility
|
|
34
|
+
- A native `<audio controls>` named by `label`: play, seek and volume work by keyboard through the browser's controls.
|
|
35
|
+
- Speech in a clip that matters needs a transcript beside it, in the text of the page.
|
|
36
|
+
|
|
37
|
+
### Props
|
|
38
|
+
### Audio
|
|
39
|
+
An `<audio>` with the browser's own controls, at one fixed size: 20rem wide, narrower only when its column is. It loads metadata only, and lazily where the browser can, so the page does not pull the file until it is played. A voice note or a clip has no visible title, so `label` names the player. `src` is the app's own file; `children` is the fallback for a browser that cannot play it.
|
|
40
|
+
- children: ReactNode. The text for a browser that cannot play it.
|
|
41
|
+
- label: string (required). Names the player for a screen reader, as "Voice note from Anna": audio has no visible title.
|
|
42
|
+
- src: string (required). The audio file, the app's own.
|
|
@@ -49,10 +49,11 @@ import { Cluster, Pill } from "@slashsuite/ui-react";
|
|
|
49
49
|
- A Badge is a `<span>` with the number as its text.
|
|
50
50
|
- Inside an `IconButton`, the Badge is `aria-hidden` and the count is part of the button's `aria-label` and `title` ("Alerts, 3"), so it is announced once.
|
|
51
51
|
- `corner` pins the Badge to its nearest positioned parent; `IconButton` already provides one.
|
|
52
|
+
- It is sized in `rem` with a minimum height, so it grows with the reader's text size and the number never spills out.
|
|
52
53
|
|
|
53
54
|
### Props
|
|
54
55
|
### Badge
|
|
55
|
-
A small red count, 10px, for sitting on an icon. An icon with a count is an `IconButton` with its `count`, which pins the Badge to its corner and puts the count in the button's name. A count above 99 reads `99+`. While `loading` it is a bone of its size: a count is a number, so 0 is a value and not a gap.
|
|
56
|
+
A small red count, 10px, for sitting on an icon. Its size is in rem and its height grows with its line, so it scales with the reader's text size instead of clipping. An icon with a count is an `IconButton` with its `count`, which pins the Badge to its corner and puts the count in the button's name. A count above 99 reads `99+`. While `loading` it is a bone of its size: a count is a number, so 0 is a value and not a gap.
|
|
56
57
|
- corner: boolean (default false). Pin it to the top corner at the end edge of its `relative` parent, over the icon.
|
|
57
58
|
- count: number (required). The number shown; above 99 it reads `99+`.
|
|
58
59
|
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Group: Text
|
|
4
4
|
|
|
5
|
-
When to use: Every run of text that is not a heading: a paragraph, a supporting line, a note, a label
|
|
5
|
+
When to use: Every run of text that is not a heading: a paragraph, a supporting line, a note, a label.
|
|
6
6
|
|
|
7
7
|
### The one right way
|
|
8
8
|
Body copy is `Text`, with `Text strong` for emphasis inside it and `Caption` for the fine print.
|
|
@@ -23,7 +23,7 @@ import { Caption, Stack, Text } from "@slashsuite/ui-react";
|
|
|
23
23
|
|
|
24
24
|
### Do
|
|
25
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. Use `Caption` for fine print and metadata, `Caption as="span"` inside a row.
|
|
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
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
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
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.
|
|
@@ -66,12 +66,12 @@ import { Overline, Stack, Text } from "@slashsuite/ui-react";
|
|
|
66
66
|
</Stack>
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
A
|
|
69
|
+
A muted `Text` looks like the empty line but is only words: it is not an empty state. Use `EmptyState size="sm"`.
|
|
70
70
|
```tsx
|
|
71
|
-
import { Card } from "@slashsuite/ui-react";
|
|
71
|
+
import { Card, Text } from "@slashsuite/ui-react";
|
|
72
72
|
|
|
73
73
|
<Card title="Done" count={0}>
|
|
74
|
-
<
|
|
74
|
+
<Text tone="muted">Nothing finished yet.</Text>
|
|
75
75
|
</Card>
|
|
76
76
|
```
|
|
77
77
|
|
|
@@ -86,18 +86,20 @@ import { Button, Stack, Text } from "@slashsuite/ui-react";
|
|
|
86
86
|
```
|
|
87
87
|
|
|
88
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, an `li
|
|
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
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
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
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.
|
|
93
94
|
|
|
94
95
|
### Props
|
|
95
96
|
### Text
|
|
96
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`.
|
|
97
98
|
- align: "center" | "end" | "start". Set the text at `start`, `center` or `end` of its block. The run becomes block-level, so the
|
|
98
99
|
alignment has a box to act on (a table header cell, a right-hand column).
|
|
99
|
-
- as: ElementType. The element to render
|
|
100
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
100
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`.
|
|
101
103
|
- italic: boolean. Italic: a muted hint or a caption.
|
|
102
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
|
|
103
105
|
container ends, `2` to `4` wrap and stop. With plain-text content the full text becomes the
|
|
@@ -110,15 +112,17 @@ Left out, the part takes the nearest loading layout's or part's; `false` opts it
|
|
|
110
112
|
- numeric: boolean. Tabular figures, so a column of amounts lines up.
|
|
111
113
|
- preserveNewlines: boolean. Keep the line breaks in the text (a user-typed note); runs of spaces still collapse.
|
|
112
114
|
- strong: boolean. Emphasis: font-medium in the primary ink (`tone` still wins).
|
|
113
|
-
-
|
|
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
|
|
114
117
|
the text; `positive`, `warn`, `danger` and `info` say what a run means (see `TextTone`).
|
|
115
118
|
|
|
116
119
|
### Caption
|
|
117
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.
|
|
118
121
|
- align: "center" | "end" | "start". Set the text at `start`, `center` or `end` of its block. The run becomes block-level, so the
|
|
119
122
|
alignment has a box to act on (a table header cell, a right-hand column).
|
|
120
|
-
- as: ElementType. The element to render
|
|
123
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
121
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`.
|
|
122
126
|
- italic: boolean. Italic: a muted hint or a caption.
|
|
123
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
|
|
124
128
|
container ends, `2` to `4` wrap and stop. With plain-text content the full text becomes the
|
|
@@ -128,31 +132,38 @@ Left out, the part takes the nearest loading layout's or part's; `false` opts it
|
|
|
128
132
|
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
129
133
|
- mono: boolean. The monospace face, for an id, a path or a command.
|
|
130
134
|
- numeric: boolean. Tabular figures, so a column of amounts lines up.
|
|
131
|
-
-
|
|
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
|
|
132
137
|
the text; `positive`, `warn`, `danger` and `info` say what a run means (see `TextTone`).
|
|
133
138
|
|
|
134
139
|
### Overline
|
|
135
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`.
|
|
136
141
|
- align: "center" | "end" | "start". Set the text at `start`, `center` or `end` of its block. The run becomes block-level, so the
|
|
137
142
|
alignment has a box to act on (a table header cell, a right-hand column).
|
|
138
|
-
- as: ElementType. The element to render
|
|
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`.
|
|
139
145
|
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
140
146
|
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
141
147
|
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
142
148
|
- mono: boolean. The monospace face, for an id, a path or a command.
|
|
143
149
|
- numeric: boolean. Tabular figures, so a column of amounts lines up.
|
|
144
|
-
- tone: "neutral" | "info" | "positive" | "warn" | "danger" | "
|
|
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
|
|
145
151
|
the text; `positive`, `warn`, `danger` and `info` say what a run means (see `TextTone`).
|
|
146
152
|
|
|
147
153
|
### Lead
|
|
148
154
|
The supporting sentence under a `Display`. `p`, text-lg/7 normal, secondary.
|
|
149
|
-
- as: ElementType. The element to render
|
|
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`.
|
|
150
157
|
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
151
158
|
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
152
159
|
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
153
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
|
+
|
|
154
165
|
### Types
|
|
155
|
-
- TextAlign: `"
|
|
156
|
-
- TextLines: `
|
|
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.
|
|
157
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.
|
|
158
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.
|
|
@@ -12,7 +12,7 @@ When to use: A list or details over a full-screen view (a map, a canvas) that mu
|
|
|
12
12
|
The heading and the count go in `header`: they stay put while the list scrolls under them.
|
|
13
13
|
```tsx
|
|
14
14
|
import { useState } from "react";
|
|
15
|
-
import { BottomSheet, ListRow, Pill, SectionHeading } from "@slashsuite/ui-react";
|
|
15
|
+
import { BottomSheet, ListRow, Pill, SectionHeading, Stack } from "@slashsuite/ui-react";
|
|
16
16
|
|
|
17
17
|
function Example() {
|
|
18
18
|
const [snap, setSnap] = useState(1);
|
|
@@ -29,11 +29,13 @@ function Example() {
|
|
|
29
29
|
</>
|
|
30
30
|
}
|
|
31
31
|
>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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>
|
|
37
39
|
</BottomSheet>
|
|
38
40
|
);
|
|
39
41
|
}
|
|
@@ -44,7 +46,8 @@ function Example() {
|
|
|
44
46
|
- Hold `snap` in your state and set it in `onSnapChange`: `<BottomSheet snap={snap} onSnapChange={setSnap} …>`.
|
|
45
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.
|
|
46
48
|
- The heading and a count go in `header`, never first in the body, so they stay put while the list scrolls.
|
|
47
|
-
- Pad the map camera by the height `onHeightChange` reports, so a pin is never hidden under the sheet.
|
|
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.
|
|
48
51
|
- A record or a form that stops the page is a `Drawer`; a question is a `Dialog`.
|
|
49
52
|
- Render the first snap first: the server render, and a page with no JavaScript, show a static panel at it.
|
|
50
53
|
|
|
@@ -52,18 +55,20 @@ function Example() {
|
|
|
52
55
|
Do not put the heading first in the body: it scrolls away with the list.
|
|
53
56
|
```tsx
|
|
54
57
|
import { useState } from "react";
|
|
55
|
-
import { BottomSheet, ListRow, SectionHeading } from "@slashsuite/ui-react";
|
|
58
|
+
import { BottomSheet, ListRow, SectionHeading, Stack } from "@slashsuite/ui-react";
|
|
56
59
|
|
|
57
60
|
function Example() {
|
|
58
61
|
const [snap, setSnap] = useState(1);
|
|
59
62
|
return (
|
|
60
63
|
<BottomSheet label="Shops" snaps={[0.3, 0.75]} snap={snap} onSnapChange={setSnap}>
|
|
61
64
|
<SectionHeading>Shops nearby</SectionHeading>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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>
|
|
67
72
|
</BottomSheet>
|
|
68
73
|
);
|
|
69
74
|
}
|
|
@@ -71,21 +76,26 @@ function Example() {
|
|
|
71
76
|
|
|
72
77
|
### Accessibility
|
|
73
78
|
- It is a region named by `label`.
|
|
74
|
-
- The handle is a button named by `label`, with `aria-expanded` and `aria-controls` on the body. Enter and Space step through the snaps, and Escape inside the sheet returns it to the first.
|
|
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.
|
|
75
80
|
- Nothing behind it is inert, and focus is never trapped or moved.
|
|
76
81
|
- The settle between snaps is switched off under `prefers-reduced-motion: reduce`.
|
|
77
82
|
- The body scrolls on its own and never scrolls the page.
|
|
78
83
|
|
|
79
84
|
### Props
|
|
80
85
|
### BottomSheet
|
|
81
|
-
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), 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.
|
|
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.
|
|
82
87
|
- children: ReactNode. The scrolling body.
|
|
83
88
|
- footer: ReactNode. Actions pinned under the scrolling body.
|
|
84
89
|
- header: ReactNode. The row under the handle: a heading and a count. It stays put while the body scrolls.
|
|
85
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.
|
|
86
96
|
- label: string (required). The sheet's accessible name, as a region, and its handle button's.
|
|
87
|
-
- onHeightChange: (px: number) => void. Called with the height (px)
|
|
88
|
-
|
|
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.
|
|
89
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.
|
|
90
100
|
- snap: number (required). The current snap, an index into `snaps`. Render the first (0) first and a page with no JavaScript shows it.
|
|
91
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
|
|
@@ -4,6 +4,9 @@ Group: Navigation
|
|
|
4
4
|
|
|
5
5
|
When to use: A page several levels deep that needs a way back up: org, project, build, snapshot.
|
|
6
6
|
|
|
7
|
+
### Use instead
|
|
8
|
+
- TableOfContents (table-of-contents.md): The reader moves between the sections of this page.
|
|
9
|
+
|
|
7
10
|
### The one right way
|
|
8
11
|
A parent crumb is `{ label, href }` and the last is plain text: the trail that leads back up, ending at the current page.
|
|
9
12
|
```tsx
|
|
@@ -19,9 +22,9 @@ import { Breadcrumbs } from "@slashsuite/ui-react";
|
|
|
19
22
|
```
|
|
20
23
|
|
|
21
24
|
### Do
|
|
22
|
-
- Give the trail in order, parents first. A
|
|
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.
|
|
23
26
|
- Breadcrumbs show a hierarchy. Peer sections are `Tabs` of links.
|
|
24
|
-
-
|
|
27
|
+
- A trail too long for its row wraps; a long parent truncates, and the current page is never cut.
|
|
25
28
|
- Put the trail in the `breadcrumbs` slot of a `PageHeader`.
|
|
26
29
|
|
|
27
30
|
### Don't
|
|
@@ -48,15 +51,16 @@ import { Breadcrumbs } from "@slashsuite/ui-react";
|
|
|
48
51
|
|
|
49
52
|
### Accessibility
|
|
50
53
|
- `<nav aria-label="Breadcrumb">` around an ordered list.
|
|
51
|
-
- The last
|
|
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.
|
|
52
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.
|
|
53
57
|
|
|
54
58
|
### Props
|
|
55
59
|
### Breadcrumbs
|
|
56
|
-
`org / project / build / snapshot`:
|
|
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.
|
|
57
61
|
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
58
|
-
- 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
|
|
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"`.
|
|
59
63
|
- label: string (default Breadcrumb). The trail's accessible name, on its `<nav>`, for an app in another language.
|
|
60
64
|
|
|
61
65
|
### Types
|
|
62
|
-
- 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
|
|
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"`.
|
|
@@ -103,7 +103,7 @@ Enter and Space do nothing) while it stays in the tab order, and shows the reaso
|
|
|
103
103
|
tooltip on hover, keyboard focus and a tap, read out as its description.
|
|
104
104
|
- external: boolean. Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
|
|
105
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" | "table" | "type" | "diff" | "baseline" | "review" | "ci" | "self-host" | "privacy" | "capture" | "branch" | "theme" | "speed" | "chevron-right" | "chevron-down" | "close" | "external-link" | "settings" | "bell" | "check" | "plus" | "more" | "window" | "card" | "pointer" | "field" | "compass" | "briefcase". An icon from the `Icon` set before the label, decorative, at the button's size.
|
|
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
107
|
- pressed: boolean. A toggle: sets `aria-pressed`. On `outline` and `ghost`, `false` draws the neutral off look
|
|
108
108
|
and `true` the tone's primary fill, so a row of filter chips shows the selected one plainly.
|
|
109
109
|
Left out, the button is not a toggle, has no `aria-pressed` and keeps its variant's look.
|
|
@@ -132,4 +132,4 @@ A wrapping row of buttons with one optional item pushed to the far end (a Back l
|
|
|
132
132
|
- ButtonTone: `"neutral" | "positive" | "danger"`. A Button's tones: `neutral` (the accent fill, the default), `positive` and `danger`.
|
|
133
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
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. 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`. - 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. 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`.
|
|
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.
|
|
@@ -67,15 +67,16 @@ import { ErrorPage, Section } from "@slashsuite/ui-react";
|
|
|
67
67
|
- `danger` is `role="alert"` and `warn` is `role="status"`, so a screen reader announces them when they appear; the other tones have no role. The tone is also colour and text, so say what happened in the words.
|
|
68
68
|
- A `title` is a bold paragraph, not a heading, so it adds nothing to the heading outline.
|
|
69
69
|
- Buttons and links in `actions` keep their own focus ring and keyboard behaviour.
|
|
70
|
+
- Below `sm` the actions share a full-width row under the text, so a phone's thumb finds them; from `sm` they sit at the end of the row.
|
|
70
71
|
|
|
71
72
|
### Props
|
|
72
73
|
### Callout
|
|
73
|
-
A tinted notice box, with an optional bold title above its body. Its text is text-sm (text-base/7 inside a `Prose`, boxed or `banner`). `actions` puts a button or link at the end of the row
|
|
74
|
-
- actions: ReactNode. A button or link at the end of the row, beside the title and body.
|
|
74
|
+
A tinted notice box, with an optional bold title above its body. Its text is text-sm (text-base/7 inside a `Prose`, boxed or `banner`). `actions` puts a button or link at the end of the row, or under the text at full width below `sm`; `banner` makes it a flat strip (bottom border only, no radius) for the top of a `Card flush` and nowhere else: a padded card or a padded `FullBleedLayout` column would inset it. `align="center"` centres the text. In a page's column the notice is a plain Callout, first in the column's `Stack`. With `actions` the box is `relative`, so a `TextLink stretch` there makes the whole callout its click target, like a link in a table row. `icon` sets one of the library's icons at the start of the box, in the tone's ink. `danger` is `role="alert"` and `warn` is `role="status"`, so a screen reader announces them when they appear; the other tones have no role.
|
|
75
|
+
- actions: ReactNode. A button or link at the end of the row, beside the title and body; on a phone, under them at full width.
|
|
75
76
|
- align: "center" | "start" (default start). `center` centres the title and body, for a success that stands alone. With
|
|
76
77
|
`actions` only the text is centred.
|
|
77
78
|
- banner: boolean (default false). A flat strip: `border-b` only and no radius, for the top of a `Card flush` only.
|
|
78
|
-
- icon: "page" | "grid" | "search" | "table" | "type" | "diff" | "baseline" | "review" | "ci" | "self-host" | "privacy" | "capture" | "branch" | "theme" | "speed" | "chevron-right" | "chevron-down" | "close" | "external-link" | "settings" | "bell" | "check" | "plus" | "more" | "window" | "card" | "pointer" | "field" | "compass" | "briefcase". One of the library's icons, at the start of the box beside the text.
|
|
79
|
+
- 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". One of the library's icons, at the start of the box beside the text.
|
|
79
80
|
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
80
81
|
- title: ReactNode. A bold line above the body.
|
|
81
82
|
- tone: "neutral" | "info" | "positive" | "warn" | "danger" (default neutral). What the notice means: `neutral` a plain note, `info` something worth knowing, `positive` a
|