@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,103 @@
1
+ ## Menu
2
+
3
+ Group: Actions
4
+
5
+ When to use: A row, card or header with more actions than fit: put the one main action in view and the rest in a Menu.
6
+
7
+ ### The one right way
8
+ A row's secondary actions in one `Menu`, beside its one visible action.
9
+ ```tsx
10
+ import { Button, Card, ListRow, Menu } from "@slashsuite/ui-react";
11
+
12
+ <Card flush>
13
+ <ListRow
14
+ size="sm"
15
+ actions={
16
+ <>
17
+ <Button size="sm" variant="outline">
18
+ Reply
19
+ </Button>
20
+ <Menu
21
+ size="sm"
22
+ label="More actions"
23
+ items={[
24
+ { label: "Favourite", icon: "plus", onSelect: () => undefined },
25
+ { label: "Settings", icon: "settings", onSelect: () => undefined },
26
+ { label: "Hide chat", tone: "danger", onSelect: () => undefined },
27
+ ]}
28
+ />
29
+ </>
30
+ }
31
+ >
32
+ Ada Lovelace
33
+ </ListRow>
34
+ </Card>
35
+ ```
36
+
37
+ ### Do
38
+ - Keep the one main action in view as a `Button` and put the rest in one `Menu` beside it; a row of several icon buttons is a `Menu`.
39
+ - `items` is data: each a `label` with `onSelect`, or a link with `href` (through the app's `LinkProvider`; `external` opens a new tab). `icon` adds a leading glyph from the `Icon` set and `disabled` dims one.
40
+ - A destructive item is `tone="danger"` and goes last, so it is never the first thing the arrows reach.
41
+ - The default trigger is a ghost three-dot button named by `label`; `trigger="button"` is an outline button reading `label`, for a menu whose name is worth a word ("Export"). `size="sm"` inside a row or a card header.
42
+ - In a `ListRow` with `revealOnHover`, the row keeps its actions shown while the menu is open.
43
+
44
+ ### Don't
45
+ - Never put the only action of a row in a `Menu`: one action is a `Button` or an `IconButton`.
46
+ - Do not hide a reason in the menu: an item that cannot be chosen says why in its label or on the page.
47
+
48
+ Four ghost buttons in a row crowd it, and every one of them is a tab stop.
49
+ ```tsx
50
+ import { Card, IconButton, ListRow } from "@slashsuite/ui-react";
51
+
52
+ <Card flush>
53
+ <ListRow
54
+ size="sm"
55
+ actions={
56
+ <>
57
+ <IconButton size="sm" variant="ghost" label="Reply" icon="chevron-right" />
58
+ <IconButton size="sm" variant="ghost" label="Favourite" icon="plus" />
59
+ <IconButton size="sm" variant="ghost" label="Settings" icon="settings" />
60
+ <IconButton size="sm" variant="ghost" tone="danger" label="Hide chat" icon="close" />
61
+ </>
62
+ }
63
+ >
64
+ Ada Lovelace
65
+ </ListRow>
66
+ </Card>
67
+ ```
68
+
69
+ A red item first is the one a quick Enter chooses.
70
+ ```tsx
71
+ import { Menu } from "@slashsuite/ui-react";
72
+
73
+ <Menu
74
+ label="More actions"
75
+ defaultOpen
76
+ items={[
77
+ { label: "Hide chat", tone: "danger", onSelect: () => undefined },
78
+ { label: "Favourite", icon: "plus", onSelect: () => undefined },
79
+ { label: "Settings", icon: "settings", onSelect: () => undefined },
80
+ ]}
81
+ />
82
+ ```
83
+
84
+ ### Accessibility
85
+ - The trigger is a button with `aria-haspopup` and `aria-expanded`, named by `label`; the menu takes the same name.
86
+ - Enter, Space or ArrowDown open it on the first item, ArrowUp on the last; the arrows, Home, End and a typed letter move; Enter chooses; Escape closes it, and focus goes back to the trigger.
87
+ - A link item is a real link with `role="menuitem"`; a disabled item is skipped by the arrows.
88
+ - Inside a `Dialog` the menu opens in the dialog, so it is not inert, and Escape closes only the menu.
89
+
90
+ ### Props
91
+ ### Menu
92
+ A button that opens a short list of actions: the overflow menu at the end of a row, a card header or a page header. Keep the one main action in view beside it and put the rest here, the `danger` one last. `items` are data: each a `label` with `onSelect`, or a link with `href` (`external` for a new tab), an optional leading `icon`, `tone="danger"` and `disabled`. `trigger="icon"` (the default) is a ghost three-dot button named by `label`; `trigger="button"` is an outline button reading `label`. The menu opens below the trigger, aligned to its end, and flips when there is no room. The keyboard is the menu button pattern: Enter, Space or ArrowDown open it on the first item, ArrowUp on the last; the arrows, Home, End and a letter move; Enter chooses; Escape closes, and focus goes back to the trigger. `data-*` and `aria-*` land on the trigger.
93
+ - defaultOpen: boolean (default false). Opens on mount, for a story or a test that shows the open menu.
94
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
95
+ - items: readonly [MenuAction, ...MenuAction[]] (required). The actions, in order.
96
+ - label: string (required). The trigger's accessible name and the menu's. With `trigger="button"` it is the visible text.
97
+ - size: "sm" | "md" | "lg" (default md). The trigger's height, the same steps as `IconButton` and `Button`: `sm` inside a row or a card
98
+ header. The menu's own text does not change with it.
99
+ - trigger: "button" | "icon" (default icon). `icon` is a ghost square button holding three dots, the overflow menu; `button` is an outline
100
+ `Button` with `label` as its text and a chevron after it, for a menu whose name is worth a word.
101
+
102
+ ### Types
103
+ - MenuAction: `{ label: string; icon?: IconName | undefined; tone?: IconButtonTone | undefined; disabled?: boolean | undefined; } & ({ onSelect: () => void; href?: undefined; external?: undefined; } | { onSelect?: undefined; href: string; external?: boolean | undefined; })`. One entry of a `Menu`: an action that runs `onSelect`, or a link to `href`. Never both.
@@ -0,0 +1,69 @@
1
+ ## MetaList
2
+
3
+ Group: Text
4
+
5
+ When to use: The facts about a record under its title (branch, SHA, date), or a footer's row of links (Privacy, Terms, Contact).
6
+
7
+ ### Use instead
8
+ - Table (table.md): Many records with the same columns, to read across and compare.
9
+ - KeyValueList (key-value-list.md): One record's fields, one per line, each label beside its value.
10
+ - ListRow (list-row.md): Each item is a thing to open, on a row of its own.
11
+
12
+ ### The one right way
13
+ A row of facts is a `MetaList`; an item is text, a `Code` or a `TextLink`.
14
+ ```tsx
15
+ import { Code, MetaList, TextLink } from "@slashsuite/ui-react";
16
+
17
+ <MetaList>
18
+ <TextLink href="#hc-145">hc-145</TextLink>
19
+ <Code>0f9d376</Code>
20
+ <span>26 Oct 2026</span>
21
+ </MetaList>
22
+ ```
23
+
24
+ ### Do
25
+ - Each child is one item: text, a `Code` or a `TextLink`.
26
+ - `separator` is `·` (default), `•` or `none`.
27
+ - An item never breaks inside itself; the row wraps between items.
28
+ - `mono` sets the whole row in the monospace face, for ids and paths.
29
+ - A labelled fact is a `KeyValueList`.
30
+
31
+ ### Don't
32
+ - Never type the separators yourself: a wrap can leave one at the start of a line, and a screen reader reads them.
33
+
34
+ Dots typed into one string are one item to a screen reader and can wrap onto the end of a line.
35
+ ```tsx
36
+ import { Caption } from "@slashsuite/ui-react";
37
+
38
+ <Caption>hc-145 · 0f9d376 · 26 Oct 2026</Caption>
39
+
40
+ ```
41
+
42
+ Separators typed by hand are read aloud and can wrap onto the end of a line.
43
+ ```tsx
44
+ import { Prose, TextLink } from "@slashsuite/ui-react";
45
+
46
+ <Prose as="p">
47
+ <TextLink href="#privacy">Privacy</TextLink> | <TextLink href="#terms">Terms</TextLink> |{" "}
48
+ <TextLink href="#contact">Contact</TextLink>
49
+ </Prose>
50
+ ```
51
+
52
+ ### Accessibility
53
+ - A `MetaList` renders a `<ul>` with an `<li>` per item.
54
+ - The separators are `aria-hidden` and trail every item but the last, held to their item like a comma, so a wrap never leaves one at the start of a line.
55
+ - Each link keeps its own focus ring; the row adds no extra tab stop.
56
+ - `aria-*` and `data-*` go on the list.
57
+
58
+ ### Props
59
+ ### MetaList
60
+ A wrapping row of facts or links in muted small text, joined by a `·`: branch · SHA · date, or a footer's Privacy · Terms · Email. An item is text, a `Code` or a `TextLink`. The separator is `aria-hidden` and trails each item but the last, held to its item like a comma, so a wrap leaves it at the end of a line and never at the start; `separator` swaps it for a `•` or none. An item never breaks inside itself: the row wraps between items. `mono` sets the whole row in the monospace face, for ids and paths. While `loading` with no items it draws three word-sized bones.
61
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
62
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
63
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
64
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
65
+ - mono: boolean (default false). The whole row in the monospace face, for ids and paths.
66
+ - separator: "none" | "·" | "•" (default ·). The mark between items: `·`, `•`, or `none` for a gap alone.
67
+
68
+ ### Types
69
+ - MetaListSeparator: `"none" | "·" | "•"`. The mark between MetaList items: `·`, `•`, or `none` for a gap alone.
@@ -0,0 +1,128 @@
1
+ ## Morph
2
+
3
+ Group: Feedback
4
+
5
+ When to use: A card or thumbnail that opens into its own page, where the reader should see the one become the other.
6
+
7
+ ### The one right way
8
+ Each card's `item` is its shop's id, so only the pressed card has a partner on the next page and it morphs.
9
+ ```tsx
10
+ import { useState } from "react";
11
+ import { Button, Card, CardGrid, Morph, startPageTransition } from "@slashsuite/ui-react";
12
+
13
+ function Example() {
14
+ const [open, setOpen] = useState<string | undefined>(undefined);
15
+ const letters = ["A", "B"];
16
+ return open ? (
17
+ <Morph name="shop-do" item={open}>
18
+ <Card title={`Shop ${open}`} size="lg">
19
+ <Button variant="outline" onClick={() => startPageTransition(() => setOpen(undefined))}>
20
+ Back
21
+ </Button>
22
+ </Card>
23
+ </Morph>
24
+ ) : (
25
+ <CardGrid columns={2}>
26
+ {letters.map((shop) => (
27
+ <Morph key={shop} name="shop-do" item={shop}>
28
+ <Card title={`Shop ${shop}`}>
29
+ <Button variant="outline" onClick={() => startPageTransition(() => setOpen(shop))}>
30
+ Open Shop {shop}
31
+ </Button>
32
+ </Card>
33
+ </Morph>
34
+ ))}
35
+ </CardGrid>
36
+ );
37
+ }
38
+ ```
39
+
40
+ ### Do
41
+ - Wrap the card in the grid and the element on the detail page, each with the same `name` and the record's id as `item`: `<Morph name="shop" item={shop.id}>`.
42
+ - The same `name` and `item` may appear only once on a page. Two on one page and the browser skips the morph, so a list passes each record's own id.
43
+ - Start the change inside a view transition: `startPageTransition(() => setOpen(id))` for a state change, or the router's own option (TanStack Router `defaultViewTransition: true` on `createRouter`, or `viewTransition` on a `Link`; React Router's `viewTransition`, Astro's `ClientRouter`). Without one nothing morphs.
44
+ - The destination's Morph must be in the page when the navigation lands: a route that shows a pending component first has nothing to morph into.
45
+ - Inside a `PageFade` the rest of the page cross-fades while the card morphs over it.
46
+ - Portal an overlay such as a dropdown to the body: the morphing element is a stacking context, so an overlay inside it cannot rise above a sticky header outside it.
47
+ - A Morph far below the fold carries no transition name until it scrolls near, so a long list costs only what is on screen.
48
+ - With TanStack Router, call `refreshMorphs()` after it restores scroll: `router.subscribe("onRendered", () => refreshMorphs())`, after `createRouter`. Its restore lands after the render, so without the call the card scrolled back on screen is not named and Back does not shrink into it.
49
+
50
+ ### Don't
51
+ Every card shares one `item`, so the page holds the same name twice and the browser skips the morph.
52
+ ```tsx
53
+ import { useState } from "react";
54
+ import { Button, Card, CardGrid, Morph, startPageTransition } from "@slashsuite/ui-react";
55
+
56
+ function Example() {
57
+ const [open, setOpen] = useState<string | undefined>(undefined);
58
+ const letters = ["A", "B"];
59
+ return open ? (
60
+ <Morph name="shop-dont" item={"shop"}>
61
+ <Card title={`Shop ${open}`} size="lg">
62
+ <Button variant="outline" onClick={() => startPageTransition(() => setOpen(undefined))}>
63
+ Back
64
+ </Button>
65
+ </Card>
66
+ </Morph>
67
+ ) : (
68
+ <CardGrid columns={2}>
69
+ {letters.map((shop) => (
70
+ <Morph key={shop} name="shop-dont" item={"shop"}>
71
+ <Card title={`Shop ${shop}`}>
72
+ <Button variant="outline" onClick={() => startPageTransition(() => setOpen(shop))}>
73
+ Open Shop {shop}
74
+ </Button>
75
+ </Card>
76
+ </Morph>
77
+ ))}
78
+ </CardGrid>
79
+ );
80
+ }
81
+ ```
82
+
83
+ A plain state change swaps the page at once: there is no transition to morph.
84
+ ```tsx
85
+ import { useState } from "react";
86
+ import { Button, Card, CardGrid, Morph } from "@slashsuite/ui-react";
87
+
88
+ function Example() {
89
+ const [open, setOpen] = useState<string | undefined>(undefined);
90
+ const letters = ["A", "B"];
91
+ return open ? (
92
+ <Morph name="shop-transition-dont" item={open}>
93
+ <Card title={`Shop ${open}`} size="lg">
94
+ <Button variant="outline" onClick={() => setOpen(undefined)}>
95
+ Back
96
+ </Button>
97
+ </Card>
98
+ </Morph>
99
+ ) : (
100
+ <CardGrid columns={2}>
101
+ {letters.map((shop) => (
102
+ <Morph key={shop} name="shop-transition-dont" item={shop}>
103
+ <Card title={`Shop ${shop}`}>
104
+ <Button variant="outline" onClick={() => setOpen(shop)}>
105
+ Open Shop {shop}
106
+ </Button>
107
+ </Card>
108
+ </Morph>
109
+ ))}
110
+ </CardGrid>
111
+ );
112
+ }
113
+ ```
114
+
115
+ ### Accessibility
116
+ - A Morph is a plain `<div>` with no role, so it changes nothing for assistive technology.
117
+ - Under `prefers-reduced-motion: reduce` the element swaps with no animation, and `startPageTransition` just runs the update.
118
+ - Where the browser has no View Transitions it is a plain `<div>` and the content swaps.
119
+
120
+ ### Props
121
+ ### Morph
122
+ An element that grows into its counterpart on the next page, and shrinks back on Back, through the View Transitions API. Wrap the card in the list and the element on the detail page, each with the same `name` and the record's id as `item`: the browser morphs one into the other over 450 ms. The same `name` and `item` may appear only once on a page; two on one page and the browser skips the morph, so a list passes each record's own id. The morph runs only when the change is wrapped in a view transition: `startPageTransition`, or a router's own option (TanStack Router `defaultViewTransition: true` on `createRouter`, or `viewTransition` on a `Link`; React Router's `viewTransition`, Astro's `ClientRouter`). Otherwise, or where the browser has no View Transitions, it renders and behaves as a plain `<div>`. Inside a `PageFade` the page fades while this element morphs. While it is named (near the screen) the div is a stacking context, so a dropdown inside it cannot rise above a sticky header outside it: portal overlays to the body. Under `prefers-reduced-motion: reduce` it swaps with no animation; a router's own transition of the rest of the page is the router's to quiet. A Morph more than a screen above or below the viewport carries no transition name until it scrolls near, so a long list costs only what is on screen.
123
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
124
+ - item: string | number (required). Which one, usually the record's id. Any text or number; unique on the page for one `name`.
125
+ - name: string (required). What the element is, shared by the card and its detail: `"shop"`, `"product"`. Any text.
126
+
127
+ ### Functions
128
+ - refreshMorphs: `refreshMorphs(): void`. measures every Morph again, so a card a router scrolled on screen after the render is named before the capture; call it from the router's `onRendered`.
@@ -0,0 +1,56 @@
1
+ ## NavigationProgress
2
+
3
+ Group: Feedback
4
+
5
+ When to use: A page load of unknown length: show at once that the click did something, until the next page renders.
6
+
7
+ ### The one right way
8
+ Pass `loading` from the router's pending state: the bar shows while it is true and is gone when the page has arrived.
9
+ ```tsx
10
+ import { useState } from "react";
11
+ import { Button, NavigationProgress, PageFade, Stack, Text } from "@slashsuite/ui-react";
12
+
13
+ function Example() {
14
+ const [pending, setPending] = useState(true);
15
+ return (
16
+ <Stack gap="sm">
17
+ <NavigationProgress loading={pending} />
18
+ <Button variant="outline" onClick={() => setPending(!pending)}>
19
+ {pending ? "The page has arrived" : "Open the store page"}
20
+ </Button>
21
+ <PageFade>
22
+ <Text>{pending ? "Waiting for the next page." : "The current page."}</Text>
23
+ </PageFade>
24
+ </Stack>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ### Do
30
+ - Render it once per app, beside the page frame, and pass `loading` from the router's pending state: with TanStack Router, `loading={useRouterState({ select: (s) => s.status === "pending" })}`. It has no router dependency.
31
+ - There is nothing to configure: it draws the bar while `loading` is true and nothing while it is false. The bar is invisible for its first 150ms, so a fast navigation shows nothing.
32
+ - It is fixed to the top edge of the viewport and overlays the header, so nothing on the page moves. Pair it with `PageFade`: the bar says the page is loading, and the fade swaps the content when it arrives.
33
+ - A task with a known length and a value is a `ProgressBar`, not this.
34
+
35
+ ### Don't
36
+ A `ProgressBar` needs a value, and a page load has none to give: a guessed one sits still or lies about how far along it is.
37
+ ```tsx
38
+ import { ProgressBar, Stack, Text } from "@slashsuite/ui-react";
39
+
40
+ <Stack gap="sm">
41
+ <ProgressBar value={60} label="Loading page" />
42
+ <Text>Waiting for the next page.</Text>
43
+ </Stack>
44
+ ```
45
+
46
+ ### Accessibility
47
+ - While shown it is `role="progressbar"` named by `label` ("Loading page" by default) and has no `aria-valuenow`, so it reads as an indeterminate progress bar. When hidden it is not in the page.
48
+ - Under `prefers-reduced-motion: reduce` it is a still, full-width bar with no slide.
49
+ - It takes no pointer events, so it never covers a control in the header.
50
+
51
+ ### Props
52
+ ### NavigationProgress
53
+ A thin indeterminate bar along the top edge of the viewport, in the accent tone, for a route change that is under way and has no known length. Pass `loading` from the router's pending state and render it once per app, beside the page frame. It draws exactly what `loading` says: the bar while it is true and nothing while it is false. The stylesheet holds it invisible for the first 150ms, so a fast navigation shows nothing. It is fixed to the viewport and overlays the top of the header, so nothing on the page moves. Under `prefers-reduced-motion: reduce` it is a still bar.
54
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
55
+ - label: string (default Loading page). The bar's accessible name.
56
+ - loading: boolean (required). True while a navigation is pending, e.g. from the router's state.
@@ -0,0 +1,63 @@
1
+ ## OutlineRegion
2
+
3
+ Group: Content
4
+
5
+ When to use: Marking an area of a screenshot or an image: one that is ignored, flagged or picked.
6
+
7
+ ### Use instead
8
+ - Image (image.md): The picture is shown with nothing marked on it.
9
+
10
+ ### The one right way
11
+ A `label` says why the area is marked, so a reader can tell an ignored area from a flagged one.
12
+ ```tsx
13
+ import { OutlineRegion, RegionFrame } from "@slashsuite/ui-react";
14
+
15
+ <RegionFrame src={sampleShot} alt="The dashboard">
16
+ <OutlineRegion
17
+ rect={{ x: 228, y: 4, width: 80, height: 20 }}
18
+ within={sampleShotSize}
19
+ label="ignored"
20
+ hatched
21
+ />
22
+ </RegionFrame>
23
+ ```
24
+
25
+ ### Do
26
+ - Put the picture in a `RegionFrame` (`src`, `alt`, and any `<img>` prop such as `onLoad`) and the `OutlineRegion`s inside it; each region places itself over the picture.
27
+ - `rect` is the area and `within` the picture's full size, both in the picture's own pixels (its natural size), so the box stays on its area at any width.
28
+ - Size the frame as an `Image`: `width` (`full`, or `sm`, `md`, `lg`) and `aspect` (`natural`, its own proportions, or a shape that letterboxes the picture, never cropping it and never scaling it up). The regions stay on the picture, not the box. A shape also holds the frame's height before the picture loads.
29
+ - `label` is a short tag in the top-left corner that says what the area is or where it came from. `hatched` stripes the inside, for an area that is left out.
30
+ - The outline is the accent colour in every theme; do not draw a box of your own with a raw colour.
31
+
32
+ ### Don't
33
+ An unlabelled box leaves the reader to guess what it marks and where it came from.
34
+ ```tsx
35
+ import { OutlineRegion, RegionFrame } from "@slashsuite/ui-react";
36
+
37
+ <RegionFrame src={sampleShot} alt="The dashboard">
38
+ <OutlineRegion rect={{ x: 228, y: 4, width: 80, height: 20 }} within={sampleShotSize} />
39
+ </RegionFrame>
40
+ ```
41
+
42
+ ### Accessibility
43
+ - The region takes no pointer events, so it never blocks the picture or a layer drawn over it; the hatch is hidden from assistive tech.
44
+ - A `label` is plain text and is read out; a region with no label says nothing to a screen reader, so name the areas in text as well when they matter.
45
+
46
+ ### Props
47
+ ### RegionFrame
48
+ A picture with a hairline edge, and `children` laid over it: the `OutlineRegion`s that mark its areas. Every other prop goes to the `<img>` (`onLoad`, `loading`, `data-*`), so the app can read the picture's own size for `within`. It sizes as `Image` does. `width` is `full` (the parent's width) or 96, 160 or 256px. `aspect` `natural` keeps the picture's own proportions; any other shape letterboxes it (contain, never a crop) on the inset surface, centred and never scaled up, and the regions are laid over the picture itself, not the box, so each stays on its spot. A letterboxed picture needs its own size: a screenshot has one; an SVG needs `width` and `height` on its root, not only a `viewBox`.
49
+ - alt: string (required). What the picture shows; `""` for one that only decorates.
50
+ - aspect: "square" | "4:3" | "3:2" | "16:9" | "3:4" | "9:16" | "natural" (default natural). The box's shape: `natural` is the picture's own; any other letterboxes the picture inside it.
51
+ - children: ReactNode. The `OutlineRegion`s over the picture.
52
+ - src: string (required). The picture.
53
+ - width: "sm" | "md" | "lg" | "full" (default full). How wide the frame is: `full` fills its parent; `sm`, `md` and `lg` are 96, 160 and 256px, capped at the parent's width.
54
+
55
+ ### OutlineRegion
56
+ An accent outline over one area of a picture, such as a screenshot's ignored or flagged region. `rect` is in the picture's own units and `within` is the picture's full size in the same units; the box is placed in percent of them, so it sits right at any scale. Put it in a `RegionFrame`, over the picture. `label` is a small tag in its top-left corner; `hatched` stripes the inside, for an area that is left out. It takes no pointer events, so it never blocks the picture or a layer drawn over it.
57
+ - hatched: boolean (default false). Stripes the inside, for an area left out (ignored, masked).
58
+ - label: ReactNode. A short tag in the top-left corner: where the area came from, or what it is.
59
+ - rect: RegionRect (required). The area, in the picture's own units.
60
+ - within: { width: number; height: number; } (required). The picture's full size, in the same units as `rect`.
61
+
62
+ ### Types
63
+ - RegionRect: `{ x: number; y: number; width: number; height: number }`. A box in a picture's own units (an image's pixels): its top-left corner and its size.
@@ -0,0 +1,116 @@
1
+ ## PageFade
2
+
3
+ Group: Feedback
4
+
5
+ When to use: A site where the frame stays put and only the content between pages should fade.
6
+
7
+ ### The one right way
8
+ `PageFade` wraps only the content that changes between pages; the frame around it, with the control, stays put.
9
+ ```tsx
10
+ import { useState } from "react";
11
+ import {
12
+ PageFade,
13
+ SegmentedControl,
14
+ Stack,
15
+ startPageTransition,
16
+ Text,
17
+ } from "@slashsuite/ui-react";
18
+
19
+ function Example() {
20
+ const [value, setValue] = useState("overview");
21
+ const items = [
22
+ { value: "overview", label: "Overview" },
23
+ { value: "activity", label: "Activity" },
24
+ ];
25
+ return (
26
+ <Stack gap="sm">
27
+ <SegmentedControl
28
+ label="Page"
29
+ items={items}
30
+ value={value}
31
+ onChange={(next) => startPageTransition(() => setValue(next))}
32
+ />
33
+ <PageFade>
34
+ <Text>The {value} page.</Text>
35
+ </PageFade>
36
+ </Stack>
37
+ );
38
+ }
39
+ ```
40
+
41
+ ### Do
42
+ - Wrap what changes between pages, once per page, and leave the header and footer outside it.
43
+ - Start the change inside a view transition: `startPageTransition(() => setPage(next))` for a state change, or the router's own option (TanStack Router `viewTransition`, React Router's `viewTransition`, Astro's `ClientRouter`). Without one nothing fades.
44
+ - Leave `name` off: the whole page cross-fades and the frame, the same on both pages, looks still.
45
+ - Give a `name` only to a second region that must fade apart from the page, and only one no taller than the screen: a named region is captured at its full height. Each named one on a page needs its own `name`, and it is a stacking context, so portal an overlay inside it to the body.
46
+
47
+ ### Don't
48
+ Wrapping the frame too makes the control fade with the content, so the page flickers instead of changing in place.
49
+ ```tsx
50
+ import { useState } from "react";
51
+ import {
52
+ PageFade,
53
+ SegmentedControl,
54
+ Stack,
55
+ startPageTransition,
56
+ Text,
57
+ } from "@slashsuite/ui-react";
58
+
59
+ function Example() {
60
+ const [value, setValue] = useState("overview");
61
+ const items = [
62
+ { value: "overview", label: "Overview" },
63
+ { value: "activity", label: "Activity" },
64
+ ];
65
+ return (
66
+ <PageFade>
67
+ <Stack gap="sm">
68
+ <SegmentedControl
69
+ label="Page"
70
+ items={items}
71
+ value={value}
72
+ onChange={(next) => startPageTransition(() => setValue(next))}
73
+ />
74
+ <Text>The {value} page.</Text>
75
+ </Stack>
76
+ </PageFade>
77
+ );
78
+ }
79
+ ```
80
+
81
+ A plain state change swaps the content at once: there is no transition to fade.
82
+ ```tsx
83
+ import { useState } from "react";
84
+ import { Button, PageFade, Stack, Text } from "@slashsuite/ui-react";
85
+
86
+ function Example() {
87
+ const [value, setValue] = useState("overview");
88
+ return (
89
+ <Stack gap="sm">
90
+ <Button
91
+ variant="outline"
92
+ onClick={() => setValue(value === "overview" ? "activity" : "overview")}
93
+ >
94
+ Switch page
95
+ </Button>
96
+ <PageFade>
97
+ <Text>The {value} page.</Text>
98
+ </PageFade>
99
+ </Stack>
100
+ );
101
+ }
102
+ ```
103
+
104
+ ### Accessibility
105
+ - A PageFade is a plain `<div>` with no role, so it changes nothing for assistive technology.
106
+ - Under `prefers-reduced-motion: reduce` the content swaps with no fade, and `startPageTransition` just runs the update.
107
+ - Where the browser has no View Transitions it is a plain `<div>` and the content swaps.
108
+
109
+ ### Props
110
+ ### PageFade
111
+ The page's content area, cross-faded by the View Transitions API when the route changes. Wrap what changes between pages, once per page. With no `name` the fade is the browser's own cross-fade of the whole viewport; the frame around the content (header, footer) stays still because it is the same on both pages. A `name` names this box so it fades apart from the page, for a second region; a named region is captured at its full height, so name only a region no taller than the screen, and give each named one on a page its own `name`. The fade runs only when the navigation is wrapped in a view transition: `startPageTransition`, or a router's own option (TanStack Router `viewTransition`, React Router's `viewTransition` prop, Astro's `ClientRouter`). Otherwise, or where the browser has no View Transitions, it renders and behaves as a plain `<div>`. A named PageFade is a stacking context, so a dropdown inside it cannot rise above a sticky header outside it: portal overlays to the body. The default one is not. Under `prefers-reduced-motion: reduce` the content swaps with no fade; a named one quiets only its own box, and a router's own transition of the rest of the page is the router's to quiet.
112
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
113
+ - name: string. A view-transition name for this box, a CSS identifier (letters, digits, `-`, `_`), for a region no taller than the screen that fades apart from the page.
114
+
115
+ ### Functions
116
+ - startPageTransition: `startPageTransition(update: () => void): void`. runs a synchronous state change inside a view transition, so a PageFade cross-fades; call it from an event handler.
@@ -0,0 +1,93 @@
1
+ ## PageHeader
2
+
3
+ Group: Layout
4
+
5
+ When to use: The first block of every page but a landing page, which opens with a `Hero`; it puts the page's first content at the same y on every page.
6
+
7
+ ### The one right way
8
+ Breadcrumbs, title, description, actions and tabs are slots of one `PageHeader`; each is optional.
9
+ ```tsx
10
+ import { Breadcrumbs, Button, Tabs, PageHeader } from "@slashsuite/ui-react";
11
+
12
+ <PageHeader
13
+ breadcrumbs={
14
+ <Breadcrumbs
15
+ items={[
16
+ { label: "Hack Cove", href: "#project" },
17
+ { label: "Builds", href: "#builds" },
18
+ "Build 412",
19
+ ]}
20
+ />
21
+ }
22
+ title="Build 412"
23
+ description="main · 3 changed"
24
+ actions={
25
+ <>
26
+ <Button variant="outline">Reject</Button>
27
+ <Button>Accept all</Button>
28
+ </>
29
+ }
30
+ tabs={
31
+ <Tabs
32
+ label="Build"
33
+ items={[
34
+ { label: "Changed", href: "#changed", selected: true },
35
+ { label: "New", href: "#new" },
36
+ ]}
37
+ />
38
+ }
39
+ />
40
+ ```
41
+
42
+ ### Do
43
+ - Pass `title`, and `description`, `breadcrumbs`, `actions` and `tabs` as needed; never build a title row from a heading and a `Cluster`.
44
+ - `actions` sit beside the title from `sm` up and under it on a phone: a `Button` or two, one primary.
45
+ - `breadcrumbs` take a `Breadcrumbs`; `tabs` take `Tabs` of links to pages.
46
+ - Its fixed bottom margin gives every page the same first-block position. As a direct child of a `Stack` it has none and the Stack's `gap` is the only space, so do not wrap it in another element.
47
+ - One `PageHeader` per page: it holds the page's `<h1>`. A landing page has a `Hero` in its place.
48
+
49
+ ### Don't
50
+ A title row built from a heading, a description and a `Cluster` is a second header that drifts from every other page's. Use `PageHeader`.
51
+ ```tsx
52
+ import { Button, Cluster, PageHeading, Stack, Text } from "@slashsuite/ui-react";
53
+
54
+ <Cluster justify="between">
55
+ <Stack gap="xs">
56
+ <PageHeading>Build 412</PageHeading>
57
+ <Text>main · 3 changed</Text>
58
+ </Stack>
59
+ <Button>Accept all</Button>
60
+ </Cluster>
61
+ ```
62
+
63
+ Wrapped in a `div`, the header is no longer a direct child of the Stack, keeps its margin and doubles the space.
64
+ ```tsx
65
+ import { Card, PageHeader, Stack, Text } from "@slashsuite/ui-react";
66
+
67
+ <Stack gap="lg">
68
+ <div>
69
+ <PageHeader title="Members" description="Who can see this project." />
70
+ </div>
71
+ <Card title="Active">
72
+ <Text>3 members</Text>
73
+ </Card>
74
+ </Stack>
75
+ ```
76
+
77
+ ### Accessibility
78
+ - The title is the page's `<h1>`; the description is a paragraph.
79
+ - `Breadcrumbs` is a `<nav>` named Breadcrumb, with the last crumb marked `aria-current="page"`. Give the `Tabs` a `label`.
80
+ - On a narrow screen the actions move below the title.
81
+
82
+ ### Props
83
+ ### PageHeader
84
+ The top of a page: breadcrumbs, title, description, actions and tabs. Its fixed bottom margin puts every page's first block at the same y; as a direct child of a `Stack` it has none, so the Stack's gap is the only space under it. While `loading` it is the owner of the wait: what it has is drawn and an empty title is a bone.
85
+ - actions: ReactNode. Right of the title on `sm` and up, below it on a phone.
86
+ - breadcrumbs: ReactNode. A `Breadcrumbs` above the title.
87
+ - description: ReactNode. The lede under the title: a `Lead`, so it outranks the body text after it.
88
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
89
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
90
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
91
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
92
+ - tabs: ReactNode. A `Tabs` (or similar) under the title.
93
+ - title: ReactNode (required). The page's `h1`.