@slashsuite/ui-react 0.12.0 → 0.12.1

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.
Files changed (96) hide show
  1. package/README.md +12 -0
  2. package/agent-docs/components/app-shell.md +136 -0
  3. package/agent-docs/components/avatar-stack.md +64 -0
  4. package/agent-docs/components/avatar.md +76 -0
  5. package/agent-docs/components/badge.md +61 -0
  6. package/agent-docs/components/body-text.md +158 -0
  7. package/agent-docs/components/bottom-sheet.md +95 -0
  8. package/agent-docs/components/breadcrumbs.md +62 -0
  9. package/agent-docs/components/bullet-list.md +54 -0
  10. package/agent-docs/components/button.md +135 -0
  11. package/agent-docs/components/callout.md +86 -0
  12. package/agent-docs/components/card-grid.md +108 -0
  13. package/agent-docs/components/card.md +113 -0
  14. package/agent-docs/components/centered-layout.md +90 -0
  15. package/agent-docs/components/chat-composer.md +48 -0
  16. package/agent-docs/components/chat-message.md +61 -0
  17. package/agent-docs/components/chat-thread.md +49 -0
  18. package/agent-docs/components/checkbox.md +75 -0
  19. package/agent-docs/components/cluster.md +106 -0
  20. package/agent-docs/components/code-example.md +48 -0
  21. package/agent-docs/components/code.md +70 -0
  22. package/agent-docs/components/colour-scheme-toggle.md +92 -0
  23. package/agent-docs/components/container.md +50 -0
  24. package/agent-docs/components/copy-button.md +61 -0
  25. package/agent-docs/components/copy-line.md +54 -0
  26. package/agent-docs/components/date-field.md +103 -0
  27. package/agent-docs/components/date-range-picker.md +101 -0
  28. package/agent-docs/components/detail-layout.md +147 -0
  29. package/agent-docs/components/dialog.md +178 -0
  30. package/agent-docs/components/disclosure.md +66 -0
  31. package/agent-docs/components/divider.md +62 -0
  32. package/agent-docs/components/docs-layout.md +160 -0
  33. package/agent-docs/components/drawer.md +128 -0
  34. package/agent-docs/components/empty-state.md +67 -0
  35. package/agent-docs/components/field-dialog.md +97 -0
  36. package/agent-docs/components/field.md +68 -0
  37. package/agent-docs/components/fieldset.md +82 -0
  38. package/agent-docs/components/file-drop.md +52 -0
  39. package/agent-docs/components/form-layout.md +141 -0
  40. package/agent-docs/components/form-row.md +93 -0
  41. package/agent-docs/components/full-bleed-layout.md +116 -0
  42. package/agent-docs/components/headings.md +101 -0
  43. package/agent-docs/components/hero.md +59 -0
  44. package/agent-docs/components/icon-button.md +92 -0
  45. package/agent-docs/components/icon.md +66 -0
  46. package/agent-docs/components/image.md +64 -0
  47. package/agent-docs/components/input.md +83 -0
  48. package/agent-docs/components/kbd.md +38 -0
  49. package/agent-docs/components/key-value-list.md +81 -0
  50. package/agent-docs/components/lightbox.md +97 -0
  51. package/agent-docs/components/list-layout.md +154 -0
  52. package/agent-docs/components/list-row.md +116 -0
  53. package/agent-docs/components/loading.md +69 -0
  54. package/agent-docs/components/markdown.md +51 -0
  55. package/agent-docs/components/media-tile.md +97 -0
  56. package/agent-docs/components/menu.md +103 -0
  57. package/agent-docs/components/meta-list.md +69 -0
  58. package/agent-docs/components/morph.md +128 -0
  59. package/agent-docs/components/navigation-progress.md +56 -0
  60. package/agent-docs/components/outline-region.md +63 -0
  61. package/agent-docs/components/page-fade.md +116 -0
  62. package/agent-docs/components/page-header.md +93 -0
  63. package/agent-docs/components/pagination.md +64 -0
  64. package/agent-docs/components/pill.md +104 -0
  65. package/agent-docs/components/progress-bar.md +66 -0
  66. package/agent-docs/components/prose-layout.md +87 -0
  67. package/agent-docs/components/prose.md +41 -0
  68. package/agent-docs/components/radio-group.md +74 -0
  69. package/agent-docs/components/scroll-strip.md +48 -0
  70. package/agent-docs/components/segmented-control.md +133 -0
  71. package/agent-docs/components/select.md +65 -0
  72. package/agent-docs/components/show.md +120 -0
  73. package/agent-docs/components/side-column.md +70 -0
  74. package/agent-docs/components/sidebar-layout.md +134 -0
  75. package/agent-docs/components/site-footer.md +63 -0
  76. package/agent-docs/components/site-search.md +67 -0
  77. package/agent-docs/components/sortable-list.md +107 -0
  78. package/agent-docs/components/split-bar.md +54 -0
  79. package/agent-docs/components/stack.md +197 -0
  80. package/agent-docs/components/stacked-bar.md +88 -0
  81. package/agent-docs/components/stat-tile.md +69 -0
  82. package/agent-docs/components/status-pages.md +105 -0
  83. package/agent-docs/components/steps.md +74 -0
  84. package/agent-docs/components/sticky-bar.md +51 -0
  85. package/agent-docs/components/switch.md +79 -0
  86. package/agent-docs/components/table.md +373 -0
  87. package/agent-docs/components/tabs.md +180 -0
  88. package/agent-docs/components/text-link.md +105 -0
  89. package/agent-docs/components/textarea.md +51 -0
  90. package/agent-docs/components/timeline.md +79 -0
  91. package/agent-docs/components/toast.md +86 -0
  92. package/agent-docs/components/trend-chart.md +61 -0
  93. package/agent-docs/components/video.md +44 -0
  94. package/agent-docs/llms.txt +155 -0
  95. package/package.json +6 -3
  96. package/skills/uislash/SKILL.md +20 -0
@@ -0,0 +1,101 @@
1
+ ## Headings
2
+
3
+ Group: Text
4
+
5
+ When to use: Any title on a page: the public headline, the page title, a section, a subsection.
6
+
7
+ ### The one right way
8
+ One `PageHeading` names the page, `SectionHeading` its parts and `SubsectionHeading` what is inside a part.
9
+ ```tsx
10
+ import {
11
+ PageHeading,
12
+ SectionHeading,
13
+ Stack,
14
+ SubsectionHeading,
15
+ Text,
16
+ } from "@slashsuite/ui-react";
17
+
18
+ <Stack gap="sm">
19
+ <PageHeading>Quotes</PageHeading>
20
+ <SectionHeading rule>Open</SectionHeading>
21
+ <SubsectionHeading>Awaiting reply</SubsectionHeading>
22
+ <Text>Three quotes are waiting on the customer.</Text>
23
+ </Stack>
24
+ ```
25
+
26
+ ### Do
27
+ - A page has one title: `PageHeading` for an app page, `Display` for the headline of a public page. A `PageHeader` already draws the `PageHeading` and its `description`, so use it for the top of a page.
28
+ - Name the parts of a page with `SectionHeading`; `rule` puts the hairline under it, with the space either side built in.
29
+ - Name what is inside a part with `SubsectionHeading`: `size` `sm` is a form-group caption, `md` (default) a card title in a header bar, `lg` a drawer title. `truncate` cuts one that is too long for its column to a single line.
30
+ - Put a `Lead` under a `Display`, and a `Text` under any other heading. `Dialog` and `Drawer` draw their own title from their `title`.
31
+ - Pick the heading for its place in the outline, never for its size. `Display` is not a big `SectionHeading`.
32
+ - Each heading has its own fixed ink and takes no colour. A heading's meaning is carried by its words, not a colour.
33
+ - `as` changes the element, only to keep the outline in order, and never the look.
34
+ - `description` on a `SectionHeading` is a muted line under it that says more; it is not part of the heading's name.
35
+
36
+ ### Don't
37
+ `PageHeading` is an `h1`, and a page has one. A second one for a section breaks the outline: use `SectionHeading`.
38
+ ```tsx
39
+ import { PageHeading, Stack, Text } from "@slashsuite/ui-react";
40
+
41
+ <Stack gap="sm">
42
+ <PageHeading>Quotes</PageHeading>
43
+ <Text>Three quotes are waiting on the customer.</Text>
44
+ <PageHeading>Open</PageHeading>
45
+ <Text>Two quotes are open.</Text>
46
+ </Stack>
47
+ ```
48
+
49
+ `Display` is marketing scale, not a section title: inside a page it dwarfs everything around it. Use `SectionHeading`.
50
+ ```tsx
51
+ import { Display, PageHeading, Stack, Text } from "@slashsuite/ui-react";
52
+
53
+ <Stack gap="sm">
54
+ <PageHeading>Dashboard</PageHeading>
55
+ <Display as="h2">Recent activity</Display>
56
+ <Text>Nothing has changed since yesterday.</Text>
57
+ </Stack>
58
+ ```
59
+
60
+ ### Accessibility
61
+ - Each heading renders a real heading element: `Display` and `PageHeading` an `h1`, `SectionHeading` an `h2`, `SubsectionHeading` an `h3`.
62
+ - `as` swaps the element and keeps the look, so the outline can follow the page without a visual change.
63
+ - `id`, `aria-*` and `data-*` go on the heading element.
64
+ - `Dialog` and `Drawer` draw their title as a `SectionHeading` and name themselves by it; an `EmptyState` does the same.
65
+
66
+ ### Props
67
+ ### Display
68
+ Marketing-scale headline: the one line at the top of a public page. `h1`, text-4xl/tight semibold, primary text, growing to text-6xl on wider screens. `PageHeading` is the title of an ordinary page, a step below; a brochure hero needs a display scale, so it gets its own pinned role rather than callers overriding PageHeading's size.
69
+ - as: ElementType. The element to render (each role has a semantic default); the other props follow it.
70
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
71
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
72
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
73
+
74
+ ### PageHeading
75
+ Page title. `h1`, text-3xl/9 bold (text-4xl/10 from `sm`), tight, primary text: well above the `Lead` under it and the body text after it, so the page's title reads first.
76
+ - as: ElementType. The element to render (each role has a semantic default); the other props follow it.
77
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
78
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
79
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
80
+
81
+ ### SectionHeading
82
+ Top-level section header. `h2`, text-xl/7 semibold, primary text (text-base/6 under an `AppShell density="compact"`, text-2xl/8 semibold tight inside a `Prose`). `rule` sets a hairline under it (the `Divider` line colour) with the space either side of the line built in. `description` is a muted line under the heading, outside the `<h2>`, so the heading's name stays the title; the rule then sits under the description.
83
+ - as: ElementType. The element to render (each role has a semantic default); the other props follow it.
84
+ - description: ReactNode. A muted line under the heading that says more. It is a paragraph beside the heading, not part of its name.
85
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
86
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
87
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
88
+ - rule: boolean. A hairline under the heading, with the space either side of it built in.
89
+
90
+ ### SubsectionHeading
91
+ Nested header. `h3`, text-lg/7 semibold, primary text. `size` steps it down to `sm` (text-base, body size set apart by its weight) for a form-group caption or a dense card, or up to `lg` (text-xl) for a drawer title; `md` is the default. Under an `AppShell density="compact"` each is one step down. Inside a `Prose` `md` is text-xl/7 (the h3 of a doc), `sm` text-base/7 (the h4: body size, set apart by its weight) and `lg` text-2xl/8, the size of a `SectionHeading` there. `truncate` keeps it on one line and cuts it with an ellipsis where its container ends, the full text as the `title`.
92
+ - as: ElementType. The element to render (each role has a semantic default); the other props follow it.
93
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
94
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
95
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
96
+ - size: "sm" | "md" | "lg" (default md). The heading's type size: `sm` is text-base/6, `md` text-lg/7 and `lg` text-xl/7 (one step down
97
+ each under an `AppShell density="compact"`).
98
+ - truncate: boolean. One line, cut with an ellipsis where the container ends; the full text becomes the `title`.
99
+
100
+ ### Types
101
+ - SubsectionHeadingSize: `"sm" | "md" | "lg"`. A SubsectionHeading's type size: `sm` a form-group caption, `md` a card title, `lg` a drawer title.
@@ -0,0 +1,59 @@
1
+ ## Hero
2
+
3
+ Group: Layout
4
+
5
+ When to use: The first block of a site's landing page, and nowhere else: every other page opens with a `PageHeader`.
6
+
7
+ ### The one right way
8
+ A landing page opens with one `Hero`: the overline, the title and the lede, over the theme's glow.
9
+ ```tsx
10
+ import { Hero, Lead } from "@slashsuite/ui-react";
11
+
12
+ <Hero overline="Products" title="Software we make.">
13
+ <Lead>A component library and the tools we build it with.</Lead>
14
+ </Hero>
15
+ ```
16
+
17
+ ### Do
18
+ - One `Hero` per page, and only on the landing page: it is the page's top block. Inner pages use `PageHeader`.
19
+ - Pass `title` and, if it has one, `overline`; put a `Lead` in `children`, then the page's first actions in a `Cluster` if there are any: a primary `Button` and an `outline` or `ghost` one in the default tone, or a `TextLink`. That is the text the theme's contrast check holds over the glow.
20
+ - The glow is always on and takes no prop. Its colours and its strength are the theme's, so a paper theme keeps it faint.
21
+ - It caps itself at a reading measure at the parent's start edge, and the glow is clipped to it, so a phone never scrolls sideways. Put it as the first child of the page's `Stack`.
22
+
23
+ ### Don't
24
+ - Never build the block from an `Overline`, a `Display` and a `Lead` by hand: the hand-built one has no glow and drifts from the one top block.
25
+
26
+ An overline, a `Display` and a `Lead` put together by hand drift from the one top block, and have no glow. Use `Hero`.
27
+ ```tsx
28
+ import { Display, Lead, Overline, Stack } from "@slashsuite/ui-react";
29
+
30
+ <Stack gap="sm" width="narrow">
31
+ <header>
32
+ <Overline mono>Products</Overline>
33
+ <Display>Software we make.</Display>
34
+ </header>
35
+ <Lead>A component library and the tools we build it with.</Lead>
36
+ </Stack>
37
+ ```
38
+
39
+ A `Hero` on an inner page shouts over the content it heads. Use `PageHeader`.
40
+ ```tsx
41
+ import { Hero, Lead } from "@slashsuite/ui-react";
42
+
43
+ <Hero title="Members">
44
+ <Lead>Who can see this project.</Lead>
45
+ </Hero>
46
+ ```
47
+
48
+ ### Accessibility
49
+ - The title is the page's `<h1>`, in a `<header>` with the overline.
50
+ - The glow is `aria-hidden="true"` and takes no pointer; the text sits above it and holds AA contrast over it in every theme.
51
+ - The glow drifts only under `prefers-reduced-motion: no-preference`; with reduced motion it stands still. It is plain markup and CSS, so it renders on the server and needs no script.
52
+
53
+ ### Props
54
+ ### Hero
55
+ A landing page's top block: an overline, the display title (the page's `h1`) and the lede under it, over a soft glow of three tilted ribbons that drift slowly behind the text. The glow is always there and its colours and strength are the theme's (the palette's `glow` role), so a paper theme keeps it faint. It is anchored to the text's own column (`max-w-3xl`, at the parent's start edge), never the viewport, and clipped to it, so nothing scrolls sideways on a phone. It is `aria-hidden`, and the text sits above it. Under `prefers-reduced-motion: reduce` it stands still. Pure markup and one inline stylesheet: it works rendered on the server with no script. One per page, on a landing page; every other page opens with a `PageHeader`.
56
+ - children: ReactNode. What follows the title: a `Lead`, and the page's first actions if it has any.
57
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
58
+ - overline: ReactNode. The small label above the title, set in the monospace face.
59
+ - title: ReactNode (required). The page's `h1`, at display size.
@@ -0,0 +1,92 @@
1
+ ## IconButton
2
+
3
+ Group: Actions
4
+
5
+ When to use: An action with a familiar icon and no room for a word: delete, settings, alerts.
6
+
7
+ ### The one right way
8
+ `label` names the button for a screen reader and shows as its tooltip; the icon is only decoration.
9
+ ```tsx
10
+ import { IconButton } from "@slashsuite/ui-react";
11
+
12
+ <IconButton label="Delete quote" tone="danger" variant="ghost" icon="close" />
13
+
14
+ ```
15
+
16
+ ### Do
17
+ - Always give the `label`: it is the accessible name and the tooltip, and the icon is only decoration.
18
+ - `variant="ghost"` is the quiet one for a row or a toolbar; `tone="danger"` is for delete and clear.
19
+ - `size` is `sm` (26px) inside a row or a chip, `md` (default, 38px, the height of a `Button`) or `lg` beside a large `Button`.
20
+ - An unread count is `count`, never part of the label; it is not shown at 0. The icon is `icon`, a name from the `Icon` set, never a child.
21
+ - Going to another page is `href` (through the app's `LinkProvider`), which draws the same button as a link.
22
+ - Say why it cannot be pressed with `disabledReason`: the reason becomes its tooltip in place of the label.
23
+ - An action that needs a word is a `Button`.
24
+ - A row of several icon buttons is a `Menu`: one main action in view, the rest behind it.
25
+
26
+ ### Don't
27
+ A `Button` holding a glyph has no accessible name, no tooltip and the wrong box; an icon-only action is an `IconButton`.
28
+ ```tsx
29
+ import { Button } from "@slashsuite/ui-react";
30
+
31
+ <Button variant="ghost" tone="danger" size="sm">
32
+ <span aria-hidden="true">x</span>
33
+ </Button>
34
+ ```
35
+
36
+ A count typed into the label shows only in the tooltip, so a sighted user never sees it on the button.
37
+ ```tsx
38
+ import { IconButton } from "@slashsuite/ui-react";
39
+
40
+ <IconButton label="Alerts (3)" icon="bell" />
41
+
42
+ ```
43
+
44
+ A button that sets `location` loses middle-click, the status-bar URL and crawlability.
45
+ ```tsx
46
+ import { IconButton } from "@slashsuite/ui-react";
47
+
48
+ <IconButton
49
+ label="Settings"
50
+ variant="ghost"
51
+ onClick={() => location.assign("#settings")}
52
+ icon="settings"
53
+ />
54
+ ```
55
+
56
+ A bare `disabled` drops it from the tab order and gives no reason.
57
+ ```tsx
58
+ import { IconButton } from "@slashsuite/ui-react";
59
+
60
+ <IconButton label="Delete quote" tone="danger" icon="close" disabled />
61
+
62
+ ```
63
+
64
+ ### Accessibility
65
+ - `label` is set as `aria-label`, and shows as a tooltip above the button on hover and on keyboard focus (the native `title` in a browser without CSS anchor positioning); with a `count` it reads `Alerts, 3`. The tooltip repeats the name, so it is hidden from a screen reader.
66
+ - The badge itself is `aria-hidden`, so the count is read once, through the name.
67
+ - As a button it defaults to `type="button"`; with `href` it is a real link, and `external` opens a new tab with `rel="noreferrer"`.
68
+ - `disabledReason` sets `aria-disabled` and keeps the button in the tab order; a click, Enter and Space do nothing, and the reason shows as a tooltip on hover, keyboard focus and a tap, read out as its description (the native `title` without CSS anchor positioning).
69
+ - It has the component's focus ring.
70
+
71
+ ### Props
72
+ ### IconButton
73
+ A square button holding one icon from the `Icon` set (`icon`). `label` is its accessible name and tooltip. `variant="ghost"` drops the border for a quiet action in a row or a toolbar; `size` matches the height of a `Button` of the same size (`sm` 26px, `md` 38px, `lg` 46px; a responsive `{ base, md }` changes at 48rem) and with no `size` it takes its container's; `tone="danger"` is red, for delete and clear; `count` pins a red count to the corner; `disabledReason` blocks it and shows why. Defaults to `type="button"`. `href` makes it a link instead (the app's router link through `LinkProvider` for an in-app path, else a plain `<a>`; `external` opens a new tab), with the same look.
74
+ - count: number. A red count on the top corner at the end edge, for unread alerts. Not shown at 0; the name carries it for a screen reader, "Alerts, 3".
75
+ - disabledReason: string. Why the button cannot be pressed: it dims and is blocked (`aria-disabled`; a click, Enter and
76
+ Space do nothing) while it stays in the tab order, and the reason is its tooltip on hover,
77
+ keyboard focus and a tap, read out as its description. The name stays `label`.
78
+ - external: boolean. Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
79
+ - href: string. Makes the button a link to this URL; an in-app path goes through the app's `LinkProvider`.
80
+ - 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" (required). The one icon it holds, from the `Icon` set, at the button's size.
81
+ - label: string (required). The button's accessible name and its tooltip, shown on hover and on keyboard focus.
82
+ - size: Size | ResponsiveSize (default md). The button's height, matching a `Button` or `Input` of the same size. Left out, it takes the
83
+ size of the `Card`, `ListRow` or `Table` it sits in, else `md`. `{ base: "md", md: "lg" }`
84
+ changes size at the `md` breakpoint (48rem), in CSS.
85
+
86
+ Give it the same value as a responsive `Button` beside it.
87
+ - tone: "neutral" | "danger" (default neutral). `danger` is red, for delete and clear.
88
+ - variant: "outline" | "ghost" (default outline). `outline` has a border; `ghost` has none, until the hover fill.
89
+
90
+ ### Types
91
+ - IconButtonTone: `"neutral" | "danger"`. An IconButton's tones: `neutral` (the default) and `danger`.
92
+ - IconButtonVariant: `"outline" | "ghost"`. An IconButton's look: `outline` with a border, or `ghost` with none until hover.
@@ -0,0 +1,66 @@
1
+ ## Icon
2
+
3
+ Group: Actions
4
+
5
+ When to use: A glyph beside text or inside a control: a flag in a row, a camera in a Button, or a feature icon (`name` at `feature` size) that stands for an idea.
6
+
7
+ ### The one right way
8
+ A bare `<svg>` goes in an `Icon`, which sizes and tones it, and a Button beside text needs nothing more.
9
+ ```tsx
10
+ import { Button, Icon } from "@slashsuite/ui-react";
11
+
12
+ <Button variant="outline">
13
+ <Icon>
14
+ <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.6">
15
+ <path d="M3 6.5h3l1.5-2h5L14 6.5h3v9H3Z" strokeLinejoin="round" />
16
+ <circle cx="10" cy="11" r="2.75" />
17
+ </svg>
18
+ </Icon>
19
+ Capture
20
+ </Button>
21
+ ```
22
+
23
+ ### Do
24
+ - `name` picks one of the library's icons, all on one grid and one stroke: `diff`, `baseline`, `review`, `ci`, `self-host`, `privacy`, `capture`, `branch`, `theme`, `speed`, `search`, `chevron-right`, `chevron-down`, `close`, `external-link`, `settings`, `bell`, `check`, `plus`, `more`, `grid`, `window`, `type`, `card`, `pointer`, `field`, `table`, `compass`, `page` and `briefcase`. Each is named for its idea or action, not a product. Prefer one to drawing your own.
25
+ - For a glyph the set lacks, put a bare `<svg>` (with a `viewBox`, no size or colour classes) in an `Icon`; it fills the box.
26
+ - `size` is `sm` (14px), `md` (16px, the default), `lg` (20px) or `feature` (32px), for an icon that stands for an idea on its own. A feature card takes its icon through `Card`'s `icon`.
27
+ - `tone` is a text tone: `neutral`, `muted`, `accent`, `info`, `positive`, `warn` or `danger`. Left out, the icon takes the colour of the text around it, so draw the glyph with `currentColor`.
28
+ - An icon that is a button is an `IconButton`.
29
+
30
+ ### Don't
31
+ A bare `<svg>` with its own size and colour is a one-off: each one picks its own size and colour, and none follows the theme's muted text.
32
+ ```tsx
33
+ import { Button } from "@slashsuite/ui-react";
34
+
35
+ <Button variant="outline">
36
+ <svg
37
+ viewBox="0 0 20 20"
38
+ fill="none"
39
+ stroke="#5ec8ff"
40
+ strokeWidth="1.6"
41
+ width="18"
42
+ height="18"
43
+ >
44
+ <path d="M3 6.5h3l1.5-2h5L14 6.5h3v9H3Z" strokeLinejoin="round" />
45
+ <circle cx="10" cy="11" r="2.75" />
46
+ </svg>
47
+ Capture
48
+ </Button>
49
+ ```
50
+
51
+ ### Accessibility
52
+ - An Icon is decorative and `aria-hidden` by default: the text beside it says what it means.
53
+ - An icon that carries meaning on its own takes a `label`, which makes it `role="img"` with that name.
54
+
55
+ ### Props
56
+ ### Icon
57
+ One inline icon, sized to a fixed box (sm 14px, md 16px, lg 20px, `feature` 32px) and drawn in `currentColor`, so it takes the text colour around it unless a `tone` says otherwise. `name` picks one of the library's own icons, all drawn on one grid with one stroke: feature ideas (`diff`, `baseline`, `review`, `ci`, `self-host`, `privacy`, `capture`, `branch`, `theme`, `speed`, `search`) and UI glyphs (`chevron-right`, `chevron-down`, `close`, `external-link`, `settings`, `bell`, `check`, `plus`, `more`) and the ideas the docs sections stand for (`grid`, `window`, `type`, `card`, `pointer`, `field`, `table`, `compass`, `page`, `briefcase`); without a name, a bare `<svg>` child fills the box. It is decorative (`aria-hidden`) by default; a `label` makes it an image with that name, for an icon that carries meaning no text beside it says.
58
+ - children: ReactNode. The `<svg>`, drawn in `currentColor`; it fills the box.
59
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
60
+ - label: string. Names the icon (`role="img"`). Without one the icon is hidden from assistive tech.
61
+ - name: "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, named for the idea it stands for.
62
+ - size: Size | ResponsiveSize | "feature" (default md). The box: sm 14px, md 16px (the default), lg 20px, `feature` 32px for an icon that stands for an idea on its own (a feature card). `{ base, md }` (sm, md, lg) changes at the `md` breakpoint (48rem), as the icon in a Button of that size does.
63
+ - tone: "neutral" | "info" | "positive" | "warn" | "danger" | "muted" | "accent". A text tone. Left out, the icon takes the colour of the text around it.
64
+
65
+ ### Types
66
+ - IconName: `"baseline" | "diff" | "review" | "ci" | "self-host" | "privacy" | "capture" | "branch" | "theme" | "speed" | "search" | "chevron-right" | "chevron-down" | "close" | "external-link" | "settings" | "bell" | "check" | "plus" | "more" | "grid" | "window" | "type" | "card" | "pointer" | "field" | "table" | "compass" | "page" | "briefcase"`. The names of the icon set: feature ideas, then UI glyphs, then the ideas the docs sections stand for.
@@ -0,0 +1,64 @@
1
+ ## Image
2
+
3
+ Group: Content
4
+
5
+ When to use: Showing a picture that your app serves: a screenshot, a QR code, a product shot.
6
+
7
+ ### Use instead
8
+ - MediaTile (media-tile.md): The picture is a thing: it has a label, opens, or can be removed.
9
+ - Avatar (avatar.md): The picture is a person.
10
+ - OutlineRegion (outline-region.md): Areas of the picture are marked: a `RegionFrame`.
11
+
12
+ ### The one right way
13
+ A picture that must be seen whole, such as a QR code or a logo, is `fit="contain"`.
14
+ ```tsx
15
+ import { Image } from "@slashsuite/ui-react";
16
+
17
+ <Image src={sampleCode} alt="Pairing code" aspect="3:4" width="md" fit="contain" />
18
+
19
+ ```
20
+
21
+ ### Do
22
+ - `src` is your own picture, a local path or a data URL, and `alt` says what it shows. The corners are rounded and a hairline frames it on the inset surface.
23
+ - `aspect` is the shape it is cropped to: `square`, `4:3` (the default), `3:2`, `16:9`, the portrait `3:4` and `9:16`, or `natural`. The shape is reserved before the picture loads, so the page does not jump. `natural` is the exception: the picture keeps its own proportions, with nothing cropped, and the space is not reserved until it loads.
24
+ - `fit="cover"` (the default) fills the shape and crops what overflows. `fit="contain"` shows the whole picture, for a QR code or a logo that must not lose its edges.
25
+ - `framed` sets the picture on a white mat with padding and shows all of it. The mat is white in every theme, dark ones included, so a QR code scans off a dark page. Use it for a code, not for a photo.
26
+ - `width` is `sm` (96px), `md` (160px) or `lg` (256px), each a cap that a narrower parent still wins over, or `full` (the default) for the parent's width.
27
+ - With no `src`, or one that fails to load, a placeholder of the same size with a picture mark takes its place. A new `src` tries again.
28
+ - A person's photo is an `Avatar`; a clickable thumbnail with a label is a `MediaTile`; a video is a `Video`.
29
+
30
+ ### Don't
31
+ `cover` crops to the shape: it cuts the corners off a code, which then cannot be scanned.
32
+ ```tsx
33
+ import { Image } from "@slashsuite/ui-react";
34
+
35
+ <Image src={sampleCode} alt="Pairing code" aspect="16:9" width="md" fit="cover" />
36
+
37
+ ```
38
+
39
+ ### Accessibility
40
+ - An `<img>` named by `alt`. The placeholder is a `role="img"` with the same `alt`, so a missing picture is still announced.
41
+ - An empty `alt` marks the picture as decoration: it is hidden from a screen reader, placeholder included. Do that only when the text beside it says the same thing.
42
+
43
+ ### Props
44
+ ### Image
45
+ A picture in a fixed shape: `aspect` reserves the space before it loads, so the page does not jump, and `fit` crops it to the shape or shows all of it. The corners are rounded and the frame has a hairline. If the picture is missing or fails to load, a same-sized placeholder with a picture mark stands in, still named by `alt`. `framed` mats a code or a logo in white. A user's photo is an `Avatar`; a clickable thumbnail with a label is a `MediaTile`. While `loading` with no `src` yet it is a bone of the same shape, not the placeholder, which means there is no picture.
46
+ - alt: string (required). What the picture shows. An empty string marks it as decoration, hidden from a screen reader.
47
+ - aspect: "square" | "4:3" | "3:2" | "16:9" | "3:4" | "9:16" | "natural" (default 4:3). The shape it is cropped to: `square`, `4:3`, `3:2`, `16:9`, or the portrait `3:4` and `9:16`.
48
+ `natural` keeps the picture's own proportions instead, so nothing is cropped or letterboxed;
49
+ the space is not reserved before it loads.
50
+ - fit: "cover" | "contain" (default cover). `cover` fills the shape and crops what overflows; `contain` shows the whole picture, with the
51
+ rest of the shape left empty (a QR code, a logo).
52
+ - framed: boolean (default false). Sets the picture on a white mat with padding, always white, in every theme: a QR code is
53
+ scanned off a dark page. It shows the whole picture, as `fit="contain"`, whatever `fit` says.
54
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
55
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
56
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
57
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
58
+ - src: string. The picture, a local path or a data URL. It is never loaded for you: this is the app's own
59
+ image. Left out, or if it fails to load, the picture is replaced by a placeholder.
60
+ - width: "sm" | "md" | "lg" | "full" (default full). `sm` 96px, `md` 160px and `lg` 256px set the width, capped at the parent's; `full` fills the parent.
61
+
62
+ ### Types
63
+ - ImageAspect: `"square" | "4:3" | "3:2" | "16:9" | "3:4" | "9:16" | "natural"`. The shapes an image is cropped or letterboxed to, or `natural`: no shape of its own, so the picture keeps its own proportions.
64
+ - ImageWidth: `Size | "full"`. How wide an image is: `full` fills its parent; the others are 96, 160 or 256px, capped at the parent's width.
@@ -0,0 +1,83 @@
1
+ ## Input
2
+
3
+ Group: Forms
4
+
5
+ When to use: A short piece of text: a name, an amount, a search term.
6
+
7
+ ### The one right way
8
+ An amount is a `prefix` for the currency and `numeric`, which lines the digits up and brings up the number keypad.
9
+ ```tsx
10
+ import { Input } from "@slashsuite/ui-react";
11
+
12
+ <Input prefix="R" numeric width="md" aria-label="Amount" defaultValue="49.90" />
13
+
14
+ ```
15
+
16
+ ### Do
17
+ - Put an `Input` in a `Field`. Without one, name it with `aria-label`.
18
+ - A search box is `type="search"` with an `icon`; the clear button appears by itself.
19
+ - `prefix` is short text inside the border before the value, such as a currency symbol. It is for a plain field, not one with an `icon` or `type="search"`.
20
+ - A figure is `numeric`: an amount is `<Input prefix="R" numeric />` in a `Field`, and a count or a whole number is `<Input numeric inputMode="numeric" />`. It right-aligns the digits in tabular figures and brings up the number keypad. A unit other than a currency goes in the `label` ("UIF rate (%)").
21
+ - `size="sm"` is for a dense form or a table row, `size="lg"` for a sign-in or search form that stands alone; `md` is the default.
22
+ - `width` is `full` by default; `xs`, `sm`, `md` and `lg` are fixed widths for a short value; `fill` grows to the room beside other items in a row; `auto` is as wide as the browser makes it.
23
+ - A paragraph is a `Textarea`; a choice from a list is a `Select`; a date is a `DateField`.
24
+
25
+ ### Don't
26
+ - Do not use `type="number"` for an amount or a count a person types: the browser drops "1 250" and "12,400.00", the mouse wheel changes the value under a scrolling page, and the spinner arrows sit where the figure should end.
27
+
28
+ A currency typed into the placeholder is gone as soon as the person types, and nothing keeps the digits aligned.
29
+ ```tsx
30
+ import { Input } from "@slashsuite/ui-react";
31
+
32
+ <Input placeholder="R 0.00" width="md" aria-label="Amount" />
33
+
34
+ ```
35
+
36
+ `type="number"` drops "1 250", puts spinner arrows where the figure should end, and lets the mouse wheel change the value as the page scrolls.
37
+ ```tsx
38
+ import { Field, Input } from "@slashsuite/ui-react";
39
+
40
+ <Field label="Quantity">
41
+ <Input type="number" width="xs" defaultValue="12" />
42
+ </Field>
43
+ ```
44
+
45
+ A plain text input used for search has no icon and no way to clear it.
46
+ ```tsx
47
+ import { Input } from "@slashsuite/ui-react";
48
+
49
+ <Input aria-label="Search shops" placeholder="Search by name or suburb…" />
50
+
51
+ ```
52
+
53
+ ### Accessibility
54
+ - An `Input` is a native `<input>`: it takes `type`, `inputMode`, `autoComplete`, `required`, `disabled` and the `aria-*` and `data-*` props.
55
+ - A `type="search"` field shows a clear button while it has a value, named "Clear search" or by `clearLabel`; it is hidden when the field is disabled or read-only.
56
+ - The `icon` is decorative and hidden from assistive tech.
57
+ - A `numeric` field is a text field with a number keypad (`inputMode="decimal"` unless you pass your own), so it is read and kept exactly as typed.
58
+ - In a `Field`, the `Field` around it gives it its label and its hint or error as `aria-describedby`, and an error marks it `aria-invalid` with a red edge.
59
+ - The focus ring comes from the component.
60
+
61
+ ### Props
62
+ ### Input
63
+ A text input. `icon` names a leading icon inside the field (`icon="search"`). `prefix` puts short text inside the border before the value, such as a currency symbol; it is for a plain field, not with an `icon` or `type="search"`. `numeric` is a field for a figure: an amount (`<Input prefix="R" numeric />`) or a count (`numeric inputMode="numeric"`). It right-aligns the value in tabular figures and brings up the phone's number keypad (`inputMode="decimal"` unless you pass your own), and stays a text field, so "1 250" is kept as typed; never use `type="number"` for a figure a person types. `type="search"` drops the browser's own search look and shows a clear button at the trailing edge while the field has a value, named by `clearLabel`. The `ref` reaches the `<input>`.
64
+ - clearLabel: string (default Clear search). The name of a `type="search"` field's clear button, for an app in another language.
65
+ - disabled: boolean (native). Disables the field; say why in its `Field` hint.
66
+ - 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". A leading icon inside the field, by name (`search`). Not with `prefix`.
67
+ - name: string (native). The key the value posts under in a form.
68
+ - numeric: boolean (default false). A field for a figure (an amount, a count): the value right-aligned in tabular figures, and
69
+ `inputMode="decimal"` unless you pass your own (`numeric` for a whole number). It stays a
70
+ text field, so the value is kept as typed; parsing it is yours. Ignored on `type="search"`.
71
+ - placeholder: string (native). A hint shown while the field is empty; never the label.
72
+ - prefix: string. Short text inside the border before the value (a currency symbol). For a plain field: not with `icon` or `type="search"`.
73
+ - ref: Ref<HTMLInputElement>. The `<input>` itself, for focus control.
74
+ - required: boolean (native). The form will not submit while the field is empty.
75
+ - size: "sm" | "md" | "lg" (default md). `sm` is compact, `text-sm` with less padding, for dense forms and table rows; `md` is `text-base`;
76
+ `lg` is `text-lg` with more padding, for a hero form. Under an `AppShell density="compact"` each
77
+ is one type step down, and on a touch screen a field is never under 16px.
78
+ - type: string (native). The kind of value: `"text"`, `"email"`, `"search"`, `"password"` and the rest.
79
+ - width: "sm" | "md" | "lg" | "xs" | "auto" | "fill" | "full" (default full). `full` (default) fills the parent; `fill` grows to fill the room left in a row beside other items (it can shrink to nothing, so buttons stay on the line); `xs`, `sm`, `md`, `lg` are fixed; `auto` adds no width class, so the control is as wide as the browser makes it.
80
+
81
+ ### Types
82
+ - ControlSize: `"sm" | "md" | "lg"`. A control's size: the library's one `Size` scale.
83
+ - ControlWidth: `"sm" | "md" | "lg" | "xs" | "full" | "fill" | "auto"`. `full` fills the parent (the default); `fill` grows to the space left in a flex row; `auto` adds no width class, so the control is as wide as the browser makes it; the rest are fixed.
@@ -0,0 +1,38 @@
1
+ ## Kbd
2
+
3
+ Group: Text
4
+
5
+ When to use: A key or a shortcut the reader presses: `Esc`, `?`, `⌘S`.
6
+
7
+ ### The one right way
8
+ `Kbd` is a key the reader presses: in a sentence, or as the shortcut on a button.
9
+ ```tsx
10
+ import { Kbd, Text } from "@slashsuite/ui-react";
11
+
12
+ <Text>
13
+ Press <Kbd>Esc</Kbd> to close this list, or <Kbd>⌘S</Kbd> to save.
14
+ </Text>
15
+ ```
16
+
17
+ ### Do
18
+ - Use `Kbd` for a key the reader presses, in a sentence or as the shortcut on a `Button`.
19
+ - A command or a name is `Code`, never `Kbd`.
20
+
21
+ ### Don't
22
+ A command is `Code`, not a key. `Kbd` draws a keycap, which says "press this".
23
+ ```tsx
24
+ import { Kbd, Text } from "@slashsuite/ui-react";
25
+
26
+ <Text>
27
+ Run <Kbd>bun install</Kbd> to install.
28
+ </Text>
29
+ ```
30
+
31
+ ### Accessibility
32
+ - `Kbd` renders a `<kbd>` element, which marks the text as keyboard input.
33
+ - Its border takes the colour of the text around it, so it reads on plain text and on a filled button.
34
+
35
+ ### Props
36
+ ### Kbd
37
+ A keyboard key. Its border takes the surrounding text colour, so it reads on a filled button and on plain text.
38
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
@@ -0,0 +1,81 @@
1
+ ## KeyValueList
2
+
3
+ Group: Content
4
+
5
+ When to use: A set of facts about one thing: size, status, dates, shortcut keys.
6
+
7
+ ### Use instead
8
+ - Table (table.md): Many records with the same columns, to read across and compare.
9
+ - ListRow (list-row.md): The items are things to open, not the fields of one record.
10
+ - MetaList (meta-list.md): A few short facts inline, with no labels to line up.
11
+
12
+ ### The one right way
13
+ Label and value pairs are a `KeyValueList`: one row per fact, the label muted, the value in tabular figures.
14
+ ```tsx
15
+ import { KeyValue, KeyValueList } from "@slashsuite/ui-react";
16
+
17
+ <KeyValueList>
18
+ <KeyValue label="Size">1280×720</KeyValue>
19
+ <KeyValue label="Changed pixels">0.4%</KeyValue>
20
+ <KeyValue label="Captured">2 min ago</KeyValue>
21
+ </KeyValueList>
22
+ ```
23
+
24
+ ### Do
25
+ - Put a `KeyValue` with a `label` for each fact; the value is its children.
26
+ - `align="end"` is the default: each label at the left and its value right-aligned. `align="start"` puts every value left-aligned in one column beside the labels, which suits long values.
27
+ - A value can be any content, such as a `Kbd` for a shortcut.
28
+ - `total` closes a column of amounts: a firm rule above it and strong text. `tone` (`muted`, `positive`, `warn`, `danger`, `info`) colours the value on any row; a total that does not reconcile is `total tone="warn"`. Say it in words too, with a sign or "off", since colour alone does not.
29
+
30
+ ### Don't
31
+ - Do not build the rows by hand from a `Cluster`; a grid of records is a `Table`.
32
+
33
+ Rows built by hand from a `Cluster` and `Text` drift from the list's label colour and figures. Use `KeyValueList`.
34
+ ```tsx
35
+ import { Cluster, Stack, Text } from "@slashsuite/ui-react";
36
+
37
+ <Stack gap="xs">
38
+ <Cluster justify="between">
39
+ <Text as="span">Size</Text>
40
+ <Text as="span">1280×720</Text>
41
+ </Cluster>
42
+ <Cluster justify="between">
43
+ <Text as="span">Changed pixels</Text>
44
+ <Text as="span">0.4%</Text>
45
+ </Cluster>
46
+ </Stack>
47
+ ```
48
+
49
+ Long values at the default `align="end"` push against the right edge in a ragged column. Long values take `align="start"`.
50
+ ```tsx
51
+ import { KeyValue, KeyValueList } from "@slashsuite/ui-react";
52
+
53
+ <KeyValueList>
54
+ <KeyValue label="Branch">hc-145-docs-for-every-export</KeyValue>
55
+ <KeyValue label="Commit">83422a6</KeyValue>
56
+ <KeyValue label="Captured">2 min ago</KeyValue>
57
+ </KeyValueList>
58
+ ```
59
+
60
+ ### Accessibility
61
+ - `KeyValueList` is a `<dl>`; each `KeyValue` is a `<div>` holding a `<dt>` for the label and a `<dd>` for the value, so a screen reader announces them as terms and definitions.
62
+ - `id`, `data-*` and `aria-*` go on the list and on each row.
63
+
64
+ ### Props
65
+ ### KeyValueList
66
+ A definition list of label/value rows. By default each label is on the left and its value right-aligned. `align="start"` puts every value left-aligned in one column beside the labels, which are sized to the widest. While `loading` with no rows it draws three rows of bones.
67
+ - align: "end" | "start" (default end). `end` right-aligns each value; `start` puts every value left-aligned in one column beside the labels, sized to the widest.
68
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
69
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
70
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
71
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
72
+
73
+ ### KeyValue
74
+ One row of a KeyValueList: a label on the left, a tabular value on the right (or beside it, in an `align="start"` list). `total` makes it the sum row: a rule above, strong text. `tone` colours the value, on any row: a total that does not reconcile is `total tone="warn"`. While `loading`, a label or value not here yet is a bone.
75
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
76
+ - label: ReactNode (required). The term, on the left.
77
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
78
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
79
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
80
+ - tone: "neutral" | "info" | "positive" | "warn" | "danger" | "muted" | "accent". The meaning of the value, in the colours of a `Table` cell's `tone` (`TextTone`; `neutral`, the default, is the list's ink); the label keeps its ink. Colour alone does not say it, so the value or the label says it too: a sign, a word.
81
+ - total: boolean (default false). The sum the rows above add up to: a firm rule above it and the label and value in strong ink.