@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,62 @@
1
+ ## Breadcrumbs
2
+
3
+ Group: Navigation
4
+
5
+ When to use: A page several levels deep that needs a way back up: org, project, build, snapshot.
6
+
7
+ ### The one right way
8
+ A parent crumb is `{ label, href }` and the last is plain text: the trail that leads back up, ending at the current page.
9
+ ```tsx
10
+ import { Breadcrumbs } from "@slashsuite/ui-react";
11
+
12
+ <Breadcrumbs
13
+ items={[
14
+ { label: "Projects", href: "#projects" },
15
+ { label: "Launch film", href: "#launch-film" },
16
+ "Shots",
17
+ ]}
18
+ />
19
+ ```
20
+
21
+ ### Do
22
+ - Give the trail in order, parents first. A parent that links is `{ label, href }`, drawn through the app's `LinkProvider` for an in-app path; the last crumb is the current page, plain text.
23
+ - Breadcrumbs show a hierarchy. Peer sections are `Tabs` of links.
24
+ - Each crumb truncates, so a long name does not widen the row.
25
+ - Put the trail in the `breadcrumbs` slot of a `PageHeader`.
26
+
27
+ ### Don't
28
+ Parents given as plain text look like the trail but lead nowhere, so a reader cannot go back up.
29
+ ```tsx
30
+ import { Breadcrumbs } from "@slashsuite/ui-react";
31
+
32
+ <Breadcrumbs items={["Projects", "Launch film", "Shots"]} />
33
+
34
+ ```
35
+
36
+ Siblings are not a hierarchy: switching between peer sections is `Tabs` of links.
37
+ ```tsx
38
+ import { Breadcrumbs } from "@slashsuite/ui-react";
39
+
40
+ <Breadcrumbs
41
+ items={[
42
+ { label: "Quotes", href: "#quotes" },
43
+ { label: "Invoices", href: "#invoices" },
44
+ "Receipts",
45
+ ]}
46
+ />
47
+ ```
48
+
49
+ ### Accessibility
50
+ - `<nav aria-label="Breadcrumb">` around an ordered list.
51
+ - The last item has `aria-current="page"` and is never a link.
52
+ - The `/` separators are `aria-hidden`.
53
+
54
+ ### Props
55
+ ### Breadcrumbs
56
+ `org / project / build / snapshot`: each crumb truncates, and the last is the current page. A crumb is a node, or a `Crumb` object when it links.
57
+ - 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 and never a link.
59
+ - label: string (default Breadcrumb). The trail's accessible name, on its `<nav>`, for an app in another language.
60
+
61
+ ### 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 and is never a link.
@@ -0,0 +1,54 @@
1
+ ## BulletList
2
+
3
+ Group: Text
4
+
5
+ When to use: Items that read as a list of points: what changed, what to bring.
6
+
7
+ ### Use instead
8
+ - Steps (steps.md): The items are a sequence the reader follows in order.
9
+ - Timeline (timeline.md): The items are a history, each with when it happened.
10
+
11
+ ### The one right way
12
+ A list is a `BulletList` of `BulletItem`s: the list owns the discs, the indent and the gap.
13
+ ```tsx
14
+ import { BulletItem, BulletList } from "@slashsuite/ui-react";
15
+
16
+ <BulletList>
17
+ <BulletItem>Moved the nightly build from cron to a queue.</BulletItem>
18
+ <BulletItem>Cut the cold start from nine seconds to two.</BulletItem>
19
+ <BulletItem>Wrote the runbook the team still uses.</BulletItem>
20
+ </BulletList>
21
+ ```
22
+
23
+ ### Do
24
+ - Give a `BulletList` `BulletItem` children: each is an `<li>` in the body text.
25
+ - Steps a reader follows in order are a `BulletList ordered`: a numbered `<ol>` with the same indent and gap.
26
+ - Items that have a label and a value are a `KeyValueList`; a list of records is a `Table` or a `ListRow`.
27
+
28
+ ### Don't
29
+ - Never type a hyphen into a paragraph to make a list.
30
+
31
+ Hyphens typed into paragraphs are not a list: no discs, no indent and no list for a screen reader.
32
+ ```tsx
33
+ import { Stack, Text } from "@slashsuite/ui-react";
34
+
35
+ <Stack gap="xs">
36
+ <Text>- Moved the nightly build from cron to a queue.</Text>
37
+ <Text>- Cut the cold start from nine seconds to two.</Text>
38
+ <Text>- Wrote the runbook the team still uses.</Text>
39
+ </Stack>
40
+ ```
41
+
42
+ ### Accessibility
43
+ - A `BulletList` renders a `<ul>` (an `<ol>` with `ordered`), so a screen reader announces a list and the number of items.
44
+ - `id`, `aria-*` and `data-*` go on the list, or on one item.
45
+
46
+ ### Props
47
+ ### BulletList
48
+ A bulleted `<ul>`: discs, indented, a small gap between items. `ordered` makes it a numbered `<ol>` (steps a reader follows in order), with the same indent and gap. Its children are `BulletItem`s.
49
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
50
+ - ordered: boolean (default false). A numbered `<ol>` instead of the bulleted `<ul>`, for items whose order matters.
51
+
52
+ ### BulletItem
53
+ One item of a `BulletList`: an `<li>` in the body text's size and ink (the long-form scale inside a `Prose`). A long unbroken string (a URL, a token) breaks at the edge instead of overflowing.
54
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
@@ -0,0 +1,135 @@
1
+ ## Button
2
+
3
+ Group: Actions
4
+
5
+ When to use: An action that changes something in place: save, cancel, delete, retry.
6
+
7
+ ### Use instead
8
+ - Fieldset (fieldset.md): Toggles that filter a list: a `Fieldset` round a `ButtonGroup` of pressed `Button`s, one per facet.
9
+ - TextLink (text-link.md): The link is a destination in running text.
10
+
11
+ ### The one right way
12
+ One primary action per view: the quieter variants carry the rest.
13
+ ```tsx
14
+ import { Button, ButtonGroup } from "@slashsuite/ui-react";
15
+
16
+ <ButtonGroup>
17
+ <Button>Save</Button>
18
+ <Button variant="outline">Cancel</Button>
19
+ </ButtonGroup>
20
+ ```
21
+
22
+ ### Do
23
+ - Put one primary Button in a view. The other actions use `variant="outline"`, `"ghost"` or `"link"`; `variant="dashed"` is the full-width "add another" row at the foot of a list.
24
+ - Group the actions in a `ButtonGroup`, so the row spaces and wraps the same everywhere; `end` pushes one item, such as a Back link, to the far side, and `label` names the group.
25
+ - Say why a button cannot be pressed with `disabledReason`; use `busy` while the work is in flight.
26
+ - Going to another page is a `Button` with `href`: a real `<a>` with the same look, drawn by the app's router link through `LinkProvider`.
27
+ - A destructive action is `tone="danger"`, an accept is `tone="positive"`; `size="sm"` is for a button inside a row or a card header, `size="lg"` for the one action of a hero or a sign-in form.
28
+ - `pressed` makes a toggle. `busy` disables it while the work is in flight, and `busy="Saving"` also shows that label: one prop, `busy={saving && "Saving"}`.
29
+ - An icon-only action is an `IconButton`, not a Button holding a glyph.
30
+ - `variant="link"` is only for a `<button>`, an action, that sits in running text. A destination in text is a `TextLink`, and one that must look like a button is a `Button` with `href`.
31
+
32
+ ### Don't
33
+ Two primaries compete for the eye, and nobody can tell which action the view is about.
34
+ ```tsx
35
+ import { Button, ButtonGroup } from "@slashsuite/ui-react";
36
+
37
+ <ButtonGroup>
38
+ <Button>Save</Button>
39
+ <Button>Save and close</Button>
40
+ </ButtonGroup>
41
+ ```
42
+
43
+ A bare `disabled` leaves the user guessing why nothing happens.
44
+ ```tsx
45
+ import { Button } from "@slashsuite/ui-react";
46
+
47
+ <Button disabled>Save</Button>
48
+
49
+ ```
50
+
51
+ A button that sets `location` loses middle-click, the status-bar URL and crawlability.
52
+ ```tsx
53
+ import { Button } from "@slashsuite/ui-react";
54
+
55
+ <Button variant="outline" onClick={() => location.assign("#quotes")}>
56
+ Open quotes
57
+ </Button>
58
+ ```
59
+
60
+ A delete in the primary look reads as the safe, expected action; the tone is what warns.
61
+ ```tsx
62
+ import { Button, ButtonGroup } from "@slashsuite/ui-react";
63
+
64
+ <ButtonGroup>
65
+ <Button>Delete quote</Button>
66
+ <Button variant="outline">Cancel</Button>
67
+ </ButtonGroup>
68
+ ```
69
+
70
+ Buttons loose in a div have no gap, do not wrap as one row, and the group has no name.
71
+ ```tsx
72
+ import { Button } from "@slashsuite/ui-react";
73
+
74
+ <div>
75
+ <Button>Save</Button>
76
+ <Button variant="outline">Preview</Button>
77
+ <Button href="#quotes" variant="ghost">
78
+ Back
79
+ </Button>
80
+ </div>
81
+ ```
82
+
83
+ ### Accessibility
84
+ - A Button is a native `<button>` and defaults to `type="button"`, so it never submits a form by accident.
85
+ - `disabledReason` blocks the button with `aria-disabled` and keeps it in the tab order, so a keyboard reaches it; a click, Enter and Space do nothing, and the reason shows as a tooltip on hover, keyboard focus and a tap, read out as the button's description. In a browser without CSS anchor positioning the reason is its native `title`.
86
+ - `busy` sets `aria-busy` and disables the button until the work is done.
87
+ - Every Button has a focus ring from the component, so the keyboard focus is always visible.
88
+ - The `count` chip is part of the button's name: `Splits, 3` (a `count` of 0 is shown as `Splits, 0`). Pass `aria-expanded` on a button that opens something, so a screen reader hears whether it is open.
89
+
90
+ ### Props
91
+ ### Button
92
+ A button in the primary, outline, ghost, link or dashed style (the link has no box: text with an underline on hover, for an in-line action; `dashed` is the full-width "add" row, a dashed outline with muted text that fills its container). `icon` puts an `Icon` before the label. `size="sm"` is compact and `size="lg"` larger, `size={{ base: "md", md: "lg" }}` changes at 48rem, and with no `size` it takes its container's; `tone="positive"` is green and `tone="danger"` is red; `pressed` makes it a toggle: neutral when off, the tone's fill when on. `count` puts a small number chip after the label; the chip is part of the name, and a button that opens something also takes `aria-expanded`. Defaults to `type="button"`. `disabledReason` and `busy` are the two disabled states that say more than a plain `disabled`, which keeps its half-opacity look; `busy="Saving"` also swaps the label. `ref` reaches the `<button>` or the `<a>`. `href` makes it a link instead, with the same look (the app's router link through `LinkProvider` for an in-app path, else a plain `<a>`; `external` opens a new tab).
93
+ - busy: string | boolean. The work is in flight: disabled, `aria-busy`, keeps its colour. Wins over `disabledReason`. A
94
+ string is also the label while busy, in place of the children: `busy={saving && "Saving"}`.
95
+ - count: number. A small number in a chip after the label: how many are behind the button (the splits a row
96
+ has, the comments on a thread). It is part of the button's name, "Splits, 3", and `0` is
97
+ shown. For a button that opens something, also pass `aria-expanded`.
98
+
99
+ Pass `aria-controls` for what it opens too; the caller owns that state.
100
+ - disabled: boolean (native). Disables the button; say why with `disabledReason` instead where there is a reason.
101
+ - disabledReason: string. Why the button cannot be pressed: greys it flat and blocks it (`aria-disabled`, its click,
102
+ Enter and Space do nothing) while it stays in the tab order, and shows the reason as its
103
+ tooltip on hover, keyboard focus and a tap, read out as its description.
104
+ - external: boolean. Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
105
+ - href: string. Makes the button a link to this URL; an in-app path goes through the app's `LinkProvider`.
106
+ - icon: "page" | "grid" | "search" | "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.
107
+ - pressed: boolean. A toggle: sets `aria-pressed`. On `outline` and `ghost`, `false` draws the neutral off look
108
+ and `true` the tone's primary fill, so a row of filter chips shows the selected one plainly.
109
+ Left out, the button is not a toggle, has no `aria-pressed` and keeps its variant's look.
110
+ - ref: ((instance: HTMLButtonElement | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<HTMLButtonElement | null> | ((instance: HTMLAnchorElement | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<...> | null. Reaches the `<button>`, or the `<a>` of a link button, to focus it or measure it.
111
+ - size: Size | ResponsiveSize (default md). `sm` is compact, for table rows and toolbars; `lg` is larger, for a hero call to action. Left
112
+ out, a Button takes the size of the `Card`, `ListRow` or `Table` it sits in, else `md`.
113
+ `{ base: "md", md: "lg" }` changes size at the `md` breakpoint (48rem), in CSS: `md` on a phone,
114
+ `lg` from 48rem up.
115
+
116
+ The first load paints the right size. Give every control in the row the same value, so it stays
117
+ aligned.
118
+ - tone: "neutral" | "positive" | "danger" (default neutral). `positive` is green, for accept and approve; `danger` is red, for delete and clear. Not for
119
+ `dashed`, which has the one look.
120
+ - type: string (native). `"button"` by default; `"submit"` submits the form the button is in.
121
+ - variant: "link" | "primary" | "outline" | "ghost" | "dashed" (default primary). `primary` is filled, for the one main action; `outline` and `ghost` are quieter; `link` is
122
+ text with an underline on hover; `dashed` is an "add another" row that fills its container.
123
+
124
+ ### ButtonGroup
125
+ A wrapping row of buttons with one optional item pushed to the far end (a Back link, say). On a narrow viewport the row wraps and `end` stays at the end of the last line. `label` makes it a named `role="group"`. Directly in a `Card` footer it spans the footer, so `end` reaches the far edge.
126
+ - end: ReactNode. One item, pushed to the end of the row.
127
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
128
+ - label: string. The accessible name of the group: sets `role="group"` and `aria-label`.
129
+
130
+ ### Types
131
+ - ButtonSize: `"sm" | "md" | "lg"`. A Button's height and text, on the library's one `Size` scale.
132
+ - ButtonTone: `"neutral" | "positive" | "danger"`. A Button's tones: `neutral` (the accent fill, the default), `positive` and `danger`.
133
+ - ButtonVariant: `"primary" | "outline" | "ghost" | "link" | "dashed"`. A Button's look: `primary` the one main action, `outline` and `ghost` the others, `link` text in running text, `dashed` the add-another row.
134
+ - ResponsiveSize: `{ base: Size; md: Size }`. A size that changes with the screen: `base` at every width, `md` from Tailwind's `md` breakpoint (48rem) up. Done in CSS, so a server-rendered page paints the right size on its first load.
135
+ - Size: `"sm" | "md" | "lg"`. The one size scale of the library: `sm`, `md` and `lg`, with `md` the default. This is the one list of where it goes further and where the default is not `md`; the README and the docs point here rather than count them again. Past `sm`, `md` and `lg`, only where there is a real use, and no scale skips `md`: - `Avatar` and `AvatarStack` `size`: also `xs`, `xl`, `2xl` and `3xl`. - The gap scale (`Stack`, `Section` and `ProseLayout` `gap`): also `xs` and `xl`. - `Cluster` and `ScrollStrip` `gap`: `xs`, `sm` and `md`, the first steps of the gap scale. - `Icon` `size`: also `feature`, the mark of a feature card. - `Dialog` `width`: also `full`, the whole screen. `ChatThread` `height`: also `fill`, its parent's. 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`.
@@ -0,0 +1,86 @@
1
+ ## Callout
2
+
3
+ Group: Feedback
4
+
5
+ When to use: A message the reader should see in the page, without being made to answer it.
6
+
7
+ ### Use instead
8
+ - Card (card.md): A block of content has a status: a `Card` with `tone`.
9
+ - EmptyState (empty-state.md): There is nothing here yet, and the message offers the first step.
10
+ - Status pages (status-pages.md): The whole route cannot show: not found, failed, offline, down or not allowed.
11
+
12
+ ### The one right way
13
+ The tone matches how much the message matters: `warn` for a thing to check before going on.
14
+ ```tsx
15
+ import { Callout, Stack } from "@slashsuite/ui-react";
16
+
17
+ <Stack gap="sm">
18
+ <Callout tone="info">The import runs overnight.</Callout>
19
+ <Callout tone="warn" title="3 uncategorised.">
20
+ Sort them before the month closes.
21
+ </Callout>
22
+ </Stack>
23
+ ```
24
+
25
+ ### Do
26
+ - Pick the `tone` by how much the message matters: `neutral` (the default) for a note, `info` for something worth knowing, `positive` for a result, `warn` for a thing to check before going on, `danger` for a failure or something that cannot be undone. Keep `danger` for the real failure.
27
+ - Add a `title` for a short bold lead-in; the body carries the detail.
28
+ - Put the one action in `actions`, at the end of the row: a `Button size="sm"` or a `TextLink stretch`, which makes the whole callout the click target.
29
+ - `banner` is the flat strip at the top of a `Card flush`; do not use it anywhere else. In a page's column (a `FullBleedLayout`, padded or not) the notice is a plain Callout, first in the column's `Stack`.
30
+ - A section that failed to load is a `Callout tone="danger"` with a `title` that says what failed and one `Button` in `actions` that tries again. A whole page that failed is an `ErrorPage`.
31
+ - A block of content that has a status is a `Card` with `tone`; a Callout is the message.
32
+ - A short confirmation that should not move the page ("Saved", "Copied") is a `Toast`. A message that must be answered before the reader goes on is a `Dialog`; a field's own error is the `error` of its `Field`; a submit's failure in a `Dialog` or `FormLayout` is its `error`.
33
+ - `align="center"` centres the title and body, for a success that stands alone; with `actions` only the text is centred. `start` is the default.
34
+
35
+ ### Don't
36
+ `danger` on a plain note cries wolf: when everything is red, a real failure no longer stands out.
37
+ ```tsx
38
+ import { Callout, Stack } from "@slashsuite/ui-react";
39
+
40
+ <Stack gap="sm">
41
+ <Callout tone="danger">The import runs overnight.</Callout>
42
+ <Callout tone="danger" title="3 uncategorised.">
43
+ Sort them before the month closes.
44
+ </Callout>
45
+ </Stack>
46
+ ```
47
+
48
+ A button inside the body drops under the text and leaves the row without its action.
49
+ ```tsx
50
+ import { Button, Callout } from "@slashsuite/ui-react";
51
+
52
+ <Callout tone="warn" title="Import failed.">
53
+ The last file did not finish. <Button size="sm">Retry</Button>
54
+ </Callout>
55
+ ```
56
+
57
+ A whole error page inside one section takes over the screen for a part that failed.
58
+ ```tsx
59
+ import { ErrorPage, Section } from "@slashsuite/ui-react";
60
+
61
+ <Section title="Recent builds">
62
+ <ErrorPage />
63
+ </Section>
64
+ ```
65
+
66
+ ### Accessibility
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
+ - A `title` is a bold paragraph, not a heading, so it adds nothing to the heading outline.
69
+ - Buttons and links in `actions` keep their own focus ring and keyboard behaviour.
70
+
71
+ ### Props
72
+ ### 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; `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.
74
+ - actions: ReactNode. A button or link at the end of the row, beside the title and body.
75
+ - align: "center" | "start" (default start). `center` centres the title and body, for a success that stands alone. With
76
+ `actions` only the text is centred.
77
+ - 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
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
80
+ - title: ReactNode. A bold line above the body.
81
+ - tone: "neutral" | "info" | "positive" | "warn" | "danger" (default neutral). What the notice means: `neutral` a plain note, `info` something worth knowing, `positive` a
82
+ result, `warn` a thing to check before going on, `danger` a failure or something that cannot
83
+ be undone.
84
+
85
+ ### Types
86
+ - Tone: `"neutral" | "info" | "positive" | "warn" | "danger"`. The one tone vocabulary of the library: what a thing means, not what colour it is. `neutral` (no meaning, the role's own ink or surface) is every component's default, `info` is a note, `positive` a success, `warn` a caution and `danger` an error or a destructive act. A component extends it outward only where it has a real use, and says so beside its own type: the text roles add `muted` (a quieter line) and `accent` (the theme's accent ink), `Pill` and the charts add `accent` for a category that is none of the five meanings. No component renames a tone (`negative`, `default`, `slate` and the colour names are gone), and no scale skips `neutral`.
@@ -0,0 +1,108 @@
1
+ ## CardGrid
2
+
3
+ Group: Layout
4
+
5
+ When to use: Several cards or `StatTile`s of the same weight that should sit side by side on a wide screen.
6
+
7
+ ### The one right way
8
+ Tiles go in a `CardGrid`: one column on a phone, two from `sm`, `columns` from `lg`.
9
+ ```tsx
10
+ import { CardGrid, StatTile } from "@slashsuite/ui-react";
11
+
12
+ <CardGrid columns={3}>
13
+ <StatTile label="Open" value="12" />
14
+ <StatTile label="Won" value="8" tone="positive" />
15
+ <StatTile label="Lost" value="3" tone="danger" />
16
+ </CardGrid>
17
+ ```
18
+
19
+ ### Full page
20
+ A whole dashboard page: the shell with its brand and nav, then a `PageHeader` and a `CardGrid` of tiles.
21
+ ```tsx
22
+ import {
23
+ AppShell,
24
+ CardGrid,
25
+ Tabs,
26
+ PageHeader,
27
+ Stack,
28
+ StatTile,
29
+ } from "@slashsuite/ui-react";
30
+
31
+ <AppShell
32
+ brand={<a href="#">Hack Cove</a>}
33
+ nav={
34
+ <Tabs
35
+ label="Main"
36
+ items={[
37
+ { label: "Quotes", href: "#quotes", selected: true },
38
+ { label: "Clients", href: "#clients" },
39
+ ]}
40
+ />
41
+ }
42
+ >
43
+ <Stack gap="xl">
44
+ <PageHeader title="Business" description="This month at a glance." />
45
+ <CardGrid columns={3}>
46
+ <StatTile label="Open" value="12" />
47
+ <StatTile label="Won" value="8" tone="positive" />
48
+ <StatTile label="Lost" value="3" tone="danger" />
49
+ </CardGrid>
50
+ </Stack>
51
+ </AppShell>
52
+ ```
53
+
54
+ ### Do
55
+ - Use `columns` 2, 3 or 4 when you know how many; it is one column on a phone, two from `sm` and `columns` from `lg`.
56
+ - Use `columns="auto"` when the count varies: it fits as many per row as the width allows, none narrower than `minWidth` (`md`, the default, or `sm`).
57
+ - Every tile in a `CardGrid` is one width. A main card beside a narrower one is a `SideColumn` (`asideWidth="third"` for two thirds and one third), not a grid.
58
+ - `align="start"` keeps each card its own height; by default every card stretches to the tallest in its row.
59
+ - `CardGrid` goes inside a page layout; it sets no page width of its own.
60
+ - A single column of blocks is a `Stack`, not a one-column `CardGrid`.
61
+ - `as="ul"` makes the grid a list and wraps each child in a list item, for a set of like tiles a screen reader should count. The look is the same.
62
+ - `empty` is an `EmptyState`, drawn in place of the grid when it has no children.
63
+
64
+ ### Don't
65
+ A `Stack` is one column, so the tiles never sit side by side and the page runs long. Use a `CardGrid`.
66
+ ```tsx
67
+ import { Stack, StatTile } from "@slashsuite/ui-react";
68
+
69
+ <Stack>
70
+ <StatTile label="Open" value="12" />
71
+ <StatTile label="Won" value="8" tone="positive" />
72
+ <StatTile label="Lost" value="3" tone="danger" />
73
+ </Stack>
74
+ ```
75
+
76
+ A fixed `columns={4}` for a count that varies leaves the row part empty when there are three. When the count varies, use `columns="auto"`.
77
+ ```tsx
78
+ import { Card, CardGrid, Text } from "@slashsuite/ui-react";
79
+
80
+ <CardGrid columns={4} align="start">
81
+ <Card title="Dashboard">
82
+ <Text>Quotes and renewals this week.</Text>
83
+ </Card>
84
+ <Card title="Billing">
85
+ <Text>Invoices and payments.</Text>
86
+ </Card>
87
+ <Card title="Members">
88
+ <Text>Who can sign in.</Text>
89
+ </Card>
90
+ </CardGrid>
91
+ ```
92
+
93
+ ### Accessibility
94
+ - The grid is a plain `div` with no role: the cards keep their own order and semantics. With `as="ul"` it is a list, and each child is a list item.
95
+ - The order is the DOM order, so the tab order follows the reading order.
96
+
97
+ ### Props
98
+ ### CardGrid
99
+ A responsive grid of tiles of one width: one column on a phone, two from `sm`, `columns` from `lg`. A main area beside a narrower one is not a grid of tiles: it is `SideColumn` (`asideWidth="third"` for two thirds and one). `columns="auto"` instead fits as many per row as the width allows, each at least `minWidth` wide: `md` (17rem, the default) or `sm` (12rem). `align="start"` keeps each card its own height instead of stretching it to the tallest in its row. `as="ul"` makes it a list of cards for a screen reader: the grid is a `<ul>` and each child is wrapped in an `<li>`, still stretched. With no children it draws `empty` (an `EmptyState`) in place of the grid. While `loading` with none it draws one card of bones per column (three for `auto`), never `empty`.
100
+ - align: "start" | "stretch" (default stretch). `start` keeps each card its own height; the default stretches every card to the tallest in its row.
101
+ - as: "div" | "ul" (default div). `ul` makes the grid a list: each child is wrapped in an `<li>`. Default `div`.
102
+ - columns: "auto" | 2 | 3 | 4 (default 3). Cards per row from `lg` (one on a phone, two from `sm`), or `auto` for as many as fit.
103
+ - empty: ReactNode. Drawn in place of the grid when there are no children: an `EmptyState`.
104
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
105
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
106
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
107
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
108
+ - minWidth: "sm" | "md" (default md). With `columns="auto"`, the narrowest a card gets: `md` 17rem or `sm` 12rem.
@@ -0,0 +1,113 @@
1
+ ## Card
2
+
3
+ Group: Content
4
+
5
+ When to use: A titled block of related content: a record, a status, a list, an empty state.
6
+
7
+ ### Use instead
8
+ - Callout (callout.md): The status is a message of a line or two, with at most one action.
9
+
10
+ ### The one right way
11
+ `status` puts a Pill directly beside the title; `actions` stays at the far end.
12
+ ```tsx
13
+ import { Card, Pill, Text } from "@slashsuite/ui-react";
14
+
15
+ <Card title="PixelSlash" status={<Pill tone="warn">Coming soon</Pill>}>
16
+ <Text tone="muted">Visual review for every pull request.</Text>
17
+ </Card>
18
+ ```
19
+
20
+ ### Do
21
+ - Name the Card with `title`; add a `count` or a `status` and they sit beside the title.
22
+ - `titleStyle="name"` sets the title in sentence case and the primary ink, for a card that is a thing with a name (a shop, a listing, an event). The default `overline` is the small uppercase label of a panel (Status, Activity). Count, status, actions and `bar` work with both.
23
+ - `actions` sit at the far end of the header; use `bar` to put the header in a tinted strip.
24
+ - Space several Cards with a `Stack` or a `CardGrid`; never stack them with nothing between.
25
+ - `flush` is for a table that runs edge to edge, and it needs a `bar` for its title.
26
+ - A Card with `href` is one link; a `TextLink` or `Button` inside it sits above that link and is clickable on its own, and a click elsewhere on the card follows the link.
27
+ - `CardGrid` takes `columns` 2, 3 or 4, or `columns="auto"` with `minWidth` `sm` or `md` to fill by width; `align="start"` stops cards stretching to the tallest in their row.
28
+ - An empty state is an `EmptyState`, inside the card or on its own, where it draws its own dashed frame.
29
+
30
+ ### Don't
31
+ A hand-built title row drifts from every other Card's: use `title` and `status`.
32
+ ```tsx
33
+ import { Card, Pill, SubsectionHeading, Text } from "@slashsuite/ui-react";
34
+
35
+ <Card>
36
+ <SubsectionHeading>PixelSlash</SubsectionHeading>
37
+ <Pill tone="warn">Coming soon</Pill>
38
+ <Text tone="muted">Visual review for every pull request.</Text>
39
+ </Card>
40
+ ```
41
+
42
+ Cards with nothing between them butt together. Space them with `Stack` or `CardGrid`.
43
+ ```tsx
44
+ import { Card, Text } from "@slashsuite/ui-react";
45
+
46
+ <>
47
+ <Card title="Open" count={3}>
48
+ <Text tone="muted">Three things to do.</Text>
49
+ </Card>
50
+ <Card title="Done" count={12}>
51
+ <Text tone="muted">Twelve things finished.</Text>
52
+ </Card>
53
+ </>
54
+ ```
55
+
56
+ ### Accessibility
57
+ - A titled Card is a `<section>` named by its `title` (`aria-labelledby` points at the heading), a card with only an `aria-label` a `<section>` named by it, and any other a `<div>`; `as="article"` makes it an `article`. Your own `aria-label` or `aria-labelledby` wins. The title is an `h2` on the page and an `h3` in a `Section`; `level` sets it by hand.
58
+ - `id`, `data-*` and `aria-*` go on the root element. On a link card too: the link inside it keeps only its own `aria-label`, `aria-labelledby` and `aria-current`, and is named by the card's text.
59
+ - On a link card the `badge` is inside the link, so it is part of the link's name; on a panel it is read after the content.
60
+ - `attention` is colour only: say why in the card's title or text.
61
+ - The `icon` is decorative and `aria-hidden`: the title says what the card is.
62
+
63
+ ### Props
64
+ ### Card
65
+ A bordered panel with an optional title, count and status. A titled card is a `section` named by its title, one with only an `aria-label` a `section` too, any other a `div`, and `as="article"` makes it an `article`. Two opt-in forms for data views: `flush` drops the padding and clips the corners, for a table that runs edge to edge; `bar` puts the title, count and `actions` in a tinted strip across the top, over the body. A flush card has no padding for a `title`, so give it a `bar`. An empty state is an `EmptyState`, which draws its own dashed frame. Inside a card a `Stack` is `xs` apart, and the title's heading level is one below the heading that holds the card. `size="sm"` is the dense padding and `size="lg"` the roomy one, the same on a `ListRow` and a `FileDrop`. `tone` is the Callout's set, for a data panel that carries a status (a soft fill and border, no shadow); a message is still a `Callout`, and `bar` has no tone. A titled panel is named by its title: the root gets `aria-labelledby` pointing at the heading, unless the caller passes its own `aria-label` or `aria-labelledby`, which wins. Other props (`id`, `data-*`, `aria-*`) go on the root. The root is `relative`, so a `TextLink stretch` inside it covers the card. A card with an `id` is an anchor target: `#id` scrolls it clear of the sticky header (and a `subnav`) and outlines it in the accent colour while it is the target. `icon` is one of the library's icons at feature size in the accent colour, above the title: the mark of a feature card. It sits in the padded body, so `bar` and `flush` have none. `footer` is a tinted strip across the bottom, under a hairline, for the card's own actions or a total; in a `CardGrid` it stays at the foot of a card that is stretched to the row's height. It suits a panel, not a card that is a link. `fill` makes a panel take its parent's full height (the parent sets it): the title or bar stays put and the body scrolls. Not on a link card. `href` makes the whole card one link: a hover border and the focus ring, with the link stretched over the card, so it takes no `actions`, `footer` or `as`. A `TextLink`, `Button` or `Checkbox` in the body sits above the link and is clickable on its own. An in-app `href` is drawn by the app's router link through `LinkProvider`. `external` opens it in a new tab. On a link card `id`, `data-*` and the describing `aria-*` (`aria-describedby`, `aria-details`, …) go on the card root, not the link; the link's own `aria-label`, `aria-labelledby` and `aria-current` stay on the link. The link is named by the card's text (title, body, `badge`) through the root's id, which is generated when the caller gives none. While `loading` a card with no children draws three lines of text bones, a `flush` one three `ListRow` bones; what it has (its title, its children) draws as usual.
66
+ - actions: ReactNode. Buttons or links at the end of the header: in the strip with `bar`, else beside the title.
67
+ - as: "article". `article` for a card that stands alone as a piece of content (a post, a listing). Left out, a
68
+ titled card is a `section` named by its title, one with only an `aria-label` a `section` named
69
+ by that, and any other a `div`. Not on a card that is a link.
70
+ - attention: boolean. The warn tone's strong border in place of the card's own, for the one card in a set that needs
71
+ a look (a run that differed). It keeps the card's fill. Name why in the card too (a `Pill` in
72
+ `badge`, or the body); the border alone says nothing to a screen reader.
73
+
74
+ Add `tone="warn"` for the warn surface too.
75
+ - badge: ReactNode. A `Pill` (or any small node) pinned in the top corner at the end edge, over the content and
76
+ inside the radius, with no change to the layout. On a card that is a link it is part of the
77
+ link's name, and a link or button in it is clickable on its own.
78
+
79
+ Use it for a category (`Pill tone="info"`) or a flag on the thing itself.
80
+ - bar: boolean. Put the title, count and actions in a tinted strip above the body, edge to edge.
81
+ - count: number. A small number beside the title (how many rows the card holds). Needs a `title`.
82
+ - external: boolean. Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
83
+ - fill: boolean. Take the parent's full height: the title or bar stays put and the body scrolls. The parent sets
84
+ the height.
85
+
86
+ For a panel in a fixed-height layout, such as a sheet over a map. Put links or controls in the
87
+ body, so a keyboard can reach and scroll it.
88
+ - flush: boolean. No padding and `overflow-hidden`: the body (a table, a list) fills the card.
89
+ - footer: ReactNode. A tinted strip across the bottom of the card, under a hairline, for the card's own actions or a total. It stays at the foot when the card is stretched in a `CardGrid`.
90
+ - href: string. Makes the whole card one link to this URL, with no `actions`, `footer` or `as`; an in-app path
91
+ goes through the app's `LinkProvider`.
92
+ - 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, drawn at feature size in the accent colour above the title: the
93
+ mark of a feature card. Ignored with `bar` and `flush`.
94
+
95
+ Pick it by the idea it stands for.
96
+ - inset: ReactNode. A band across the card, edge to edge inside its padding, under the title and above the
97
+ children: a `ProgressBar` or a strip of colour that runs the card's full width.
98
+
99
+ A bordered sub-card inside a card is a nested `Card tone="neutral"`, not a hand-built box.
100
+ - level: 2 | 3 | 4 | 5 | 6 (default one below the heading that holds the card: 2 on the page, 3 in a `Section`). The title's heading level, 2 to 6. It does not change how the title looks.
101
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
102
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
103
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
104
+ - size: "sm" | "md" | "lg" (default md). `sm` is dense padding on the body, heading and bar, and makes a `Button`, `IconButton` or `Pill`
105
+ inside with no `size` of its own `sm` too; `lg` is one step roomier than `md`.
106
+
107
+ `sm` suits a dense dashboard, `lg` a card that stands alone.
108
+ - status: ReactNode. A `Pill` (or any node) directly beside the title and count, not at the far end like `actions`. Needs a `title`.
109
+ - title: string. The card's heading (a small uppercase label unless `titleStyle` says otherwise). It names the card, which is then a `section`.
110
+ - titleStyle: "name" | "overline" (default overline). How the `title` is set. `overline` is the small uppercase label of a panel; `name` is the same
111
+ heading in sentence case and the primary ink, for a card whose title is a name (a shop, a listing,
112
+ an event). Count, status, actions, `bar` and `size` work the same with both.
113
+ - tone: "neutral" | "info" | "positive" | "warn" | "danger". A soft fill and border in the Callout's tones, for a data panel with a status. Ignored with `bar`.