@sableui/react 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +115 -0
- package/README.md +2 -0
- package/bin/sable.mjs +34 -0
- package/dist/blocks/traffic-sources-block.js +1 -1
- package/dist/blocks/traffic-trend-block.js +3 -3
- package/dist/components/breadcrumbs/breadcrumbs.js +10 -9
- package/dist/components/breadcrumbs/breadcrumbs.meta.js +2 -2
- package/dist/components/button/button.meta.js +4 -0
- package/dist/components/card/card.js +7 -4
- package/dist/components/chat-composer/chat-composer.js +4 -2
- package/dist/components/chat-composer/chat-composer.meta.js +8 -2
- package/dist/components/command-menu/command-menu.js +9 -2
- package/dist/components/command-menu/command-menu.meta.js +3 -3
- package/dist/components/data-table/data-table.js +117 -64
- package/dist/components/data-table/data-table.meta.js +27 -1
- package/dist/components/form/form.js +30 -9
- package/dist/components/form/form.meta.js +17 -3
- package/dist/components/message-scroller/message-scroller.meta.js +1 -1
- package/dist/components/page-header/page-header.js +1 -0
- package/dist/components/page-header/page-header.meta.js +1 -1
- package/dist/components/pie-chart/pie-chart.js +3 -3
- package/dist/components/pie-chart/pie-chart.meta.js +3 -3
- package/dist/components/radial-chart/radial-chart.js +3 -3
- package/dist/components/radial-chart/radial-chart.meta.js +2 -2
- package/dist/components/settings-menu/settings-menu.js +10 -1
- package/dist/components/settings-menu/settings-menu.meta.js +1 -1
- package/dist/components/side-nav/side-nav.variants.js +3 -2
- package/dist/components/sidebar/sidebar.js +1 -1
- package/dist/components/sidebar/sidebar.meta.js +5 -0
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/switch/switch.meta.js +2 -2
- package/dist/components/table/table.js +1 -1
- package/dist/components/toggle/toggle.js +2 -1
- package/dist/file-hashes.json +603 -0
- package/dist/icon-sets/reicon.js +13 -1
- package/dist/index.d.ts +88 -15
- package/dist/index.js +1 -1
- package/dist/layout/index.d.ts +5 -2
- package/dist/lib/chart/format.js +5 -0
- package/dist/lib/component-guidance.js +7 -2
- package/dist/lib/heading-row.js +3 -2
- package/dist/lib/trim-label.js +17 -4
- package/dist/presets/index.d.ts +7 -1
- package/dist/presets/index.js +10 -0
- package/dist/styles.css +27 -2
- package/llms/blocks/traffic-sources-block.md +1 -1
- package/llms/blocks/traffic-trend-block.md +5 -3
- package/llms/components/breadcrumbs.md +1 -1
- package/llms/components/button.md +1 -0
- package/llms/components/chat-composer.md +3 -2
- package/llms/components/command-menu.md +2 -2
- package/llms/components/data-table.md +33 -1
- package/llms/components/form.md +19 -2
- package/llms/components/message-scroller.md +1 -1
- package/llms/components/page-header.md +1 -1
- package/llms/components/pie-chart.md +2 -2
- package/llms/components/radial-chart.md +1 -1
- package/llms/components/settings-menu.md +1 -1
- package/llms/components/sidebar.md +1 -0
- package/llms/components/switch.md +2 -2
- package/llms/layout/region.md +16 -3
- package/llms/tasks/building-a-page.md +34 -3
- package/llms/tasks/creating-a-preset.md +4 -1
- package/llms/tasks/patching-a-component.md +48 -0
- package/llms/tasks/reviewing-a-design.md +9 -0
- package/llms/tasks/using-presets.md +19 -0
- package/llms-full.txt +207 -27
- package/llms.txt +1 -1
- package/package.json +4 -2
- package/registry.json +132 -30
- package/scripts/design-memory.mjs +7 -2
- package/scripts/design-presets.mjs +15 -4
- package/scripts/lint-rules.mjs +32 -1
- package/scripts/patches.mjs +219 -0
- package/scripts/sources.mjs +247 -0
- package/skills/sable/SKILL.md +16 -4
package/llms-full.txt
CHANGED
|
@@ -627,9 +627,9 @@ designs. Record the reason for the chosen composition.
|
|
|
627
627
|
</AppShell>
|
|
628
628
|
```
|
|
629
629
|
|
|
630
|
-
- **Never a global `max-width`.** Width is
|
|
631
|
-
|
|
632
|
-
|
|
630
|
+
- **Never a global `max-width`.** Width is chosen per route by what the person
|
|
631
|
+
does there (below). A form region is narrow because a 700px text input is
|
|
632
|
+
harder to use, not more generous.
|
|
633
633
|
- **Measure ≠ width.** Cap prose line length in `ch` (`--measure-prose`)
|
|
634
634
|
independently of the region's layout width.
|
|
635
635
|
- **The 12-column grid lives *inside* a region**, for genuinely multi-column
|
|
@@ -637,6 +637,37 @@ designs. Record the reason for the chosen composition.
|
|
|
637
637
|
- **Chrome is off the grid.** `Sidebar` and rails are fixed-width, outside the
|
|
638
638
|
content grid.
|
|
639
639
|
|
|
640
|
+
## Choosing a width
|
|
641
|
+
|
|
642
|
+
Pick each route's `max` by what the person mainly does on it:
|
|
643
|
+
|
|
644
|
+
| They mainly… | `max` | Why |
|
|
645
|
+
|---|---|---|
|
|
646
|
+
| read long text | `prose` on the text, inside `content` | line length sets readability: cap the text, not the page |
|
|
647
|
+
| fill in a form | `form` | narrow fields are faster to scan and fill |
|
|
648
|
+
| scroll one stream | `feed` | one column, one eye path |
|
|
649
|
+
| review one record, or settings | `content` | labels stay close to their values |
|
|
650
|
+
| scan and compare rows, cards or charts | `wide` | room for columns without stretching the gaps between them |
|
|
651
|
+
| work across panes, a board, an editor or a map | omit it (fluid), or `full` | the extra width goes to the parts that use it |
|
|
652
|
+
|
|
653
|
+
- **Go fluid only when a flexible part uses the space**: a table's main column,
|
|
654
|
+
a canvas, a board, a reading pane. If extra width only widens the gaps between
|
|
655
|
+
fixed columns (a date drifting away from its subject), cap it.
|
|
656
|
+
- **In a fluid page, cap text by line length** (`--measure-prose`, or
|
|
657
|
+
`Center max="prose"`), not by page width.
|
|
658
|
+
- **Sibling routes in one nav share a width**, so the header doesn't jump as
|
|
659
|
+
people move between them. A detail view may differ.
|
|
660
|
+
- **`full` is the largest cap, not edge to edge.** It keeps the page inset;
|
|
661
|
+
`bleed` is edge to edge.
|
|
662
|
+
- **A cap is a ceiling.** It applies only once the viewport minus app chrome is
|
|
663
|
+
wider than it: beside a 256px sidebar, `wide` (1280px) starts at about 1536px,
|
|
664
|
+
so at 1440px `wide`, `full` and fluid look the same. Judge widths at 1920px and
|
|
665
|
+
2560px, and record each route's width and reason in the brief.
|
|
666
|
+
- **A product's widths belong in its theme.** A preset may set `page-inset` and
|
|
667
|
+
`region-*` (`form`, `feed`, `content`, `wide`, `full`) in `tokens.shared`
|
|
668
|
+
(a copy in `light` or `dark` wins over it); keep the role names and change
|
|
669
|
+
the values.
|
|
670
|
+
|
|
640
671
|
## Typography: pick the tier by ROLE, not by size
|
|
641
672
|
|
|
642
673
|
| tier | for | not |
|
|
@@ -1319,7 +1350,10 @@ cannot establish animation timing, hidden behavior, or an unseen responsive stat
|
|
|
1319
1350
|
Choose an original direction suitable for the user's future product. Map that
|
|
1320
1351
|
direction onto the installed Sable token vocabulary. Preserve readable semantic
|
|
1321
1352
|
roles and supported control behavior rather than recoloring every primitive
|
|
1322
|
-
independently. Load fonts through the consuming project's font setup.
|
|
1353
|
+
independently. Load fonts through the consuming project's font setup. Page widths
|
|
1354
|
+
are optional: set `page-inset` and the `region-*` caps (`form`, `feed`, `content`,
|
|
1355
|
+
`wide`, `full`) in `tokens.shared` only when the direction calls for a different
|
|
1356
|
+
page proportion, and keep each cap's role.
|
|
1323
1357
|
|
|
1324
1358
|
```bash
|
|
1325
1359
|
pnpm exec sable preset --template
|
|
@@ -1898,6 +1932,57 @@ Only label a record human when it reflects an actual human's stated judgment.
|
|
|
1898
1932
|
|
|
1899
1933
|
---
|
|
1900
1934
|
|
|
1935
|
+
# Task: patching a Sable component
|
|
1936
|
+
|
|
1937
|
+
A Sable component has a defect that blocks your app, and the fix has not shipped.
|
|
1938
|
+
Don't restyle it from the outside with `className` (`component-restyle` flags
|
|
1939
|
+
that, and it fights the component's own states), and don't copy the component
|
|
1940
|
+
into the app (it imports Sable internals, and the copy drifts from every later
|
|
1941
|
+
fix). Patch the installed module and record why. Sable then re-checks the patch
|
|
1942
|
+
on every upgrade and tells you when to drop it.
|
|
1943
|
+
|
|
1944
|
+
## Record it, then patch it
|
|
1945
|
+
|
|
1946
|
+
```bash
|
|
1947
|
+
pnpm exec sable patch Card --reason "Row hover pokes past a flush card's corners" \
|
|
1948
|
+
--repro "Hover the last row of the Tickets table at a 20px card radius"
|
|
1949
|
+
```
|
|
1950
|
+
|
|
1951
|
+
The record goes in `.sable/patches.json`: the component, the files it covers,
|
|
1952
|
+
the Sable version, each file's hash as Sable shipped it, your reason and your
|
|
1953
|
+
repro. Commit it. The command prints the steps for your package manager:
|
|
1954
|
+
|
|
1955
|
+
- **pnpm:** `pnpm patch @sableui/react@<version>`, edit the file in the folder
|
|
1956
|
+
it prints, then `pnpm patch-commit <folder>`.
|
|
1957
|
+
- **Yarn 2+:** `yarn patch @sableui/react`, edit, then `yarn patch-commit -s <folder>`.
|
|
1958
|
+
- **npm or Yarn 1:** edit `node_modules/@sableui/react/<file>`, run
|
|
1959
|
+
`npx patch-package @sableui/react`, and add `"postinstall": "patch-package"`.
|
|
1960
|
+
|
|
1961
|
+
A component's patch covers its own modules (`dist/components/card/*.js`). When
|
|
1962
|
+
the defect is in a shared module, add it with `--file dist/lib/trim-label.js`.
|
|
1963
|
+
Keep the change as small as the defect. Then report it upstream (`--issue` keeps
|
|
1964
|
+
the link), so the library fix can replace the patch.
|
|
1965
|
+
|
|
1966
|
+
## On every upgrade
|
|
1967
|
+
|
|
1968
|
+
`sable doctor`, and so `sable check`, re-checks each recorded patch against the
|
|
1969
|
+
installed Sable:
|
|
1970
|
+
|
|
1971
|
+
| State | Doctor | What to do |
|
|
1972
|
+
|---|---|---|
|
|
1973
|
+
| Same version, patch applied | passes | nothing |
|
|
1974
|
+
| Same version, not applied | warns | make the patch (the printed steps) |
|
|
1975
|
+
| Newer Sable changed a patched file | **fails**, citing the changelog entries that name the component | re-run the repro on Sable's own files. Fixed: `sable patch Card --drop` and remove the patch. Still broken: re-patch, then `sable patch Card --keep` |
|
|
1976
|
+
| Newer Sable left the file alone, patch carried over | passes | nothing |
|
|
1977
|
+
| Newer Sable left the file alone, patch lost | **fails** | re-apply it, then `--keep` |
|
|
1978
|
+
|
|
1979
|
+
Nothing is kept or dropped silently. pnpm also stops an install whose patch
|
|
1980
|
+
names a version that is no longer installed; that is the same alert, earlier.
|
|
1981
|
+
|
|
1982
|
+
`sable patch --list` shows every patch and its state.
|
|
1983
|
+
|
|
1984
|
+
---
|
|
1985
|
+
|
|
1901
1986
|
# Task: reviewing a rendered design
|
|
1902
1987
|
|
|
1903
1988
|
Review has two separate results: code conformance and observed design quality.
|
|
@@ -1910,6 +1995,15 @@ Save the surface brief, then capture the rendered route at a desktop width of at
|
|
|
1910
1995
|
least 1024px and a mobile width of at most 480px. Record the actual viewport,
|
|
1911
1996
|
route/state, supported color mode, and motion setting with each artifact. Inspect
|
|
1912
1997
|
the whole route as well as its first viewport. Ensure fonts and media have loaded.
|
|
1998
|
+
Charts and other arrival motion draw when they scroll into view, so a full-page
|
|
1999
|
+
still taken with full motion shows the ones below the fold empty. Scroll the route
|
|
2000
|
+
through first and let the motion finish, or take that capture with
|
|
2001
|
+
`prefers-reduced-motion: reduce` emulated (everything then starts drawn). Don't
|
|
2002
|
+
report an undrawn chart as a defect without checking which happened.
|
|
2003
|
+
Also capture a route that sets a width cap, or goes fluid, at 1920px: a cap applies
|
|
2004
|
+
only once the viewport minus app chrome exceeds it, so at 1024–1440px `wide`,
|
|
2005
|
+
`full` and fluid usually look the same and the width decision never shows. Add
|
|
2006
|
+
2560px for a fluid route.
|
|
1913
2007
|
Use a recording or an observed interaction report for behavior that a still cannot
|
|
1914
2008
|
show. Include reduced motion and every color mode the surface promises to support.
|
|
1915
2009
|
|
|
@@ -2299,6 +2393,25 @@ Use a unique preset ID so it cannot override a bundled theme or another record.
|
|
|
2299
2393
|
Record any intentional adaptation and run the validation and rendered review in
|
|
2300
2394
|
[building-with-sable.md](./building-with-sable.md).
|
|
2301
2395
|
|
|
2396
|
+
## Apply to an existing app
|
|
2397
|
+
|
|
2398
|
+
A preset pasted into an agent for a running app (Canvas's “Copy for agent”) is a
|
|
2399
|
+
restyle: the job ends with the app built and rendered in the preset, not with a
|
|
2400
|
+
saved file. Replace, don't add beside:
|
|
2401
|
+
|
|
2402
|
+
1. Save it to `.sable/presets/<id>.json`, overwriting an earlier revision of the
|
|
2403
|
+
same ID, and run `sable preset --check`.
|
|
2404
|
+
2. Regenerate its CSS with `sable preset --css` and import it after Sable's
|
|
2405
|
+
stylesheet. Remove the stylesheet of a theme it replaces when nothing else uses it.
|
|
2406
|
+
3. Load the families its `fonts` stacks name through the app's existing font
|
|
2407
|
+
setup, and drop the old theme's font loading when no other code uses it.
|
|
2408
|
+
An unloaded family falls back to a system face without any error.
|
|
2409
|
+
4. Point SableThemeProvider's `defaultThemeId` at the preset ID and
|
|
2410
|
+
`defaultPreference` at its `defaultMode`, unless the user asked for another
|
|
2411
|
+
mode. A bundled theme left as the default keeps the app on the old look.
|
|
2412
|
+
5. Run the app's build and type check, then `sable check`, and review the result
|
|
2413
|
+
in both modes.
|
|
2414
|
+
|
|
2302
2415
|
## Upgrade the package and skill
|
|
2303
2416
|
|
|
2304
2417
|
```bash
|
|
@@ -8601,7 +8714,7 @@ export function TrafficSourcesBlock({ className, framed = true }: TrafficSources
|
|
|
8601
8714
|
index="source"
|
|
8602
8715
|
valueKey="visitors"
|
|
8603
8716
|
donut
|
|
8604
|
-
centerLabel={{ value: total
|
|
8717
|
+
centerLabel={{ value: total, label: "Visitors" }}
|
|
8605
8718
|
/>
|
|
8606
8719
|
</CardContent>
|
|
8607
8720
|
<CardFooter className="text-body-sm text-muted-foreground">
|
|
@@ -8672,11 +8785,13 @@ export function TrafficTrendBlock({ className, framed = true }: TrafficTrendBloc
|
|
|
8672
8785
|
const [range, setRange] = useState("90d")
|
|
8673
8786
|
const shown = days.slice(-(ranges.find((r) => r.id === range)?.days ?? 90))
|
|
8674
8787
|
return (
|
|
8675
|
-
<Card variant={framed ? "default" : "flat"} className={cn("w-full max-w-3xl", className)}>
|
|
8676
|
-
<CardHeader>
|
|
8788
|
+
<Card variant={framed ? "default" : "flat"} className={cn("@container/trend w-full max-w-3xl", className)}>
|
|
8789
|
+
<CardHeader className="@max-sm/trend:has-data-[slot=card-action]:grid-cols-1">
|
|
8677
8790
|
<CardTitle render={<h2 />}>Visitors</CardTitle>
|
|
8678
8791
|
<CardDescription>Desktop and mobile, by day.</CardDescription>
|
|
8679
|
-
|
|
8792
|
+
{/* Beside the title on a wide card; under it on a narrow one, where three
|
|
8793
|
+
ranges would squeeze the title and description into a sliver. */}
|
|
8794
|
+
<CardAction className="@max-sm/trend:col-start-1 @max-sm/trend:row-span-1 @max-sm/trend:row-start-auto @max-sm/trend:mt-2 @max-sm/trend:justify-self-start">
|
|
8680
8795
|
<ToggleGroup value={[range]} onValueChange={(v: unknown[]) => v[0] && setRange(String(v[0]))} aria-label="Time range">
|
|
8681
8796
|
{ranges.map((r) => (
|
|
8682
8797
|
<Toggle key={r.id} value={r.id}>
|
|
@@ -8944,9 +9059,14 @@ Use Region as the page-width primitive that applies fluid page inset and an opti
|
|
|
8944
9059
|
|
|
8945
9060
|
### Best practices
|
|
8946
9061
|
|
|
8947
|
-
- Do: Choose the max value by
|
|
9062
|
+
- Do: Choose the max value by what the person does on the page: read (prose), fill in a form (form), scroll one stream (feed), review one record or settings (content), scan and compare rows or cards (wide).
|
|
9063
|
+
- Do: Omit max (fluid) for work across panes, a board, an editor or a map, where a flexible part uses the extra width; cap text inside it with --measure-prose.
|
|
9064
|
+
- Do: Give sibling routes in one nav the same width so the header does not jump between them.
|
|
9065
|
+
- Do: Review a capped or fluid route at 1920px and 2560px: a cap is a ceiling, so below the cap plus app chrome every choice looks the same.
|
|
8948
9066
|
- Do: Use Region near the route or section boundary so inner layout stays intentional.
|
|
8949
9067
|
- Don't: Do not use Region as a global wrapper that forces every page into the same max width.
|
|
9068
|
+
- Don't: Do not go fluid when the extra width only widens the gaps between fixed columns; cap it.
|
|
9069
|
+
- Don't: Do not read full as edge to edge: it is the largest cap and keeps the page inset. Use bleed for edge to edge.
|
|
8950
9070
|
|
|
8951
9071
|
## Props
|
|
8952
9072
|
|
|
@@ -8954,7 +9074,7 @@ Use Region as the page-width primitive that applies fluid page inset and an opti
|
|
|
8954
9074
|
| --- | --- | --- | --- |
|
|
8955
9075
|
| as | ElementType | "div" | Semantic element to render (e.g. "main", "section", "nav"). |
|
|
8956
9076
|
| inset | boolean | true | Apply the fluid horizontal page inset (--page-inset). |
|
|
8957
|
-
| max | "prose" \| "form" \| "feed" \| "content" \| "wide" \| "full" \| CSS length | — | Opt-in centered max-width cap, purpose-named: prose 65ch (long-form reading) · form 480px (auth, narrow single-column forms) · feed 640px (single-column timeline) · content 896px (settings/admin panes) · wide 1280px (dashboards, tables, card grids) · full 1536px (
|
|
9077
|
+
| max | "prose" \| "form" \| "feed" \| "content" \| "wide" \| "full" \| CSS length | — | Opt-in centered max-width cap, purpose-named: prose 65ch (long-form reading) · form 480px (auth, narrow single-column forms) · feed 640px (single-column timeline) · content 896px (settings/admin panes) · wide 1280px (dashboards, tables, card grids) · full 1536px (the largest cap; keeps the inset, so not edge to edge — that is bleed). Omit for fluid: work views whose panes, board or canvas use the extra width. A cap is a ceiling: it applies only once the viewport minus app chrome exceeds it, so judge it at 1920px and up. |
|
|
8958
9078
|
| bleed | boolean | false | Full-bleed: edge to edge with no inset. Overrides inset. |
|
|
8959
9079
|
| safeArea | boolean \| ("top"\|"bottom"\|"left"\|"right")[] | false | env(safe-area-inset-*) padding for fixed or native-shell surfaces. true pads top+bottom; pass an edge array to target edges. |
|
|
8960
9080
|
|
|
@@ -8972,7 +9092,7 @@ import { PageHeader, Region } from "@sableui/react"
|
|
|
8972
9092
|
<Region as="main" max="content"><PageHeader title="Settings" /></Region>
|
|
8973
9093
|
```
|
|
8974
9094
|
|
|
8975
|
-
###
|
|
9095
|
+
### Dashboard region (capped at wide)
|
|
8976
9096
|
|
|
8977
9097
|
```tsx
|
|
8978
9098
|
import { Card, CardHeader, CardTitle, Grid, Region } from "@sableui/react"
|
|
@@ -8980,6 +9100,14 @@ import { Card, CardHeader, CardTitle, Grid, Region } from "@sableui/react"
|
|
|
8980
9100
|
<Region max="wide"><Grid minItemWidth="16rem"><Card><CardHeader><CardTitle>Revenue</CardTitle></CardHeader></Card><Card><CardHeader><CardTitle>Collects</CardTitle></CardHeader></Card></Grid></Region>
|
|
8981
9101
|
```
|
|
8982
9102
|
|
|
9103
|
+
### Fluid workspace: the queue's table takes the extra width
|
|
9104
|
+
|
|
9105
|
+
```tsx
|
|
9106
|
+
import { Card, CardContent, Col, Columns, DataTable, Region, SideNav, SideNavItem } from "@sableui/react"
|
|
9107
|
+
|
|
9108
|
+
<Region as="main"><Columns count={{ base: 1, lg: 12 }}><Col span={{ base: 1, lg: 3 }}><SideNav aria-label="Views"><SideNavItem label="Open" active /><SideNavItem label="Pending" /></SideNav></Col><Col span={{ base: 1, lg: 9 }}><Card><CardContent flush><DataTable columns={columns} data={tickets} /></CardContent></Card></Col></Columns></Region>
|
|
9109
|
+
```
|
|
9110
|
+
|
|
8983
9111
|
---
|
|
8984
9112
|
|
|
8985
9113
|
# Page
|
|
@@ -10702,7 +10830,7 @@ Use Breadcrumbs to show the user's location inside a hierarchy and provide light
|
|
|
10702
10830
|
| Name | Type | Description |
|
|
10703
10831
|
| --- | --- | --- |
|
|
10704
10832
|
| BreadcrumbItem | ComponentPropsWithRef<'li'> | A single crumb slot (<li>) holding a link or the current page. |
|
|
10705
|
-
| BreadcrumbLink | ComponentPropsWithRef<'a'> | An interactive ancestor crumb (<a>). Muted by default, brightens to foreground on hover/focus. |
|
|
10833
|
+
| BreadcrumbLink | ComponentPropsWithRef<'a'> & { render?: useRender.RenderProp } | An interactive ancestor crumb (<a>). Muted by default, brightens to foreground on hover/focus. render composes another element with the crumb's styling, e.g. a router link: render={<Link to="/library" />}, so navigating stays in the app. |
|
|
10706
10834
|
| BreadcrumbPage | ComponentPropsWithRef<'span'> | The current-page crumb (<span aria-current="page">). Non-interactive, full-contrast. |
|
|
10707
10835
|
| BreadcrumbSeparator | ComponentPropsWithRef<'li'> + { children? } | Decorative divider (<li aria-hidden>) between crumbs. Defaults to a chevron-right icon; pass children to swap the glyph. |
|
|
10708
10836
|
|
|
@@ -10954,6 +11082,7 @@ Use Button when the user commits an action, submits a form, opens UI, or confirm
|
|
|
10954
11082
|
### Best practices
|
|
10955
11083
|
|
|
10956
11084
|
- Do: Use a single primary button in a view or dense panel so the action hierarchy stays obvious.
|
|
11085
|
+
- Do: For a copy control, pair an icon Button with `useCopy(text, { timeout? })`. It takes the text when the hook is called and returns `{ copy, copied }`; `copy()` takes no argument, so pass the value the button copies to the hook, not to `copy`.
|
|
10957
11086
|
- Do: Write labels as actions, such as "Save changes" or "Delete draft", instead of vague labels like "OK".
|
|
10958
11087
|
- Do: Use loading with loadingLabel for async work so the action cannot double-fire and the state is announced.
|
|
10959
11088
|
- Do: Put icons in iconStart / iconEnd rather than as children, so the button applies its optical padding. Start icons say what the action is (plus, share); end icons say where it goes (chevron-right, external).
|
|
@@ -11482,7 +11611,7 @@ import { Carousel } from "@sableui/react"
|
|
|
11482
11611
|
|
|
11483
11612
|
**Status:** stable
|
|
11484
11613
|
|
|
11485
|
-
The input half of a conversation: one surface holding attachments, an auto-growing field, and its controls. Enter sends, Shift+Enter breaks the line, and send becomes stop while a reply streams.
|
|
11614
|
+
The input half of a conversation: one surface holding attachments, an auto-growing field, and its controls. Enter sends, Shift+Enter breaks the line (sendOn="mod-enter" swaps them for long-form replies), and send becomes stop while a reply streams.
|
|
11486
11615
|
|
|
11487
11616
|
**Keywords:** chat input, composer, message input, prompt input, send message, ai chat, support chat, textarea
|
|
11488
11617
|
|
|
@@ -11499,7 +11628,7 @@ Pairs with MessageScroller to make a working chat. A single surface rather than
|
|
|
11499
11628
|
- Do: Building a docked agent panel inside a tool? Wrap the whole conversation — scroller, messages and composer — in `<Density value="compact">`. The entire set follows the workspace register from there: prose drops a tier, the rhythm tightens, and the controls come off the compact ladder. Do not hand-size it at the call site.
|
|
11500
11629
|
- Don't: Do not clear a controlled composer for the user on send. Only the caller knows whether the send succeeded, and clearing on their behalf loses the message when it did not.
|
|
11501
11630
|
- Don't: Do not add your own Enter-to-send handler on top. The built-in one already guards against firing mid-IME-composition, which is the line hand-rolled chat inputs miss.
|
|
11502
|
-
- Don't: Do not use it as a general multi-line input. That is `Textarea
|
|
11631
|
+
- Don't: Do not use it as a general multi-line input inside a larger form. That is `Textarea`. A standalone reply box that sends multi-paragraph messages (email, support replies) is this one with sendOn="mod-enter".
|
|
11503
11632
|
- Don't: Do not override the field's type utility to make it match your transcript. The field and `Bubble` both read the same tier already, which is what stops a message changing size the moment it is sent — overriding one breaks that pairing.
|
|
11504
11633
|
- Don't: Do not remove the height cap to let the field grow without limit. A pasted essay would push the conversation off the screen; past the cap it scrolls.
|
|
11505
11634
|
|
|
@@ -11521,6 +11650,7 @@ Pairs with MessageScroller to make a working chat. A single surface rather than
|
|
|
11521
11650
|
| onValueChange | (value: string) => void | — | Notified on every keystroke. Required when `value` is supplied. |
|
|
11522
11651
|
| onSend | (value: string) => void | — | Called with the trimmed message. An uncontrolled composer clears itself afterwards; a controlled one is the caller's to clear. |
|
|
11523
11652
|
| placeholder | string | "Send a message…" | Placeholder for the field. |
|
|
11653
|
+
| sendOn | "enter" \| "mod-enter" | "enter" | Which key sends. enter for chat (Shift+Enter breaks the line). mod-enter for long-form replies such as an email or a support answer: Enter breaks the line and Cmd/Ctrl+Enter sends, so a paragraph break never mails a draft. Say so in footer ("Cmd+Enter to send"). |
|
|
11524
11654
|
| busy | boolean | false | A reply is streaming. Disables send, and swaps it for a stop control when `onStop` is supplied. |
|
|
11525
11655
|
| onStop | () => void | — | Interrupt the in-flight reply. Supplying it turns send into stop while busy. |
|
|
11526
11656
|
| disabled | boolean | false | Block sending entirely — over a limit, disconnected, read-only thread. Distinct from `busy`, which is temporary and offers a way out (stop). |
|
|
@@ -12307,7 +12437,7 @@ Use CommandMenu for global or contextual keyboard-driven actions: navigation, cr
|
|
|
12307
12437
|
| useCommandMenuShortcut | (onShortcut: (event: KeyboardEvent) => void, key?: string \| false) => void | The page-wide ⌘K / Ctrl+K listener CommandMenuTrigger installs, for a palette with no visible trigger. Ignored while focus is in a text field, textarea, select or contenteditable (Ctrl+K belongs to the field there) except the palette's own input, so the callback may toggle. It calls preventDefault() on a match and skips an event already prevented, so two listeners on one page fire once. key defaults to "k"; false turns it off. Removed on unmount. |
|
|
12308
12438
|
| CommandMenuPanel | { items?: CommandItem[]; query?: string; onQueryChange?: (query: string) => void; filter?: CommandFilter; listClassName?: string; placeholder?: string; emptyMessage?: string; title?: string; scope?: ReactNode; inputProps?: ComponentProps<'input'>; className?: string; children?: ReactNode } | The palette rendered in place: the same search header, filtered and grouped listbox, keyboard model and result-count live region, on a static card (border-border, bg-card, no shadow) instead of in a Dialog. Takes every CommandMenu prop except open, onOpenChange, finalFocus and description; className lands on the card, title names the listbox. Focus is not trapped and the input does not take focus on mount (inputProps.autoFocus opts in). Esc clears the query, and passes through once it is empty, so a Popover around the panel still closes. A chosen row runs its onSelect and the panel stays as it was. The page-wide shortcut does not fire from its input. |
|
|
12309
12439
|
| CommandMenuGroup | { label: string; children } | A labelled group of command rows. |
|
|
12310
|
-
| CommandMenuItem | { onSelect?: () => void; icon?: string; detail?: ReactNode; hint?: ReactNode; disabled?: boolean; id?: string; children } | A selectable row. Self-filters by its text (unless the root was given a filter), runs onSelect, then closes the palette. detail is secondary text after the label; hint is the end-aligned trailing slot — a shortcut, a count, or a disabled row's reason. A disabled row stays listed, stays announced, and stays reachable by arrow key so its reason can be read, but is inert to Enter and to a click. |
|
|
12440
|
+
| CommandMenuItem | { onSelect?: () => void; icon?: string; detail?: ReactNode; stacked?: boolean; hint?: ReactNode; disabled?: boolean; id?: string; children } | A selectable row. Self-filters by its text (unless the root was given a filter), runs onSelect, then closes the palette. detail is secondary text after the label, or under it with stacked; hint is the end-aligned trailing slot — a shortcut, a count, or a disabled row's reason. A disabled row stays listed, stays announced, and stays reachable by arrow key so its reason can be read, but is inert to Enter and to a click. |
|
|
12311
12441
|
|
|
12312
12442
|
## Props
|
|
12313
12443
|
|
|
@@ -12317,7 +12447,7 @@ Use CommandMenu for global or contextual keyboard-driven actions: navigation, cr
|
|
|
12317
12447
|
| inputProps | Omit<ComponentProps<'input'>, 'role' \| 'value' \| 'onChange' \| aria-*> | — | Extra props for the search input. `onKeyDown` runs BEFORE the palette's own handling and opts out of a key by calling preventDefault() — which is what makes a scope chip Backspace-dismissable. Running first is deliberate: Backspace happens not to be a key the palette claims today, so a plain passthrough would work until the palette grows a 'Backspace clears the query' affordance, at which point the consumer's behaviour breaks silently. The combobox wiring (role, aria relationships, controlled value) is not overridable; aria-label and className compose. |
|
|
12318
12448
|
| open | boolean | — | Controlled open state of the palette. |
|
|
12319
12449
|
| onOpenChange | (open: boolean) => void | — | Called on open/close (select, Esc, outside click). |
|
|
12320
|
-
| items | CommandItem[] | — | Data-driven commands ({ group, label, onSelect, id?, icon?, detail?, hint?, disabled? }). Ignored when children are provided. id is optional identity: filter is handed these same objects, so it is how a caller that ranks over its own richer model maps the array back onto it — and it becomes the row's DOM id (namespaced to the palette) and React key, so two rows may share a label. |
|
|
12450
|
+
| items | CommandItem[] | — | Data-driven commands ({ group, label, onSelect, id?, icon?, detail?, stacked?, hint?, disabled? }). stacked puts detail on its own line under the label, for results only their detail tells apart (two tickets with one subject); beside a long label an inline detail truncates first. Ignored when children are provided. id is optional identity: filter is handed these same objects, so it is how a caller that ranks over its own richer model maps the array back onto it — and it becomes the row's DOM id (namespaced to the palette) and React key, so two rows may share a label. |
|
|
12321
12451
|
| query | string | — | Controlled query. Leave undefined to let the palette own it; either way it resets on close (a controlled caller gets onQueryChange('')). |
|
|
12322
12452
|
| onQueryChange | (query: string) => void | — | Called on every query change. Required to control query, optional otherwise. |
|
|
12323
12453
|
| filter | ((items: CommandItem[], query: string) => CommandItem[]) \| null | case-insensitive substring match on label | Replaces or disables the built-in match. A function ranks and filters items itself and its order is kept verbatim; null renders items exactly as given. Either also stops declarative CommandMenuItem children self-filtering. The query arrives raw — trimming and case are policy, and this is the prop that hands policy over. |
|
|
@@ -12618,7 +12748,11 @@ Use DataTable when a data array and column definition should render a sortable,
|
|
|
12618
12748
|
| data | Row[] | — | The rows to render. |
|
|
12619
12749
|
| rowKey | (row, index) => string \| number | index | Stable React key per row. |
|
|
12620
12750
|
| onRowClick | (row) => void | — | Row click handler — makes rows pointer-interactive. |
|
|
12621
|
-
| isRowSelected | (row) => boolean | — | Mark a row visually selected (data-selected). Derive it from a stable id (row.id === selectedId), not the row index, so selection survives re-sorts. |
|
|
12751
|
+
| isRowSelected | (row) => boolean | — | Mark a row visually selected (data-selected), e.g. the one open in a detail pane. Derive it from a stable id (row.id === selectedId), not the row index, so selection survives re-sorts. For checking several rows, use selectedKeys. |
|
|
12752
|
+
| selectedKeys | ReadonlySet<string \| number> | — | The checked rows, by rowKey, for bulk actions. With onSelectedKeysChange it adds a checkbox column (each box named by rowSelectionLabel) and a select-all box in the header that acts on the rows shown and goes mixed when some are checked. Checked rows get the selected fill. Controlled: when the rows shown change (a filter, another view), set the keys to keep, usually none. Needs rowKey. |
|
|
12753
|
+
| onSelectedKeysChange | (keys: Set<string \| number>) => void | — | Called with the new set of checked keys. Its presence turns selection on. A click on a box never fires onRowClick. |
|
|
12754
|
+
| rowSelectionLabel | (row) => string | () => "Select row" | A row checkbox's accessible name. Name the row, e.g. (t) => `Select ${t.subject}`, so a screen reader can tell the boxes apart. |
|
|
12755
|
+
| selectAllLabel | (count: number) => string | (count) => `Select all ${count} shown` | The select-all checkbox's accessible name; say what it acts on ("Select all 7 tickets shown"). |
|
|
12622
12756
|
| defaultSort | { key: string; direction: "asc" \| "desc" } | — | Initial sort column + direction. |
|
|
12623
12757
|
| empty | ReactNode | "No results." | Rendered spanning all columns when data is empty. Pass an EmptyState for the full treatment (icon, title, next step). |
|
|
12624
12758
|
| caption | ReactNode | — | Bottom table caption. |
|
|
@@ -12640,6 +12774,34 @@ Use DataTable when a data array and column definition should render a sortable,
|
|
|
12640
12774
|
|
|
12641
12775
|
## Examples
|
|
12642
12776
|
|
|
12777
|
+
### Checkbox selection with a bulk-action bar
|
|
12778
|
+
|
|
12779
|
+
```tsx
|
|
12780
|
+
import { Button, DataTable, Stack, Toolbar } from "@sableui/react"
|
|
12781
|
+
|
|
12782
|
+
const [selected, setSelected] = useState<Set<string | number>>(new Set())
|
|
12783
|
+
|
|
12784
|
+
<Stack gap={2}>
|
|
12785
|
+
{/* Mounted from the start, so a screen reader hears each change. */}
|
|
12786
|
+
<span role="status" className="sr-only">{selected.size ? `${selected.size} of ${tickets.length} selected` : ""}</span>
|
|
12787
|
+
{selected.size ? (
|
|
12788
|
+
<Toolbar aria-label="Bulk actions">
|
|
12789
|
+
<span className="text-label-md">{selected.size} of {tickets.length} selected</span>
|
|
12790
|
+
<Button size="sm" variant="secondary" onClick={() => resolve(selected)}>Resolve</Button>
|
|
12791
|
+
</Toolbar>
|
|
12792
|
+
) : null}
|
|
12793
|
+
<DataTable
|
|
12794
|
+
data={tickets}
|
|
12795
|
+
rowKey={(t) => t.id}
|
|
12796
|
+
columns={columns}
|
|
12797
|
+
selectedKeys={selected}
|
|
12798
|
+
onSelectedKeysChange={setSelected}
|
|
12799
|
+
rowSelectionLabel={(t) => `Select ${t.subject}`}
|
|
12800
|
+
selectAllLabel={(n) => `Select all ${n} tickets shown`}
|
|
12801
|
+
/>
|
|
12802
|
+
</Stack>
|
|
12803
|
+
```
|
|
12804
|
+
|
|
12643
12805
|
### Sortable columns
|
|
12644
12806
|
|
|
12645
12807
|
```tsx
|
|
@@ -13854,16 +14016,17 @@ Use Form and Field as the default wrapper for Sable form controls. Field owns th
|
|
|
13854
14016
|
|
|
13855
14017
|
| Name | Type | Description |
|
|
13856
14018
|
| --- | --- | --- |
|
|
13857
|
-
| Field | { label?: ReactNode; description?: ReactNode; error?: ReactNode; required?: boolean; disabled?: boolean; name?: string; validate?: (value, formValues) => string \| string[] \| null \| Promise<…>; validationMode?: "onSubmit" \| "onBlur" \| "onChange"; validationDebounceTime?: number; orientation?: "vertical" \| "horizontal"; className?: string; children: ReactElement } | Wraps a single control element (e.g. <Input />) on Base UI Field and wires label (htmlFor + aria-labelledby), helper text and error (aria-describedby), aria-invalid, and required onto it automatically. Base UI-backed controls (Input, Textarea, Select, Combobox, NumberField, Checkbox, Switch, Slider, OtpField…) register through context; the child is also cloned so plain elements keep the same wiring. error renders a destructive message and takes precedence; without it the slot shows Base UI's validation message
|
|
14019
|
+
| Field | { label?: ReactNode; description?: ReactNode; error?: ReactNode; required?: boolean; messages?: Partial<Record<"valueMissing" \| "typeMismatch" \| "patternMismatch" \| "tooShort" \| "tooLong" \| "rangeUnderflow" \| "rangeOverflow" \| "stepMismatch" \| "badInput", ReactNode>>; disabled?: boolean; name?: string; validate?: (value, formValues) => string \| string[] \| null \| Promise<…>; validationMode?: "onSubmit" \| "onBlur" \| "onChange"; validationDebounceTime?: number; orientation?: "vertical" \| "horizontal"; className?: string; children: ReactElement } | Wraps a single control element (e.g. <Input />) on Base UI Field and wires label (htmlFor + aria-labelledby), helper text and error (aria-describedby), aria-invalid, and required onto it automatically. Base UI-backed controls (Input, Textarea, Select, Combobox, NumberField, Checkbox, Switch, Slider, OtpField…) register through context; the child is also cloned so plain elements keep the same wiring. error renders a destructive message and takes precedence; without it the slot shows the field's messages entry for the native constraint that failed (messages={{ valueMissing: "Enter a subject." }}), else Base UI's validation message (the browser's wording for a native constraint, validate, or Form errors). required adds the native attribute plus a visual asterisk (defaults to false). disabled disables the control and dims the label. name keys the field in Form errors / onFormSubmit. validationMode overrides the Form's. orientation defaults to "vertical" (label → control); "horizontal" places control then label inline for a single checkbox / switch / radio — the control centres on the label's first line (it stays there when the label wraps) and description/error sit in the label's column. The root, label, description, error and control carry data-invalid / data-valid, data-touched, data-dirty, data-filled, data-focused and data-disabled for state styling. |
|
|
13858
14020
|
|
|
13859
14021
|
## Props
|
|
13860
14022
|
|
|
13861
14023
|
| Name | Type | Default | Description |
|
|
13862
14024
|
| --- | --- | --- | --- |
|
|
13863
|
-
| Form | { validationMode?: "onSubmit" \| "onBlur" \| "onChange"; errors?: Record<string, string \| string[]>; onFormSubmit?: (values, details) => void; actionsRef?: RefObject<Form.Actions> } + ComponentPropsWithRef<"form"> | — | A <form> laid out as a vertical column with comfortable field spacing (override with className, e.g. gap-4). On submit it validates every Field (native constraints plus Field validate), shows each message under its field, focuses the first invalid control, and only then calls onSubmit. validationMode defaults to "onSubmit" (then live re-validation on change). errors shows external (e.g. server) messages keyed by Field name and clears one when its field is edited. onFormSubmit receives the named Field values and prevents the native submit. A control outside any Field is still checked by the browser before onSubmit runs
|
|
14025
|
+
| Form | { validationMode?: "onSubmit" \| "onBlur" \| "onChange"; errors?: Record<string, string \| string[]>; onFormSubmit?: (values, details) => void; actionsRef?: RefObject<Form.Actions> } + ComponentPropsWithRef<"form"> | — | A <form> laid out as a vertical column with comfortable field spacing (override with className, e.g. gap-4). On submit it validates every Field (native constraints plus Field validate), shows each message under its field, focuses the first invalid control, and only then calls onSubmit. validationMode defaults to "onSubmit" (then live re-validation on change). errors shows external (e.g. server) messages keyed by Field name and clears one when its field is edited. onFormSubmit receives the named Field values and prevents the native submit. A control outside any Field is still checked by the browser before onSubmit runs. Validating in your own code (react-hook-form, a schema, state)? Pass noValidate: onSubmit always runs and each Field shows the error you set; without it an empty required Field stops the submit before your handler can set that error. |
|
|
13864
14026
|
| validationMode | "onSubmit" \| "onBlur" \| "onChange" | "onSubmit" | When Fields validate. After the first submit, fields re-check as the user edits. A Field's own validationMode wins. |
|
|
13865
14027
|
| errors | Record<string, string \| string[]> | — | External (e.g. server) messages keyed by Field name, shown under that field. Each clears when its field is edited. |
|
|
13866
14028
|
| onFormSubmit | (values: Record<string, unknown>, details) => void | — | Called with the named Field values after validation passes; prevents the native submit. |
|
|
14029
|
+
| noValidate | boolean | false | Your code owns validation: nothing is checked before onSubmit (neither the Fields nor the browser), so it always runs and each Field shows the error you pass. required Fields keep their asterisk and aria-required. validationMode, errors, onFormSubmit and actionsRef do nothing with it. |
|
|
13867
14030
|
| actionsRef | RefObject<{ validate(name?: string): void }> | — | Imperative handle to validate every field, or one by name. |
|
|
13868
14031
|
|
|
13869
14032
|
## Tokens used
|
|
@@ -13900,6 +14063,22 @@ import { Field, Input } from "@sableui/react"
|
|
|
13900
14063
|
<Field label="Password" error="Must be at least 8 characters."><Input type="password" /></Field>
|
|
13901
14064
|
```
|
|
13902
14065
|
|
|
14066
|
+
### Your own wording for a missing value
|
|
14067
|
+
|
|
14068
|
+
```tsx
|
|
14069
|
+
import { Button, Field, Form, Input } from "@sableui/react"
|
|
14070
|
+
|
|
14071
|
+
<Form onSubmit={handleSubmit}><Field label="Subject" required messages={{ valueMissing: "Enter a subject." }}><Input name="subject" /></Field><Button type="submit">Send</Button></Form>
|
|
14072
|
+
```
|
|
14073
|
+
|
|
14074
|
+
### Validation in your own code
|
|
14075
|
+
|
|
14076
|
+
```tsx
|
|
14077
|
+
import { Button, Field, Form, Input } from "@sableui/react"
|
|
14078
|
+
|
|
14079
|
+
<Form noValidate onSubmit={handleSubmit}><Field label="Subject" required error={errors.subject}><Input name="subject" /></Field><Button type="submit">Send</Button></Form>
|
|
14080
|
+
```
|
|
14081
|
+
|
|
13903
14082
|
### Validated on submit
|
|
13904
14083
|
|
|
13905
14084
|
```tsx
|
|
@@ -15248,7 +15427,7 @@ The scroll region a conversation lives in. It owns the scrolling and nothing els
|
|
|
15248
15427
|
|
|
15249
15428
|
| Name | Type | Default | Description |
|
|
15250
15429
|
| --- | --- | --- | --- |
|
|
15251
|
-
| ref | Ref<MessageScrollerHandle> | — | Imperative commands, not the DOM node: `scrollToBottom(opts)`, `scrollToTop(opts)`, `scrollToMessage(id, opts)` (returns false when the message is not rendered), `isFollowing()`, and `element` for the scrolling node itself. |
|
|
15430
|
+
| ref | Ref<MessageScrollerHandle> | — | Imperative commands, not the DOM node: `scrollToBottom(opts)`, `scrollToTop(opts)`, `scrollToMessage(id, opts)` (returns false when the message is not rendered), `isFollowing()`, and `element` for the scrolling node itself. `opts` is `ScrollCommandOptions`: `{ animate?: boolean }` (default true, and off whenever motion is), not the DOM's `behavior`. |
|
|
15252
15431
|
| autoFollow | boolean | true | Keep the newest message in view as content arrives, until the reader scrolls away from the bottom. Set false for a transcript that must never move under the reader. |
|
|
15253
15432
|
| followThreshold | number | 64 | Distance from the bottom, in px, that still counts as following. A band rather than a pixel, so a token arriving mid-frame does not flicker the state. |
|
|
15254
15433
|
| onFollowChange | (following: boolean) => void | — | Notified when the viewport pins to, or releases from, the newest message. |
|
|
@@ -15941,7 +16120,7 @@ Use PageHeader to establish a page's title, supporting description, and primary
|
|
|
15941
16120
|
| title | ReactNode | — | The page title (renders an <h1>). |
|
|
15942
16121
|
| description | ReactNode | — | Supporting copy beneath the title. |
|
|
15943
16122
|
| back | ReactNode | — | Leading element before the title — typically a back control on drill-in routes. Keep it a ghost icon Button (size="icon", variant="ghost", aria-label="Back") so it stays quieter than the title. A ghost back control bleeds by its inset at the start, so its glyph lines up with the content edge below (Button bleed="none" opts out). |
|
|
15944
|
-
| actions | ReactNode | — | Trailing actions aligned to the title row's end. They drop under the title when the
|
|
16123
|
+
| actions | ReactNode | — | Trailing actions aligned to the title row's end. They drop under the title when the title would have less than 20rem beside them (on a phone, nearly always), and the title wraps rather than truncating. A ghost or link Button at either end of the group bleeds by its own padding, so its label meets the content edge (the end on the title row, the start once wrapped); filled buttons keep their edge on the line. Direct children only. |
|
|
15945
16124
|
| titleAs | "h1" \| "h2" | "h1" | The title's heading element. Keep h1 — the route's one h1. Use h2 only when something above already owns the h1: a shell that renders the route title, or a page showing a PageHeader as an example. |
|
|
15946
16125
|
|
|
15947
16126
|
## Tokens used
|
|
@@ -16510,7 +16689,7 @@ Use PieChart for a share of one total across two to six categories — traffic s
|
|
|
16510
16689
|
| categories | Record<string, { label?: string; tone?: ChartTone; color?: string; icon?: string }> | — | Labels, tones and icons per slice, keyed by the slice's name. Unlisted slices take the tones in order. |
|
|
16511
16690
|
| className | string | "h-64" | Sizes the chart. Set a height. |
|
|
16512
16691
|
| donut | boolean \| number | false | Cut out the middle: `true` for a ring at 60% of the radius, or a ratio (0–0.9). |
|
|
16513
|
-
| centerLabel | { value: string; label?: string } | — | A value and caption in the hole of a donut. |
|
|
16692
|
+
| centerLabel | { value: string \| number; label?: string } | — | A value and caption in the hole of a donut. The value holds the centre and the caption hangs below it. A number is formatted for you: in full up to 9,999, compact from 10,000 (10.2K, 102.1K, 1.2M); pass a string for units. |
|
|
16514
16693
|
| separator | boolean | true | A hairline in the surface colour between slices. |
|
|
16515
16694
|
| labels | "none" \| "outside" \| "inside" | "none" | Label each slice outside the pie or inside it. |
|
|
16516
16695
|
| labelContent | "value" \| "percent" \| "name" | "value" | What a slice label says. |
|
|
@@ -16564,7 +16743,7 @@ const sources = [
|
|
|
16564
16743
|
index="source"
|
|
16565
16744
|
valueKey="visitors"
|
|
16566
16745
|
donut
|
|
16567
|
-
centerLabel={{ value:
|
|
16746
|
+
centerLabel={{ value: 752, label: "Visitors" }}
|
|
16568
16747
|
/>
|
|
16569
16748
|
```
|
|
16570
16749
|
|
|
@@ -16988,7 +17167,7 @@ Use RadialChart for progress toward goals (several rings), a single score or usa
|
|
|
16988
17167
|
| stacked | boolean | false | Split ONE ring between the rows instead of a ring each. |
|
|
16989
17168
|
| track | boolean | true | Draw each ring's full track behind it. |
|
|
16990
17169
|
| labels | boolean | false | Name each ring at its start. |
|
|
16991
|
-
| centerLabel | { value: string; label?: string } | — | A value and caption in the middle. |
|
|
17170
|
+
| centerLabel | { value: string \| number; label?: string } | — | A value and caption in the middle. On a full ring the value holds the centre and the caption hangs below it. A number is formatted for you: in full up to 9,999, compact from 10,000 (10.2K); pass a string for units ("7.2 GB", "72%"). |
|
|
16992
17171
|
| legend | boolean | true unless rings are labelled | Show the legend. |
|
|
16993
17172
|
| tooltip | boolean \| { indicator?: "dot" \| "line" \| "dashed" \| "none"; hideLabel?: boolean; labelFormatter?: (label, datum) => ReactNode; showTotal?: boolean } | true | Show a tooltip on hover and keyboard focus, or configure it: the row marker, hiding the heading, rewriting it, adding a Total row. |
|
|
16994
17173
|
| valueFormatter | (value: number) => string | — | Format values everywhere (axis, labels, tooltip, table) — units like "$12,480". Default: compact on the axis, full elsewhere. |
|
|
@@ -18020,7 +18199,7 @@ import { Row, Separator } from "@sableui/react"
|
|
|
18020
18199
|
|
|
18021
18200
|
**Status:** stable
|
|
18022
18201
|
|
|
18023
|
-
A compact trigger that states the current settings, over a menu of rows that change them. Each row shows its own value and opens a submenu.
|
|
18202
|
+
A compact trigger that states the current settings, over a menu of rows that change them. Each row shows its own value and opens a submenu; with one setting, the menu opens straight to its options under the row's label.
|
|
18024
18203
|
|
|
18025
18204
|
**Keywords:** settings, model picker, model switcher, options menu, preferences, submenu, quality settings, ai chat
|
|
18026
18205
|
|
|
@@ -18360,6 +18539,7 @@ Use Sidebar for persistent desktop navigation or application chrome outside the
|
|
|
18360
18539
|
|
|
18361
18540
|
| Name | Type | Description |
|
|
18362
18541
|
| --- | --- | --- |
|
|
18542
|
+
| SidebarHeader | div props | The top of the rail, at least 64px tall. It holds SidebarBrand and may take a second row under it, such as a search field or a notifications button: give that row basis-full and the header grows to hold it instead of clipping. |
|
|
18363
18543
|
| SidebarBrand | { mark: ReactNode; label: ReactNode; render?: useRender.RenderProp } + div props | The brand row, inside SidebarHeader, on the same grid as SidebarItem: mark in the icons' 24px slot, label on the labels' column, so a logo lines up with the nav below it without copying the rail's inset numbers. Collapsed, it shows the mark alone (named by a string label). render={<Link to="/" />} makes it the home link. |
|
|
18364
18544
|
| SidebarItem | { label: ReactNode; icon?: ReactNode; active?: boolean; badge?: ReactNode; render?: useRender.RenderProp } + button props | A single nav row. label is the row text (inline when expanded, in a hover tooltip when collapsed); icon is the leading icon node (the consumer swaps fill weight for the active state); active marks the current route (accent fill + aria-current="page"); badge is a trailing node (e.g. a count) pushed to the row end and hidden when collapsed; render composes another element, e.g. render={<Link to="/x" />}. |
|
|
18365
18545
|
|
|
@@ -19285,7 +19465,7 @@ import { StreamingText } from "@sableui/react"
|
|
|
19285
19465
|
|
|
19286
19466
|
**Status:** stable
|
|
19287
19467
|
|
|
19288
|
-
Binary on/off toggle for immediate-effect settings. Track fills with the primary tone when checked; the thumb slides on a spring-eased transform (mirrored in RTL).
|
|
19468
|
+
Binary on/off toggle for immediate-effect settings. Track fills with the primary tone when checked; the thumb slides on a spring-eased transform (mirrored in RTL). The thumb is white in both states, like every physical toggle, and turns dark only on a near-white track (a dark mode's light primary). Themes can set --theme-switch-thumb-on.
|
|
19289
19469
|
|
|
19290
19470
|
**Keywords:** switch, toggle setting, on off, form control
|
|
19291
19471
|
|
|
@@ -19315,7 +19495,7 @@ Use Switch for immediate on/off settings that take effect as a persistent prefer
|
|
|
19315
19495
|
|
|
19316
19496
|
## Tokens used
|
|
19317
19497
|
|
|
19318
|
-
`input`, `primary`, `
|
|
19498
|
+
`input`, `primary`, `ring`
|
|
19319
19499
|
|
|
19320
19500
|
## Motion
|
|
19321
19501
|
|
package/llms.txt
CHANGED
|
@@ -447,7 +447,7 @@ import { Button, Card, IconProvider, MotionProvider, SableThemeProvider, useSabl
|
|
|
447
447
|
- **SettingsMenu** — A compact trigger that states the current settings, over a menu of rows that change them. *Parts:* SettingsRow, MenuRadioGroup, MenuRadioItem. → [`llms/components/settings-menu.md`](./llms/components/settings-menu.md)
|
|
448
448
|
- **Sheet** — Edge-anchored drawer over Base UI Drawer — focus trap, scroll lock, Esc/outside dismissal, portal backdrop, plus swipe-to-dismiss on touch. *Parts:* SheetContent, SheetTrigger, SheetClose, SheetHeader, SheetTitle, SheetDescription, SheetList, SheetFooter. → [`llms/components/sheet.md`](./llms/components/sheet.md)
|
|
449
449
|
- **ShowMore** — Collapsible content region that clips children to a collapsed height, fades the cut edge, and reveals the rest with a toggle. → [`llms/components/show-more.md`](./llms/components/show-more.md)
|
|
450
|
-
- **Sidebar** — Desktop side-navigation rail (in-flow sticky, hidden below lg) with SidebarHeader / SidebarBrand / SidebarNav / SidebarItem / SidebarFooter parts. *Parts:* SidebarBrand, SidebarItem. → [`llms/components/sidebar.md`](./llms/components/sidebar.md)
|
|
450
|
+
- **Sidebar** — Desktop side-navigation rail (in-flow sticky, hidden below lg) with SidebarHeader / SidebarBrand / SidebarNav / SidebarItem / SidebarFooter parts. *Parts:* SidebarHeader, SidebarBrand, SidebarItem. → [`llms/components/sidebar.md`](./llms/components/sidebar.md)
|
|
451
451
|
- **SideNav** — A lightweight in-content vertical navigation list - the settings / docs sub-nav, distinct from the app-chrome Sidebar. *Parts:* SideNavItem, SideNavGroup. → [`llms/components/side-nav.md`](./llms/components/side-nav.md)
|
|
452
452
|
- **Skeleton** — Loading placeholder — a muted, shimmering block (rounded-md bg-muted motion-shimmer). → [`llms/components/skeleton.md`](./llms/components/skeleton.md)
|
|
453
453
|
- **Slider** — Slider over Base UI Slider — pointer + keyboard control, ARIA slider wiring, and range support via multiple thumbs. *Parts:* SliderRoot, SliderControl, SliderTrack, SliderIndicator, SliderThumb, SliderValue. → [`llms/components/slider.md`](./llms/components/slider.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sableui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Sable: themeable React components, layout patterns, and tools for coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -124,7 +124,9 @@
|
|
|
124
124
|
"THIRD_PARTY_NOTICES.md",
|
|
125
125
|
"third-party",
|
|
126
126
|
"scripts/agent-setup.mjs",
|
|
127
|
-
"scripts/design-presets.mjs"
|
|
127
|
+
"scripts/design-presets.mjs",
|
|
128
|
+
"scripts/patches.mjs",
|
|
129
|
+
"scripts/sources.mjs"
|
|
128
130
|
],
|
|
129
131
|
"publishConfig": {
|
|
130
132
|
"registry": "https://registry.npmjs.org",
|