@apliteni/apliteni-ui 0.178.0 → 0.179.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.
@@ -1,79 +1,71 @@
1
1
  # Components (`@apliteni/apliteni-ui`)
2
2
 
3
- A design system of tokens, one stylesheet per component, and React components. The root entry
4
- publishes the helpers the React components share — `icon`, `prism`, `sun`, `moon`, `brand`,
5
- `esc`, `safeUrl`, the motion helpers and the shared logic.
6
-
7
- ```js
8
- import { icon } from '@apliteni/apliteni-ui';
9
- icon('check');
10
- // → '<svg viewBox="0 0 24 24" …>'
11
- ```
12
-
13
- This page describes what ships, what to import, every published name, and what each component
14
- promises. [foundations.md](foundations.md) covers the other half: the tokens and the floors.
3
+ This page tells you which component to use for a screen, how to call it and what the user sees.
4
+ [foundations.md](foundations.md) gives the tokens and the floors that every component keeps.
15
5
  The design rules for a screen are in [the guidelines](../guidelines/overview.md). React's notes
16
6
  are in [react/README.md](../react/README.md).
17
7
 
8
+ ```tsx
9
+ import '@apliteni/apliteni-ui/css';
10
+ import '@apliteni/apliteni-ui/react/css';
11
+ import { Button } from '@apliteni/apliteni-ui/react';
12
+
13
+ <Button variant="primary" onClick={save}>Save</Button>
14
+ ```
15
+
18
16
  ## Entry points
19
17
 
20
18
  | Import | Use |
21
19
  |--------|-----|
22
- | `@apliteni/apliteni-ui` | The helpers and shared logic (`icon`, `prism`, `brand`, `esc`, `safeUrl`, …), with TypeScript declarations. |
23
- | `…/css` | The whole stylesheet, for bundler/browser builds. |
24
- | `…/inline` | CSS as **strings**, for server-render inlining (`tokensCss`, `topbarCss`, `cssText`, …). |
25
- | `…/tokens`, `…/accents` | Just the tokens / accent sub-themes. |
26
- | `…/react`, `…/react/css` | The React wrapper over the same CSS, and its own stylesheet. |
20
+ | `@apliteni/apliteni-ui/react` | The React components. Most screens need only this entry and the two stylesheets. |
21
+ | `@apliteni/apliteni-ui/css` | The whole kit stylesheet, for bundler and browser builds. |
22
+ | `@apliteni/apliteni-ui/react/css` | The styles that the React components add to the kit stylesheet. |
23
+ | `@apliteni/apliteni-ui` | The shared helpers: `icon`, `brand`, `esc`, `safeUrl`, the motion helpers and the shared logic. See [Shared helpers](#shared-helpers). |
24
+ | `…/inline` | The CSS as strings, for a server that inlines it (`tokensCss`, `topbarCss`, `cssText`, …). |
25
+ | `…/tokens`, `…/accents` | Only the tokens, or only the accent themes. |
27
26
  | `…/motion` | The motion helpers. |
28
27
  | `…/guidelines/*` | The guideline pages, as Markdown. |
29
28
 
30
- There is no runtime dependency and no build step between the source and the stylesheet you read.
31
- You can ship the package as it is. `…/css` and `…/inline`'s `cssText` contain the same
32
- stylesheets in the same cascade order. If you take individual sheets from `styles`, you must
33
- also take every sheet the component needs. For example, `successPanel()` needs `styles.callout`
34
- and `styles.success`, both after `tokensCss` and `baseCss`.
35
-
36
- ### The React stylesheet does not re-emit a kit sheet
29
+ The package has no runtime dependency and no build step. You can ship it as it is. `…/css` and
30
+ the `cssText` of `…/inline` hold the same stylesheets in the same order. If you take single
31
+ sheets from `styles`, take every sheet that a component needs, after `tokensCss` and `baseCss`.
37
32
 
38
- Import `@apliteni/apliteni-ui/css` first, then import `@apliteni/apliteni-ui/react/css`. You
39
- need both. The React stylesheet contains what React's own components add. It does not contain a
40
- second copy of the kit.
33
+ ### Load both stylesheets
41
34
 
42
- **The kit CSS is a peer, not a dependency of a React component.** If a React module imported a
43
- kit sheet, that sheet would be re-emitted into `react/dist/index.css`. It would then appear after
44
- the kit's own copy in your document. At equal specificity, it would overrule the kit's copy.
35
+ Import `@apliteni/apliteni-ui/css` first, then `@apliteni/apliteni-ui/react/css`. The React
36
+ stylesheet holds only what the React components add. It holds no second copy of the kit, so a
37
+ React stylesheet that loads later cannot override a kit rule.
45
38
 
46
- Four sheets travel with the React bundle. They do so because changing their order cannot change
47
- what they decide: the reduced-motion net, the 16px field net, the tap-zone sheet, and the hover
48
- readout's sheet. Each is behind a media query or is written so it has no specificity to lose.
49
- They support the consumer who uses `@apliteni/apliteni-ui/react/css` alone.
39
+ Four sheets travel in both stylesheets, because their order cannot change the result: the
40
+ reduced-motion net, the 16px field net, the tap-zone sheet and the hover readout sheet. A page
41
+ that loads only `react/css` still gets them.
50
42
 
51
- ## Tokens & theming
43
+ ## Themes and accents
52
44
 
53
- Everything visual uses a CSS custom property. Two independent attributes on `<html>` control
54
- those properties:
45
+ Every colour is a CSS custom property. Two attributes on `<html>` select the values:
55
46
 
56
47
  ```html
57
- <html data-theme="dark" data-accent="phoenix">
48
+ <html data-theme="light" data-accent="phoenix">
58
49
  ```
59
50
 
60
- - **`data-theme`** = `dark | light` — controls surfaces, text, borders, and the fixed signal colours.
61
- - **`data-accent`** = `phoenix | ocean | emerald` (absent = **Nebula**, the purple default) —
62
- changes only the accent family, so every accent works in both themes without a component
63
- change.
51
+ - **`data-theme`** is `dark` or `light`. It sets the surfaces, the text, the borders and the
52
+ signal colours.
53
+ - **`data-accent`** is `phoenix`, `ocean` or `emerald`. Without it, the accent is **Nebula**,
54
+ the purple default. The accent changes only the accent colours, so every accent works in both
55
+ themes.
64
56
 
65
- Neither attribute controls type. `--font-display` is for headings and brand marks,
66
- `--font-sans` is for everything read, and `--font-mono` is for code. Neither font family ships
67
- with the package. The host page loads both. See [Typefaces](foundations.md#typefaces).
57
+ Neither attribute changes the type. `--font-display` is for headings and brand marks,
58
+ `--font-sans` is for all text that the user reads, and `--font-mono` is for code. The package
59
+ does not ship the font files, so your page loads them. See [Typefaces](foundations.md#typefaces).
68
60
 
69
- `applyTheme('light')` and `applyAccent('phoenix')` save their values to `localStorage`.
70
- `ACCENTS` lists the names that `applyAccent` accepts. You can also ship `accentPicker()` and
71
- let `wireTopbar()` handle it.
61
+ Use `ThemeToggle` to let the user choose the theme. Put `THEME_INIT_SCRIPT` in a `<script>` in
62
+ the `<head>`, so the first paint has the stored theme. Use `AccentPicker` to let the user choose
63
+ the accent. It calls `onChange`. Your page sets `data-accent` and stores the choice. `ACCENTS`
64
+ from the root entry lists the accent names.
72
65
 
73
66
  ### An absent attribute means dark
74
67
 
75
- `data-theme` and `data-accent` are optional **overrides**. If neither attribute is present, the
76
- kit renders dark Nebula.
68
+ `data-theme` and `data-accent` are optional. Without them, the kit shows dark Nebula.
77
69
 
78
70
  ```html
79
71
  <html> <!-- dark, Nebula -->
@@ -81,804 +73,269 @@ kit renders dark Nebula.
81
73
  <html data-theme="light"> <!-- light, Nebula -->
82
74
  ```
83
75
 
84
- ## Component catalog
85
-
86
- Each published name appears once, with the section that defines its behaviour. The options show
87
- what a factory accepts. They do not describe what the factory does.
88
-
89
- ### Content and status
90
-
91
- | Name | What it is |
92
- |------|------------|
93
- | `button({ label, variant, size, icon, iconRight, block, disabled, busy, href, iconOnly })` | `<button>`, or `<a>` with `href`. See [Extra-small buttons](#extra-small-buttons). |
94
- | `setButtonBusy(element, { busy })` | Flips a mounted button to its busy state and back. See [Busy button labels](#busy-button-labels). |
95
- | `badge(label, variant)`, `pill(label, variant)`, `statusDot(live)` | Status chip, rounded chip, live dot. |
96
- | `avatar({ key, name, initials, src, size, empty })`, `avatarHue(key)`, `avatarInitials(name)`, `AVATAR_HUES` | A person's mark. See [Avatar](#avatar). |
97
- | `card({ title, sub, body, variant, pad, icon, level })` | Surface container. `title` and `sub` are trusted markup; keep the title to inline content. |
98
- | `callout`, `toast`, `successPanel` | Inline feedback inside the page the reader is on; `calloutIcons` is the default glyph per tone. |
99
- | `pushToast(container, opts)`, `dismissToast(el)`, `wireToastStack(container)` | The runtime toast stack. |
100
- | `success({ layout, check, level, title, body, actions, confetti, countdown })` + `wireSuccess(root)` | Page-sized confirmation; `successCheck()` is its mark alone. See [Success confirmations](#success-confirmations) and [successPanel or success?](#successpanel-or-success). |
101
- | `emptyState({ art, icon, title, sub, actions })` | Placeholder for an empty list, table or page; `art` is an `illo()` name or raw SVG. |
102
- | `deniedState({ title, sub, need, actions, icon })` | The 403, in the same layout language. See [Pending and denied states](#pending-and-denied-states). |
103
- | `busyRegion({ label, readyLabel, busy, body, lines })` + `setBusy(root, …)` | The screen's pending state, and the only thing in the kit that announces one. |
104
- | `skeleton({ lines, width, height, radius })`, `skeletonTable({ rows, cols, head })` | Placeholder shapes, `aria-hidden` throughout. |
105
- | `snippet({ label, code, reveal, copy, copyLabel })` | Code block with an icon-only copy button. `hlCode(raw, lang)`, `hlShell(raw)` and `codeTokens(raw, lang)` highlight what `codeLanguages` lists. See [Code highlighting](#code-highlighting). |
106
- | `icon(name, cls)`, `illo(name)`, with `iconNames`, `iconCategories`, `illoNames` | Line icons and illustrations as SVG strings; `sun` and `moon` are exported bare too. |
107
- | `iconOnlyAllowed`, `iconOnlyNames`, `iconMeanings` | The icon rulings as data. `iconOnlyNames` gives each wordless glyph the words its button’s name may open with, so `copy` cannot be borrowed for Duplicate. See [Icons and glyphs](foundations.md#icons-and-glyphs). |
108
- | `seedling`, `prism`, `brand` | The brand mark. |
76
+ ## Choose a component
77
+
78
+ Find the job in the left column. The section gives when to use the component, an example and
79
+ what the user sees.
80
+
81
+ | The job | Component | Section |
82
+ |---------|-----------|---------|
83
+ | Hold the page: navigation, title, account | `AppShell` | [Page shell](#page-shell) |
84
+ | Go up to the parent page | `BackLink` | [Back link](#back-link) |
85
+ | Switch between sibling routes | `NavTabs` | [Route tabs](#route-tabs) |
86
+ | A section list outside `AppShell` | `SidebarNav` | [Sidebar navigation](#sidebar-navigation) |
87
+ | The product band of a marketing page | `TopBar` | [Top bar](#top-bar) |
88
+ | A sign-in page | `AuthShell` | [Auth shell](#auth-shell) |
89
+ | A site or app footer | `Footer` | [Footer](#footer) |
90
+ | Run an action | `Button` | [Button](#button) |
91
+ | An action that the user cannot undo | `Button hold` | [Hold to confirm](#hold-to-confirm) |
92
+ | Choose one value from a list, or open a menu of actions | `Dropdown` | [Dropdown](#dropdown) |
93
+ | Find and run anything with ⌘K | `CommandPalette` | [Command palette](#command-palette) |
94
+ | A labelled form control | `TextField`, `TextArea`, `SelectField`, `FileField`, `Field` | [Fields](#fields) |
95
+ | Search a list from its toolbar | `SearchField` | [Search field](#search-field) |
96
+ | A yes or no, or a set of options | `Checkbox`, `CheckList`, `Switch` | [Checkbox and switch](#checkbox-and-switch) |
97
+ | A month, a date or a range | `DatePicker` | [Date picker](#date-picker) |
98
+ | Upload a file | `FileDrop` | [File drop](#file-drop) |
99
+ | Narrow a list or flip a setting | `Segmented` | [Segmented](#segmented) |
100
+ | Show one of several panels | `Tabs` | [Tabs](#tabs) |
101
+ | Filter the rows of a table | `FilterBar` | [Filter bar](#filter-bar) |
102
+ | A row of controls above a list | `.ui-toolbar` | [Toolbar](#toolbar) |
103
+ | Group content on a surface | `Card` | [Card](#card) |
104
+ | A status or a label on a record | `Badge`, `Pill`, `StatusDot` | [Badge, pill and status dot](#badge-pill-and-status-dot) |
105
+ | A person | `Avatar` | [Avatar](#avatar) |
106
+ | A message inside the page | `Callout` | [Callout](#callout) |
107
+ | A short notice after an action | `Toast`, `useToast` | [Toast](#toast) |
108
+ | Confirm that a task is done | `Success`, `SuccessPanel` | [Success confirmations](#success-confirmations) |
109
+ | Content that is loading, or that the user may not see | `BusyRegion`, `Skeleton`, `Denied` | [Loading and denied states](#loading-and-denied-states) |
110
+ | A list, a table or a page with nothing in it | `EmptyState` | [Empty state](#empty-state) |
111
+ | Code that the user reads or copies | `Snippet` | [Snippet](#snippet) |
112
+ | The history of a record | `Timeline` | [Timeline](#timeline) |
113
+ | A line glyph | `Icon` | [Icon](#icon) |
114
+ | A form or a question over the page | `Modal` | [Modal](#modal) |
115
+ | Stop before a destructive action | `Confirm` | [Confirm](#confirm) |
116
+ | Look at or change one record without leaving the list | `Drawer` | [Drawer](#drawer) |
117
+ | Account and settings | `AccountWindow` | [Account window](#account-window) |
118
+ | A word or a value on hover and focus | `Tooltip` | [Tooltip](#tooltip) |
119
+ | Feedback on a selected passage | `Feedback` | [Feedback](#feedback) |
120
+ | Rows of records | `DataTable` | [Data table](#data-table) |
121
+ | Pages of a long list | `Pagination` | [Pagination](#pagination) |
122
+ | A row of key figures | `StatBand` | [Stat bands](#stat-bands) |
123
+ | Numbers over time, or parts of a whole | `Chart` | [Chart](#chart) |
124
+ | A number or a change in a cell | `NumericValue`, `DeltaValue`, `RowIdentity` | [Table values](#table-values) |
125
+
126
+ ## Page structure
127
+
128
+ ### Page shell
129
+
130
+ Use `AppShell` for each page of a product. It draws the navigation, the page title and the
131
+ account, and you give it the page content. Do not use it for a sign-in page. Use
132
+ [`AuthShell`](#auth-shell) for that. Do not put a second shell or a second top band inside it.
109
133
 
110
- `card()` and React `<Card>` share the default, accent, and live surfaces. Use `icon` for a title chip. Use `pad="sm"` for less vertical space or `pad="lg"` for a centred landing card. A setting row keeps its choice on one line. On phones, its control sits below its label and hint. At wider widths, a choice that cannot fit beside its label moves below it. An accent card keeps its tint without a coloured edge. Use `href` on React `<Card>` to make the whole card a link. Use `tools` on a titled React `<Card>` for small controls at the end of the title row, such as an icon-only Download PDF button. A `<Chart>` in a titled card puts its Chart and Table switch there. The tools are centred on the title's line, on a desktop and on a phone, so the card has no extra row. On a touch phone the tools sit `--tap-gap` apart, so a tap on one never runs its neighbour. In the vanilla kit, wrap the title and a `.ui-card__tools` block in `.ui-card__head`.
111
- Three-option setting rows use `ui-card__row--tight-choice` to narrow pills below 360 px and stay on one line, while other rows keep full tap width.
112
- To show a document inside a card, wrap a `.ui-toolbar` and a `.ui-table-scroll` in `.ui-card__viewer`, and give the document `.ui-card__page`. The toolbar becomes a slim row between two hairlines. The scroll box becomes a recessed stage that runs to the card's sides and bottom. The page is a white sheet with dark text in both themes, with A4 proportions at the least. Its table, lines and loading skeleton take the light palette too.
113
-
114
- ### Controls and input
115
-
116
- | Name | What it is |
117
- |------|------------|
118
- | `field({ label, hint, error, control, required })` | The label, hint, error and ARIA wiring a control cannot do itself. See [Forms](#forms). |
119
- | `input`, `textarea`, `select`, `checkbox`, `switchToggle` | The controls `field` wraps; each also renders on its own. |
120
- | `segmented({ options, active, size, block, name, ariaLabel })` + `segmentedNextIndex(key, index, length)`, `initSegmented(root)` | Toolbar of toggle buttons. See [Segmented or tabs?](#segmented-or-tabs) and [Segmented strips that outgrow their column](#segmented-strips-that-outgrow-their-column). |
121
- | `tabs({ items, active, name, ariaLabel })` + `initTabs(root)` | Tablist and its panels, one per item. |
122
- | `dropdown({ label, value, variant, items, sections, foot, header, footer, align, direction, portal, scroll, search, disabled })` + `wireDropdown(root)` | Popover list, as a listbox or an action menu. `disabled: true` turns the trigger off: no keyboard stop, no panel, and the kit's unavailable paint. `portal: true` is the answer for a dropdown inside the shell's rail. `dropdownMatch(label, query)` and `dropdownFiltering(query)` are its filter, published so a second implementation asks the kit. `filterPanelFit(dd, floor)` with `DD_MENU_FLOOR` is the same for an anchored filter menu: inside `.ui-filter-bar` an **open** menu takes the kit's 240px floor rather than its trigger's width, and a shut one keeps the trigger's. `filterPanelRow(dd)` answers which row such a menu is measured inside: a chip's, or one asking for a width with `--ui-filter-panel-ask`. `dropdownViewportFit(panel)` answers for a panel outside a filter row: how wide it may be and how far it has to move to stay inside the view it is laid out in. `--ui-dropdown-edge` is the gap it keeps from the view's edge. `dropdownHeightFit(dd, panel)` answers how tall an **open** panel may be, which is the room between its trigger and the viewport edge it opens towards. It answers nothing for a closed panel. `dropdownReveal(dd, panel)` scrolls a Modal or Drawer body the least distance that shows an open panel, and answers how far it scrolled; the dropdown wiring calls it for you. `dropdownSnap(dd, panel)` stops an open panel's height in the middle of a row, for any row height and against the measured room; the wiring calls it too, and it keeps a cap the consumer asked for to its number. `dropdownRest(dd, panel, open)` gives an open panel its box and collapses a shut one after its fade, so a shut panel adds no scroll room; the wiring calls it too. `dropdownLift(dd, panel)` lifts an open panel out of a body too short to hold it, or too narrow to show it across, and answers whether it did; the wiring calls it too. See [The dropdown panel](#the-dropdown-panel), [A dropdown with a search field](#a-dropdown-with-a-search-field) and [A filter row holds its panels](#a-filter-row-holds-its-panels). |
123
- | `filterBar(options)` + `initFilterBar(host, options)`, with `filterChipText`, `filterChipName`, `filterChipUnset`, `filterChipItems`, `nextFocusStop`, `focusNextStop` | The controlled filter row above a table. The consumer owns the filters and calls `update()`. `filterChipItems(filter)` marks the chip's own value in the items it hands its menu, so the line the chip prints and the row the menu marks cannot disagree; a chip that is unset, or whose value is in no row, marks nothing, and a `selected` the consumer set does not stand in for it. `nextFocusStop(host)` names where an emptied bar sends the focus — the way to add a filter still on the row, drawn from `data-filter-add`, else the control a reader's next <kbd>Tab</kbd> would reach; `focusNextStop(host)` puts it there, skipping anything the reader cannot reach, and answers with the element it ended on. See [A filter row holds its panels](#a-filter-row-holds-its-panels). |
124
- | `pagination({ page, pageSize, total, hasMore, pageSizes, variant, label, loading, href, id })` + `wirePagination(root, …)`, `setPagerStatus(root, text)`, `PAGE_SIZES`, `DEFAULT_PAGE_SIZE` | The strip under a table or list; it renders a page the caller already computed. See [Pagination](#pagination). |
125
- | `commandPalette({ groups, items, label, placeholder, query, empty, density, hint, rank, hotkey, open, specimen, id })` + `wireCommandPalette`, `openCommandPalette`, `closeCommandPalette`, `commandPaletteList`, `setPaletteResults`, `rankCommands`, `rankGroups`, `scoreCommand`, `SCORE`, `paletteHotkey()` | The ⌘K overlay and the ranking behind it; `SCORE` is the ladder itself, for a server that sorts the same way. See [The command palette](#the-command-palette). |
126
- | `feedbackWidget()` + `wireFeedback(…)`, `nearestSection(node, root)` | Select a passage, give feedback. |
127
-
128
- ### Overlays
129
-
130
- | Name | What it is |
131
- |------|------------|
132
- | `drawer({ side, size, title, body, footer, open, specimen, dismissible })` + `wireDrawer`, `openDrawer`, `closeDrawer`, and `drawerSection({ title, rows, body })` for one group of its body | Panel against a screen edge, over a scrim. See [The drawer](#the-drawer). |
133
- | `confirm({ title, body, confirmLabel, cancelLabel, variant, open, specimen, id })` + `wireConfirm`, `openConfirm`, `closeConfirm` | Modal question over a scrim, for a destructive action the page has to stop for. |
134
- | `tooltip({ label, value, detail, placement, open, x, y, id })` + `wireTooltip`, `showTooltip`, `hideTooltip` | The readout over a chart mark, on hover or tap. See [The hover readout](#the-hover-readout). |
135
-
136
- Both `drawer()` and `confirm()` accept `specimen: true`. This draws an example for a
137
- documentation page. It does not add `aria-modal`, wiring or Escape handling.
138
-
139
- ### Figures and tables
140
-
141
- | Name | What it is |
142
- |------|------------|
143
- | `statBand({ stats, variant, basis, basisId, label, id })`, with `STAT_VARIANTS`, `STAT_TONES` | A row of key figures as a `<dl>`. A figure is `{ label, value, caption, delta, trend }`; `basis` is what every change is measured against, and the kit draws no chart. See [Stat bands](#stat-bands). |
144
- | `numericValue({ value, unit, missing })`, `deltaValue({ value, tone, basisId })` | Inline value and inline change. Colour never supplies the sign. |
145
- | `rowIdentity({ symbol, name, logo, href })` + `initRowIdentity(root)` | A company identity cell, with a letter fallback. |
146
- | `formatNumericValue(…)`, `formatDeltaValue(…)` | The same two decisions as plain text, shared with React. |
147
- | `chartScale(values, options)`, `bridgeWalk(steps)`, `pointTarget(point, options)`, `CHART_FLOOR` | The arithmetic a chart needs, with no DOM and no pixels: the band a series is drawn in with its whole-unit ticks, each bridge column's own amount and the two ends of the bar that draws it, and where a pointer target sits over a drawn point. The kit draws no chart of its own; React `Chart` is the one here that uses them. See [React charts](#react-charts). |
148
-
149
- The table is markup, not a factory. The page adds the scroll region, sticky header and pinned
150
- identity column through classes. See
151
- [Dense financial tables](#dense-financial-tables).
152
-
153
- ### Page furniture
154
-
155
- | Name | What it is |
156
- |------|------------|
157
- | `appShell({ word, brandHref, nav, active, navLabel, back, title, sub, body, account, signOutHref, layout, width, search, topbar, maxWidth, collapsible, collapsed })` | The kit's one page shell, and the one to call for new work. See [The page shell](#the-page-shell) and [The second layout](#the-second-layout). |
158
- | `wireShell(root, { persist })` + `railCollapsed(cookieHeader?)`, `RAIL_COOKIE` | Wires the rail's fold, the reader's menu and the nav's groups; the cookie lets a server paint the right width first. |
159
- | `nav({ variant })`, dispatching to `sidebarNav` or `navTabs`, + `wireNav(root)` | Wayfinding. Each shape is also exported on its own. `wireNav` opens the sidebar's groups, sizes a tab row to its links on load and on resize, scrolls the row to its current link, and scrolls it to a link the keyboard lands on. See [A tab row scrolls inside its column](#a-tab-row-scrolls-inside-its-column). |
160
- | `backLink({ href, label })` | The way up to the page this one sits under — an `<a href>`, never a history step. See [The back link](#the-back-link). |
161
- | `topbar(…)` + `wireTopbar(root)` | The product topbar. `themeToggle(theme)`, `accountMenu({ name, email, active, nav, initials })`, `versionSwitcher(versions, activeIdx)` and `deckTextSwitch(active)` are its parts, usable alone; `themeIcon(t)` and `themeName(t)` label your own toggle. |
162
- | `accentPicker({ active, options })`, with `ACCENTS` and `accentSwatchStyle(accent)` | The accent swatches, wired by `wireTopbar()`. `ACCENTS` is the list the kit ships; `accentSwatchStyle(accent)` is the one custom property a swatch button carries, `--swatch`, the gradient its circle wears. Both pickers read them, so a page building its own strip paints the same thing — and the kit's stylesheet draws the selected swatch's tick, so the strip needs no selection paint of its own. An accent with no paints gets `--swatch: transparent`, an empty circle you can still press. |
163
- | `ACCOUNT_NAV` | The account navigation the kit ships, as `sidebarNav()` items; the account menu falls back to it and your own entries replace it. |
164
- | `footer({ variant, brand, tagline, columns, social, legal, legalLinks, switcher })` | Site or app footer: `full`, `slim` or `app`. |
165
- | React `Footer` | The same three footer variants. The full footer puts link columns side by side above the phone width and stacks them on a phone. Pass React content for the brand, links, legal row and switcher. |
166
- | `.ui-toolbar` (class, no factory) | A row of controls above a list. See [A toolbar at one column](#a-toolbar-at-one-column). |
167
-
168
- ### Motion and escaping
169
-
170
- | Name | What it is |
171
- |------|------------|
172
- | `prefersReducedMotion()`, `staggerDelay`, `initReveal`, `replay`, `playEntrance`, `transitionMs(el)`, `ENTRANCE_FALLBACK_MS` | The motion helpers. `transitionMs(el)` answers how long the stylesheet says an element's transition lasts, so a caller sizing a backstop timer for a fade reads the sheet rather than copying a duration token; a missing or non-element argument answers `0`, which fires at once rather than never. See [Motion](foundations.md#motion). |
173
- | `esc(s)` | HTML-escape a text value. Every factory already applies it to its own text arguments; you need it for markup you assemble yourself. |
174
- | `safeUrl(url, fallback?)` | The URL boundary every factory sends an `href` through: a `javascript:`, `data:` or `vbscript:` destination becomes the fallback, `#` unless you name another. You need it for markup you assemble yourself; the React components call this same function. See [Escaping and URL slots](#escaping-and-url-slots). |
175
- | `observeNavFit(row)` | Observe changes to a tab row and its links without changing its scroll position. Call the returned function to stop observation. |
176
- | `revealCurrentNav(row)` | Size one `.ui-nav--tabs` row to its links and bring its `aria-current` link inside it, moving neither focus nor the page. `wireNav()` calls it; call it yourself after replacing a row's links. |
177
- | `revealFocusedNav(row, target)` | The same scroll for the link a focus event landed on, so the ring that link draws clears the row's scrolling edge. `target` is the event's target; a target that is not a tab in `row` is ignored. `wireNav()` wires it, and React's `NavTabs` calls it on focus. |
178
-
179
- The public JS surface is the set of exports from the package entry. A module that the entry does
180
- not name still ships in the tarball. You still cannot import it, because the package declares no
181
- `./components/*` subpath.
182
-
183
- ## What each component guarantees
184
-
185
- One short paragraph describes each component's promise. This is the promise a consumer would
186
- otherwise need to discover. Each rule's test contains its detail. React's own notes are in
187
- [react/README.md](../react/README.md).
188
-
189
- ### The page shell
190
-
191
- `appShell()` is the kit's one way to compose a page. It draws the chrome, and you decide what
192
- goes inside. It always draws **one `<main>` landmark** and gives every navigation landmark a
193
- unique name. **The page title keeps the same step above your content whether or not you pass a
194
- `sub`.** **Small tools for the whole page end the title row:** put the `h1` and a `.ui-app__tools`
195
- group in a `.ui-app__title-row`, and the `.ui-app__sub` lede after the row. It does not render a topbar
196
- unless you pass one. **The rail folds** above 720px through a `<button>` that the reader
197
- presses. That button writes the `apliteni-ui-rail` cookie, so a server can first paint the folded
198
- width with `railCollapsed()`. **At 720px and below the rail is a drawer.** The icon strip goes
199
- away. A 52px band at the top holds a menu button at its start and the brand mark beside it. The
200
- button opens the full rail in the left drawer, with its labels, its groups, its counts and the
201
- reader's block at the foot. Pressing a row, pressing Escape or widening the page closes the
202
- drawer, and focus returns to the menu button. A page in the topbar layout has a band already, so
203
- the menu button joins that band and the page never has two. The reading column takes the full
204
- width of the page. A folded row keeps its name and count for keyboard
205
- and pointer users. Every control in it clears the 24px floor and shows the ring. **The current
206
- row is one plate, at either width.** It is a quiet fill behind the row, a measured step off
207
- whatever the rail stands on, and nothing closes it: no accent bar, no hairline and no outline,
208
- because an outline on a rail row means focus alone. A row under the pointer takes a lighter wash
209
- of the same fill, so the row the reader is on stays the louder of the two in both themes. Pass
210
- `signOutHref` and the reader's block becomes a kit `dropdown()`, with signing out as one of its
211
- rows. **The rail holds nothing that has to escape it**. It is sticky and scrolls. A dropdown
212
- mounted inside it therefore passes `portal: true`, and the panel stands one measured step from
213
- the page under every accent. `accountShell()` was retired in 0.81.0. Account and settings belong
214
- in a modal over the product, as [Account and settings](../guidelines/account-and-settings.md)
215
- says.
216
-
217
- #### A folded rail takes the pointer only where it draws
218
-
219
- A folded rail is one glyph column wide. Every box inside it is laid out in that column. This
220
- includes the sections, lists, rows and the rule that the footer draws above itself. A click beside
221
- the rail therefore lands on the page. A link reached by keyboard draws its full ring instead of
222
- losing both ends to a clip. There is one limit: a folded rail flush with a page's right edge adds
223
- 175px to the page's scrollable width.
224
-
225
- #### The second layout
226
-
227
- `appShell({ layout: 'topbar' })` is the same shell with its three parts in different places.
228
- Every guarantee above still applies. The band stands beside the rail. It does not span the top
229
- of both. **The rail holds the shell's own controls:** the fold's control in its head, beside the
230
- mark, the theme switch above the reader's block, and the reader's block at its foot. The band
231
- control stands under the head (#732, `react/src/AppShell.tsx:195` `ui-react-app__control`). **The band carries the search
232
- field and nothing else** above 720px. At 720px and below it carries the mark, the page title on one
233
- line, the search trigger and the menu button (`react/src/AppShell.css:97` `@media (max-width: 720px)`). It is a `<header>`
234
- outside the navigation landmark. The field is the palette's own trigger, drawn as a field, with
235
- the key cap inside its accessible name. If no palette is named, there is no field. **One band over
236
- a page, never two:** `layout: 'topbar'` and the compatibility `topbar` bag are not composed. An
237
- unknown `layout` or `width` is read as the layout the kit has always drawn. React's own shell is
238
- [React AppShell](#the-rest-of-the-react-surface).
239
-
240
- **Below 560px the trigger shows only its search glyph, and is still called the same thing.** At
241
- one column the band holds the trigger beside the mark, the page title and the menu button, so the sentence had a few characters to stand in and broke mid-word — "Search or
242
- run a co…". The sentence and the key cap are **clipped rather than dropped** at that width, so the
243
- button's accessible name is the same string at 1280px and at 390px: a control that says something
244
- shorter to a screen reader on a phone is a second control. The clip is one block in `layout.css`.
245
- The palette's own placeholder is not this text and does not shorten.
246
- Decided in [#486](https://github.com/apliteni/apliteni-ui/issues/486). The short word that #486
247
- drew there gave way to the glyph on [#729](https://github.com/apliteni/apliteni-ui/issues/729).
248
-
249
- ### The back link
250
-
251
- `backLink()` is the way to reach the page that contains this one. You place it with
252
- `appShell({ back })`. **It is a link to an address, never a step through the history**. If you
253
- pass nothing or pass a `javascript:` one, it renders nothing. **It names where it goes:** it uses
254
- the destination name written in the sidebar or trail. The arrow has `aria-hidden`, and a long name
255
- clips instead of wrapping. **It takes the trail's place, above the title**. A page has one or the
256
- other. The shell keeps the row you marked `active` lit as `aria-current="true"`. This marks the
257
- current section, not the page. When a page should take one:
258
- [Going back](../guidelines/going-back.md).
259
-
260
- ### A tab row scrolls inside its column
261
-
262
- `navTabs()` lays its links out in one row and never wraps them. **When the links are wider than
263
- the column, the row scrolls inside itself and the page does not widen.** A shade marks each edge with more tabs beyond it, on the page or on a card.
264
-
265
- **The row stays aligned with the page gutter, and the active underline stays on the row rule.**
266
- Call `wireNav()` for vanilla rows. React rows update automatically when their labels, badges,
267
- or available width change.
268
- Use `observeNavFit()` for custom rows, and call its returned function when removing the row.
269
- Server-rendered or unwired rows keep their scroll containment.
270
-
271
- **Keyboard navigation reveals each focused link with its complete focus band.**
272
- The row scrolls without moving focus or scrolling the page. Content and container changes preserve the reader's scroll position where space permits.
273
- When a link already fits in the row, it keeps its content width. The cap only limits one link
274
- that is wider than the row.
275
-
276
- **An overflowing row with only disabled tabs becomes a keyboard stop.**
277
- It draws the kit's inward focus band. A fitting row supplies no separate keyboard stop.
278
-
279
- ### The current route has an accent label
280
-
281
- **A selected pill tab uses an accent label on its soft accent fill.**
282
- The label distinguishes the current route from a hovered route. The underline appearance keeps
283
- body ink and its accent bar. Both appearances name the current route with `aria-current="page"`.
284
-
285
- **In forced colours, both appearances retain a visible selected mark using the reader's system colours.**
286
- The pill label and badge remain readable. Ordinary colours are unchanged.
287
-
288
- ### The dropdown panel
289
-
290
- Inside a scrolling body, such as a Modal or a Drawer, a dropdown opens below its trigger and scrolls
291
- the body the least distance that shows the whole panel, with the field's label and the trigger above
292
- it. The body jumps instead of gliding under `prefers-reduced-motion`. Where the body is tall enough,
293
- the panel ends `--ui-dropdown-shade`, which is 48px, above the body's end. The drop shadow fades out
294
- by then, in light and in dark, so the body never clips it and the panel never touches the Modal
295
- footer. A shorter body spends that room down to the 8px edge. A body that cannot hold the label, the
296
- trigger, the 120px floor and the 8px edge lifts the panel out of the body. Examples are a Modal with
297
- a short form and a Drawer on a phone held sideways. A body that hides what overflows across and is
298
- narrower than the panel lifts it too, so a menu in the shell's rail shows its full width over the
299
- page. A lifted panel opens over the body and its
300
- footer the way a portalled panel does: below its trigger, or above it where the viewport has more
301
- room. It follows the trigger while the body scrolls. The ancestor that scrolls is the one whose end
302
- the reader sees, so a wrapper with `overflow: auto` that does not scroll is passed over, and the
303
- panel is no taller than the smallest of them shows. A shut panel adds no scroll room at the end of a body or a page. While the reader is
304
- still scrolled into the room that the open panel needed, that room stays, so closing the panel does
305
- not move the field. It goes when the reader scrolls out of it. This holds for a page as well as a
306
- body: at the end of a page, closing a panel with Escape leaves the field where it was.
307
-
308
- `dropdown()` places its panel for you. You do not write a rule to move it. `direction` selects
309
- where it opens: `'down'`, `'up'`, or `'auto'`. `'auto'` flips only when there is not enough room
310
- below and there is more room above. The head and foot extend through the panel's padding to the
311
- edge where they sit. **What goes in them is yours within the panel's role**. A `role="menu"` takes
312
- menuitems. A `role="listbox"` takes options. A control in the foot of either role is refused by
313
- `aria-required-children`. With `search: true`, the panel becomes a `role="dialog"`, where such a
314
- control belongs. **`portal: true` lets the panel leave a trigger's subtree** when an ancestor's
315
- `overflow` or `position: sticky` traps it. It stays opt-in because the panel then lands at the end
316
- of the tree it was moved into. It never crosses a document or shadow-root boundary. **Escape is
317
- scoped and click-outside is not**, and either action returns focus to the trigger. **A panel the
318
- keyboard opens is visible in the frame the key lands**. An open panel has no transition inside it
319
- at all. See
320
- [Reduced motion travels with the stylesheet](foundations.md#reduced-motion-travels-with-the-stylesheet).
321
- Every menu the kit ships follows those last two rules.
322
-
323
- **A panel stays inside the view it is laid out in, open and closed.** `align` chooses the edge of
324
- the trigger the panel hangs from. The panel keeps that edge wherever it fits and moves along the
325
- row where it does not, which is the rule `direction: 'auto'` applies on the other axis. A closed
326
- panel is placed by the same rule: it is hidden and still laid out, so it would otherwise widen the
327
- page before anything is clicked. A panel adds nothing to the page's scrollable width at any width.
328
- `--ui-dropdown-edge` is the gap a panel keeps from the edge of the view. Set it to 0 for a panel
329
- flush with the edge, or wider for more room. A view that cannot afford the gap on both sides halves
330
- it. At 720px and below the gap is the page margin, 16px, so a panel lines up with the page's text.
331
- Where a phone's safe area is wider than 16px, the gap is the safe area.
332
-
333
- **A panel has a floor and a ceiling.** The floor is the kit's 240px, which is what makes a list of
334
- rows readable. The ceiling is the view less that gap at each side. The floor wins where the two
335
- disagree, which is a view narrower than 256px. A long unbroken token — a filename, a key, a URL —
336
- breaks in the middle rather than reaching past the bound, so one row cannot make the panel wider
337
- than the screen. The tradeoff is a broken word.
338
-
339
- **An open panel never runs past the viewport edge, on the other axis either.** A wired panel is
340
- capped at the room between its trigger and the edge it opens towards, less the gap it keeps from
341
- the trigger and `--ui-dropdown-edge` at the edge, and scrolls inside that cap — the wheel over it
342
- stops there too, rather than carrying on down the page underneath. The cap takes hold when a panel
343
- opens, and also right away for a panel that is already open when the wiring reaches it. That is the
344
- whole of [#489](https://github.com/apliteni/apliteni-ui/issues/489): before it an opened
345
- panel took its content's height unless the consumer reached for the `scroll` modifier, so a
346
- twelve-row menu opened 300px above the bottom of a 390×844 phone ended past the fold and its last
347
- rows could not be reached, and the wheel over it scrolled the page instead. Capped, the same menu
348
- ends inside the viewport and scrolls on its own. Two custom properties decide the height and the
349
- smaller wins:
350
-
351
- - `--ui-dropdown-cap` is what the consumer asked for. Unset, a panel is capped at
352
- `--ui-dropdown-max`, which is 300px, and the panel stops there in the middle of a row. A plain list
353
- shows 7 rows and half of the eighth. A list with a description line under each label shows 4 and a
354
- half. A search panel shows 5 and a half, and 3 and a half with descriptions. The cut row tells the
355
- reader that the list goes on, where a cap that ended on a whole label would look complete. The stop
356
- is taken against the height the panel gets, which is the smaller of the cap and the room, so a
357
- panel that the room limits is cut through a row too. In a body, the stop can spend some of the
358
- room under the panel to reach the next half row instead of stopping a whole row short.
359
- `scroll: true` is `.is-scroll`, which asks for that standard cap by name; `scroll: <n>` writes it
360
- inline, as the property and not `max-height`, because an inline height would outrank the panel's
361
- own `min()` and put it back past the edge. A cap you ask for is kept to its number and is not cut.
362
- With `search`, it is the list's height, and the panel is the list and the search field over it.
363
- - `--ui-dropdown-avail` is the measured room. The wiring writes it when a panel opens, or is already
364
- open when the wiring attaches, and again on a resize. A portalled or lifted panel follows its
365
- trigger, so it is measured again on a scroll too. The room comes from `dropdownAvail()` in `src/logic/dropdown.js` — one calculation, so the vanilla wiring
366
- and the React `<Dropdown>` cannot disagree about where an open panel ends. `dropdownHeightFit(dd,
367
- panel)` is that calculation, published so a second implementation can read it instead of measuring
368
- its own. A closed panel carries no measured room: `--ui-dropdown-avail` stays unwritten, and the
369
- sheet's fallback, `calc(100dvh - 2 * var(--ui-dropdown-edge))`, is the viewport's height, not the
370
- trigger-to-edge room this section promises. A closed panel's height is outside this guarantee;
371
- sizing one is [#501](https://github.com/apliteni/apliteni-ui/issues/501).
372
-
373
- A panel with fewer rows than the cap keeps its content height. A panel is never taller than the cap,
374
- also where the room is below the floor, as the next paragraph says. An open panel keeps the height
375
- it opened at while the reader scrolls the page or the body, until the page is resized or the panel
376
- opens again, so it does not grow or shrink under the reader. On a page, the room the panel keeps
377
- under itself is the 8px edge, so opening a panel on a page that does not scroll adds no scroll.
378
-
379
- A trigger near the edge can leave less room than `--ui-dropdown-min` (120px) wants for a usable
380
- panel. The floor spends the edge inset, down to nothing, to try to reach 120px, but it never spends
381
- room past the edge, because that room does not exist. Where even the whole inset falls short of
382
- 120px, an ordinary panel keeps its configured side and its cap, and can grow the page so the reader
383
- can scroll to the rows past the fold. The wheel over such a panel carries on to the page once the
384
- panel has reached its own end.
385
- **A portalled panel flips when its configured side cannot hold the required height and the opposite
386
- side has more room.** The required height is the floor, or the content height when shorter.
387
- A smaller consumer cap can reduce that required height. The panel keeps its trigger gap and its resolved side through the close
388
- animation. It restores the configured side when space returns. If neither side has enough room,
389
- the roomier side can still extend beyond the viewport. A search panel is a column, so this cap
390
- lands on the rows and not on the field: `.ui-dropdown__list` shrinks to whatever room the capped panel leaves it.
391
-
392
- **A panel keeps its place while the page moves its trigger.** A row that re-lays itself out, an
393
- ancestor scrolling sideways, a longer run of text beside the trigger, and a transition that slides
394
- the trigger are each followed, closed as well as open. A transition is followed to where it stops
395
- and not through the frames on the way, so a page that moves a trigger every frame has to reopen the
396
- panel. A trigger scrolled out of the view keeps its panel at the view's edge rather than carrying it
397
- off the screen.
398
-
399
- `dropdownViewportFit(panel)` is published, so a second implementation of this dropdown can use the
400
- kit's numbers instead of measuring its own. It answers nothing for a panel inside a filter bar,
401
- whose row bounds it already — see [A filter row holds its panels](#a-filter-row-holds-its-panels).
402
- What you give up is two promises worth less than the panel: that `align` is obeyed on a screen too
403
- narrow to obey it, and that a panel is as wide as its widest row.
404
-
405
- ### A menu panel does not cut off its rows' ring
406
-
407
- The ring appears outside the border box of the focused element. It has a one-pixel gap and a
408
- two-pixel band. A row that reaches the panel edges draws the ring on the panel border and
409
- outside it. The panel has only two choices: **keep the three pixels inside the panel as padding,
410
- so the ring appears in the padding; or do not clip at the panel edge, so the ring crosses it.**
411
- If the panel does neither, it cuts off the ring and leaves the reader with two accent bars.
412
- `.ui-dropdown__panel`, the top bar's version menu and the account menu use the first choice.
413
- A menu row draws its ring inward, inside its own corner, so the ring never touches the
414
- panel edge or a divider.
415
-
416
- ### A filter row holds its panels
417
-
418
- **At any viewport a filter bar's panels add nothing to the page's scrollable width, and each
419
- panel opens inside the row that holds it.** A chip's panel is as wide as its trigger. It is
420
- bounded by its containing block. It therefore needs no measuring or JavaScript. Vanilla and
421
- React use the same rule. The rule also breaks a long key or URL in the middle of a token instead
422
- of letting it run beyond the page. The tradeoff is a narrower panel. A list that needs more room
423
- should use a dropdown instead of a filter. The bound does not work with an inline `min-width`.
424
- A chip also cannot become narrower than the selected value's min-content width.
425
-
426
- **An open menu is wide enough to read.** A chip's trigger is only as wide as the value it shows.
427
- When open, the menu uses the kit's 240px menu floor instead of the trigger's width. Its row is
428
- the toolbar line that holds the bar, or the bar itself when no toolbar holds it, so a bar with one
429
- chip still gets a readable menu (`src/logic/dropdown-placement.js:100` `function filterPanelRow`).
430
- If its row is narrower than the floor, it uses the row's width. When the side where it opens is
431
- short, it moves back along the row. It never leaves the row or makes the page wider. Its rows use
432
- the body weight, because they list the values the chip prints. When closed, the menu keeps the
433
- trigger's width. This prevents the page from growing before any script runs. The floor is measured after
434
- the kit's JavaScript runs. It is measured again when the row changes width or the chip moves
435
- along the row. The width remains held until the menu finishes fading out. Nothing is painted
436
- narrower than the row allows. `filterPanelFit(dropdown, floor)` and `DD_MENU_FLOOR` are
437
- published. A second implementation can use the kit's numbers instead of measuring them again.
438
- A dropdown composed against the row, rather than against a chip, owns its width. The row already
439
- bounds it. The kit leaves it unchanged. This dropdown must not read the
440
- `--ui-filter-panel-*` properties.
441
-
442
- **A menu may ask for a wider floor than a chip's.** A chip's menu holds one chip's values; a
443
- catalogue menu with a search field over it needs more room than the 240px floor leaves. Such a
444
- panel declares `--ui-filter-panel-ask` in the stylesheet, which is also what makes a menu outside
445
- a chip a subject of the fit: it is then `--panel-sm` wide where its row has the room and its row's
446
- width where it does not. `filterPanelRow(dropdown)` is published. It answers which
447
- `.ui-filter-bar` a menu's fit is measured inside — a chip's menu, or a menu that asks for a
448
- width — and `null` for anything else, so both faces decide which menus they re-fit and hold
449
- from one calculation.
450
-
451
- **The menu marks the value the chip is showing.** The active row receives a soft accent wash and
452
- keeps the kit's 16px check. The wash is a tint. Its contrast is 1.16:1 over the panel in light
453
- mode and 1.20:1 in dark mode. The check identifies the chosen row: its contrast is 6.35:1 over
454
- the wash in light mode and 4.13:1 in dark mode. Hover makes the wash darker instead of adding an
455
- outline: 9% more accent, which reads 1.15:1 off the resting wash in light and 1.14:1 in dark. The
456
- wash remains under focus, which would otherwise paint an opaque fill over it; focus reads by the
457
- band instead. **The arrow keys are not a third state here.** A filter chip's panel carries no
458
- search field, and without one a dropdown marks no active row, so what an arrow key moves in this
459
- bar is real focus: the row keeps its wash and its check and takes the band over them.
460
- `filterChipItems(filter)` chooses the row. It gives the menu the chip's items and marks the
461
- chip's own value. It matches a row by its `value`, or by its `label` when it has no `value`.
462
- Both faces call it. The text printed by the chip and the row marked by the menu therefore use the
463
- same value, and you receive the mark without setting it yourself. A chip with no chosen value,
464
- or with a value that matches no row, marks nothing. A `selected` value you set does not replace a
465
- value that the bar is not applying. The kit never writes to your own array or objects.
466
-
467
- **The clear action is offered only when there is something to clear.** React `FilterBar`
468
- renders it after a filter has a value. It uses the kit's ghost button without a fill
469
- or border. A consumer reading `[data-filter-clear]` finds nothing when no filter has a value.
470
- Both faces label it `Clear all`; `clearLabel` takes any wording.
471
- **React `FilterBar` draws the remove mark only on a chip with a value.** A chip with no value has
472
- nothing to remove. If the mark has focus when it goes, focus moves to that chip's trigger.
473
-
474
- **Filter labels use secondary-control ink and weight.** The remove mark uses glyph ink.
475
- A chip keeps its quiet edge when hovered or open. The add control moves its edge to the accent
476
- under the pointer, the way every trigger in the kit does, and steps that edge aside while it
477
- holds the focus ring. Clear keeps no edge in any state and answers the pointer with the accent
478
- wash the kit's buttons hover with. A control that is disabled or busy answers the pointer with
479
- nothing. Keyboard focus draws the shared `--ring`. A disabled chip or add control takes
480
- `--disabled-border`. The add and clear controls carry no resting fill.
481
-
482
- **An emptied bar hands the focus on rather than keeping it.** When you clear the last filter or
483
- remove the last chip with the keyboard, the focused control disappears. The bar moves focus to
484
- the way to add a filter where the row still draws one — that control outlives the chips, so an
485
- emptied row is not an empty row — then to the control that a reader would reach with the next
486
- <kbd>Tab</kbd>. It skips controls the reader cannot reach: being reachable is not the same as
487
- taking the focus, so each candidate is asked and then checked. If nothing beside the bar can take
488
- focus, the focus stays where it is.
489
- `nextFocusStop(host)` identifies that control. `focusNextStop(host)` moves focus there and returns
490
- the element that received it. A consumer that wants to move focus itself can read the same result.
491
-
492
- **A React bar given `add` and `onAdd` draws its own way to add one.** The control sits on the
493
- chips' line, after them and before the clear action, so <kbd>Tab</kbd> reaches it where it is
494
- drawn. Its menu holds one section per filter the bar is not already carrying, so no pick can put
495
- a second chip under one id, and takes a search field at ten values. A pick asks you for that
496
- filter and nothing else; answer it in the same update and focus lands on the new chip, answer it
497
- later and you own where focus goes. <kbd>Esc</kbd> closes the menu and adds nothing. The control
498
- is drawn only while something is left to add, and it stands at a chip's height and corner. It is
499
- labelled `Filter`, for the reason the clear action is labelled `Clear all`; `addLabel` takes any
500
- wording. The vanilla `filterBar()` has no `add`, so a vanilla page draws its own control and the
501
- kit answers it through markup: put your own `dropdown()` inside the bar, wrapped in an element
502
- carrying `data-filter-add`. That attribute is the whole contract — it declares the ask, carries
503
- the open rule's room, slide and closing hold, gives the trigger the chip's corner, height and
504
- edge, and is what the focus answer looks for. A pick inside it is yours to act on: the bar
505
- reports a change for a chip's menu and for nothing else. `initFilterBar()`'s `update()`
506
- rebuilds the bar from `filterBar()`, which draws no such control, so keep your wrapper in the
507
- DOM yourself. The Stock screener showcase draws one.
508
-
509
- ### A dropdown row is a div, a link or a button
510
-
511
- `.ui-dropdown__item` looks the same with all three tags. You decide which tag represents each
512
- row. The kit does not decide for you. The rule removes the browser's button styling and uses
513
- `font: inherit` for the `font` shorthand. This also keeps a portalled panel from taking its
514
- typeface from the place where it was mounted. `dropdown()` emits a `<div>`, or an `<a>` when an
515
- item has `href`. It never emits a `<button>`. A row that must be a real button is
516
- [one you write yourself](#a-dropdown-row-you-write-yourself). **A destructive row stays quiet
517
- and turns `--pink` on the way to being pressed**, in both hover and focus.
518
-
519
- **Every menu row answers the pointer with a fill and draws no edge.** Only keyboard focus draws
520
- the band, inside the row and on the row's corner. A row in a menu that you style yourself keeps
521
- the `.ui-dropdown__item` class, so it takes the same hover, focus and forced-colour rules. A
522
- menu head that reaches the panel edge keeps a 5px gap above the first row. In forced colours a
523
- separator stays a visible 1px line.
524
-
525
- ### A submenu row
526
-
527
- A row that opens a submenu carries `aria-haspopup="menu"` and `aria-expanded`. It ends in
528
- `.ui-dropdown__aside`, the current value in small full ink, and `.ui-dropdown__more`, a
529
- `chevronRight` glyph. While its submenu is open the row keeps the hover fill. The submenu is a
530
- `role="menu"` list in `.ui-dropdown__sub` with `menuitemradio` rows, and `.ui-dropdown__tick`
531
- marks the chosen one. Where the menu is clipped, as in a sidebar, put the list in a
532
- `.ui-dropdown__panel.ui-dropdown__panel--portal.ui-dropdown__panel--sub.is-open` on `body`,
533
- level with the row. On a phone, put it inside the menu panel and add `is-sub` to the panel:
534
- every child but `.ui-dropdown__sub` is hidden, so the list replaces the rows. Start that list
535
- with a back row. Right and Enter open the submenu, Left and Escape close it, and focus returns
536
- to the row. The vanilla kit ships the classes, and React `AppShell`'s Theme row wires the keys
537
- (`react/src/AccountMenu.tsx:18` `function AccountMenu`).
134
+ ```tsx
135
+ <AppShell sections={sections} pathname={location.pathname} title="Invoices"
136
+ account={{ name: 'Dana Reyes', email: 'dana@example.com' }} onSignOut={signOut}
137
+ palette={{ groups: commands }} renderLink={(section, props) => <Link to={section.href} {...props} />}>
138
+ <InvoiceTable />
139
+ </AppShell>
140
+ ```
538
141
 
539
- ### Avatar
142
+ `sections` lists the destinations, each with `href`, `label`, `icon` and an optional `count`.
143
+ The longest `href` that matches `pathname` is the current section. `word` names the product, and
144
+ its default is `apliteni-ui`, so set it. `brand` replaces the mark, and `brandHref` is its link,
145
+ `/` by default.
146
+
147
+ **Two layouts.** `layout="topbar"` is the default. It has a sidebar with the sections, a band with
148
+ the search trigger, the command palette and the theme switch. `layout="rail"` has only the side
149
+ rail, with the sections and the account at its foot. The rail layout has no search trigger, no
150
+ command palette, no Cmd+K, no theme switch, no section counts, and takes no `bandControl` and no
151
+ `headControl`. `width="wide"` removes the limit on the content column. `centered` is the
152
+ default.
153
+
154
+ **The title row.** `title` is the page's one `h1`. `lede` is one line under it. `tools` puts small
155
+ tools for the whole page at the end of the title row, such as a version badge, a period picker or
156
+ a `size="sm"` button. Tools that do not fit go under the title. `actions` puts the page's buttons
157
+ in their own row under the title. `back` puts a [back link](#back-link) above the title.
158
+
159
+ **The account menu.** `accountItems` adds rows, such as Account settings and Support, at the top
160
+ of every account menu. A row takes `href` to go to a page, or `onSelect` to open something in
161
+ place. A separator stands before Sign out. In the topbar layout, a Theme row opens a submenu with
162
+ Auto, Light and Dark.
163
+
164
+ **Topbar layout only.**
165
+
166
+ - `searchLabel` gives the words and the accessible name of the search trigger, at every width.
167
+ Its default is "Search or run a command…". `searchShortLabel` is deprecated, and the shell does
168
+ not draw it.
169
+ - `palette` gives the command palette its groups. Without it, the palette lists the sections.
170
+ `onNavigate` sends a same-tab pick in the palette to your router, so the page changes without a
171
+ reload. If your `palette` sets its own `onNavigate`, the shell uses that one.
172
+ - `bandControl` stands under the sidebar head. `headControl` is one glyph control in the sidebar
173
+ head, before the fold button.
174
+
175
+ **Routing.** `renderLink` lets your router draw each section link.
176
+
177
+ **What the user sees.**
178
+
179
+ - Above 720px the sidebar or the rail folds and unfolds with a button. The shell stores the choice
180
+ in the `apliteni-ui-rail` cookie. `defaultCollapsed` sets the first state. A folded row keeps its
181
+ name and its count for keyboard and pointer users. A folded rail takes clicks only on the glyph
182
+ column, so a click beside it reaches the page.
183
+ - At 720px and below, the sidebar goes away and a 52px band shows. In the topbar layout, the band
184
+ holds the brand mark, the page title on one line, the search trigger and a menu button. In the
185
+ rail layout, it holds only the menu button and the mark. The menu button opens the full section
186
+ list in a drawer. The drawer opens from the side of the menu button: the right in the topbar
187
+ layout and the left in the rail layout. `drawerSide` chooses the side in either layout. A press
188
+ on a section, Escape or a wider window closes the drawer, and the focus goes back to the menu
189
+ button.
190
+ - Below 560px each band control is a 40px glyph with no border. The search trigger shows only its
191
+ glyph, and keeps the same accessible name.
192
+ - The current section is one quiet fill behind its row. A row under the pointer has a lighter
193
+ fill. In the topbar layout, a shell with one section and no back link draws no sidebar, no fold
194
+ control and no menu button. The section stays in the command palette. The rail layout always
195
+ draws the rail.
196
+ - In the topbar layout, the theme switch applies the stored theme when the shell mounts, or
197
+ follows the system. A page that sets its own `data-theme` must also set `data-theme-choice`, or
198
+ store the choice. Otherwise `<html data-theme="light">` on a dark system turns dark when the
199
+ shell mounts.
200
+
201
+ **Keyboard and screen reader.** The shell draws one `<main>` landmark, and each navigation
202
+ landmark has its own name. The band is a `<header>` outside the navigation. The page title in the
203
+ phone band is hidden from screen readers, because the `h1` keeps the name.
204
+
205
+ **Room on the screen.** The rail is sticky and scrolls. A dropdown inside the rail opens out of
206
+ it. A folded rail at the right edge of a page adds 175px to the scroll width of the page.
207
+
208
+ ### Back link
209
+
210
+ Use `BackLink`, or the `back` prop of `AppShell`, on a subpage to go up to the page that holds it.
211
+ Do not use it as a history step. When a page takes one: [Going back](../guidelines/going-back.md).
540
212
 
541
- `avatar()` draws a person as a filled circle with their first and last initials. It is 24 px, or
542
- 32 px with `size: 32`. **The hue comes from `key`**, the app's stable id for the person, so one person
543
- keeps one hue on every screen. A hash of the key picks one of eight fixed hues, and the letter ink
544
- is chosen to read on each one in both themes and under every accent. A name with no letters draws
545
- the `user` glyph. `empty: true` draws a dashed ring for "no one". **A `src` photo covers the
546
- letters**, and the letters show when the photo does not load. **The mark is hidden from assistive
547
- technology**, because the person's name always stands beside it. It has no hover, focus or cursor
548
- of its own: a button that holds it keeps its own. In React it is `<Avatar personKey name src size
549
- empty />`. A `dropdown()` item takes `avatar: { key, name, src }` and draws it in the leading slot.
550
- A `select` leads its trigger with the chosen row's mark, and with no value it shows the dashed ring
551
- and the placeholder. The top bar account button, the menu it opens and the shell's reader block draw the same mark, in the same hue.
552
-
553
- ### A dropdown with a search field
554
-
555
- `search: true` adds a text field above a dropdown's rows. It filters the rows as the reader types.
556
- This is opt-in. A dropdown without it renders as before. **Typing filters, and focus stays in the
557
- field**, which has `role="combobox"` over the list. `aria-activedescendant` names the row that
558
- Enter would pick. The field carries the focus ring. The active row is marked by the hover fill
559
- alone — an edge around a row would be the focus band's own shape. **The match is anywhere in the label**, with case and accents ignored. Rows keep their
560
- original order. Descriptions are not searched, so put the words a reader will type in the label.
561
- **`count` names the size of the set** in the placeholder and in the field's accessible name, for
562
- example "Search 214 people", and `noun` changes the word. A placeholder or label you write wins. A
563
- `select` dropdown inside a `field()` takes the field's width, and its panel takes the trigger's.
564
- **Every open starts from the whole list**, and a query with no matches says so instead of showing
565
- an empty panel. **The panel is a dialog**, because a listbox may own only options. When a dropdown
566
- must have a search field is a rule rather than a recommendation:
567
- [Component choice](../guidelines/component-choice.md).
568
-
569
- ### The drawer
570
-
571
- A drawer is a panel against one edge of the screen. It appears over a scrim. It lets the reader
572
- look at or change one thing without leaving the list that opened it. **It groups by heading, never
573
- by card:** `DrawerSection` puts a heading over a `<dl>` of label and value pairs. A screen reader
574
- then hears each label with its value. **An icon button at the end of a value, such as a copy
575
- button, sits on the value's line**, and its row keeps a text row's height. On a phone it reaches
576
- the 44px tap target. **Groups stand 32px apart, with no line between them.**
577
- Each group heading stands on a 1px `--border` line, the same line as a table head. **A record can
578
- lead with its key figure:** put a `<dl class="ui-drawer__figure">` in a group with no heading, as
579
- the first group. Its `<dt>` is the label, and its `<dd>` holds a `.ui-drawer__figure-value`, set at
580
- 22px (`--text-xl`), with a status badge beside it. The figure never breaks across lines.
581
- **A table in a drawer group takes the drawer's 13px text.** Its head is semibold in strong ink, as
582
- a group heading is. Its rows have no lines between them. A table that is not a hover table holds
583
- its rows 8px apart. A hover table keeps its own row height, because its rows are targets. The
584
- table stands on the drawer's ground, in light and in dark. Its first and last columns start and
585
- end on the edges of the drawer's other text. A dense or zebra table keeps its own inset.
586
- The value stays beside its label instead of moving to the far
587
- edge of the panel. A row whose value is a field or a dropdown lines its label up with the control's first line of text.
588
- This alignment happens by itself. There is no setting for it.
589
- Nothing inside a drawer draws a card, a row rule or an `<hr>`. Actions stay
590
- outside the scrolling body. **It moves on open and on close**, and both movements are instant when
591
- reduced motion is enabled. **An Escape a tooltip or a picker already handled closes only that
592
- overlay, and the next Escape closes the drawer.** For when a flow should use a drawer or a page:
593
- [Drawer](../guidelines/drawer.md).
213
+ ```tsx
214
+ <AppShell back={{ href: '/invoices', label: 'Invoices' }} … />
215
+ ```
594
216
 
595
- ### The modal
596
-
597
- The React `Modal` limits its height to 96% of the dynamic viewport. Its body scrolls, while its
598
- title, close control and footer stay visible. It is a borderless raised surface. It uses the drop
599
- alone, `--radius-md`, a `--text-base` title and a deep scrim without blur. It names itself with an
600
- `h2`. The HTML entry point ships no general modal. Its separate `confirm()` is unchanged.
601
-
602
- ### The account window
603
-
604
- The React `AccountWindow` is the account and settings window. The product gives it the reader
605
- and the sections, each with its id, label, icon and content. The window draws the rest: the
606
- dimmed page, the close, the section title and the rail. It is 1024px wide and 76% of the
607
- viewport high, with a 216px rail. It narrows to 96% of a smaller screen, and it keeps 32px
608
- above and below it on a short one. The rail is the page ground, with the reader's avatar, name
609
- and email at its top. Only the open section's row carries the accent. Each rail row is a button
610
- with `aria-current`, because a section is a place in the window and not a route. The pane remounts
611
- when the section changes, so a half-filled form does not follow the reader. At 560px and below
612
- the window floats with a gap on each side, clear of the notch and the home bar. It is as tall as
613
- its content, up to the screen height, and a long section scrolls inside it. The sections become
614
- tabs under the reader. They act as the `Tabs` panel tabs do: one Tab stop, the arrow keys, Home and End, and the open tab scrolled into
615
- view. Pass `section` and `onSectionChange` to control the open section, or `defaultSection` to
616
- leave it to the window.
617
-
618
- ### The hover readout
619
-
620
- `tooltip()` is the readout that a surface shows while a pointer rests on one of its marks. It is an
621
- overlay. That is the guarantee: **showing, filling or moving a readout never changes the size or
622
- the place of anything else on the page.** A closed readout has no box, so it cannot widen a
623
- scroll region that holds it. There is one element per host. It is placed absolutely
624
- and takes no pointer events. `.ui-tip-host` marks the box it is placed against. The readout flips
625
- or slides only as far as needed to stay inside the viewport and every ancestor whose overflow
626
- clips. **What it says is text**, written with `textContent` and never parsed. The text wraps inside
627
- the readout's box, also in a table cell that keeps its text on one line. Focus on a mark shows
628
- the readout and describes the mark through `aria-describedby`. **Escape dismisses every readout
629
- the kit is showing**. **Under a coarse pointer the tap is the switch**, and the opening tap is
630
- captured. This means a chart that drills down on a bar does not drill down on the tap that asked
631
- what the bar says. No value may be reachable only by hovering. See
632
- [Hover readouts](../guidelines/hover-readouts.md).
633
-
634
- ### The React tooltip
635
-
636
- React `Tooltip` shows a label, a value and an optional detail.
637
- `text` is still a shorthand for `label`. Empty parts are hidden.
638
- The focusable trigger provides the readout as its accessible description. Escape keeps focus on the trigger.
639
- **Escape closes only the readout; the next Escape reaches the dialog around it.**
640
- The panel does not change the layout or intercept pointer events.
641
-
642
- **A pointer opens the readout after it rests for 300ms, and the readout closes at once when the
643
- pointer leaves.** A pointer that leaves within 300ms opens nothing. **Within 300ms after a readout
644
- closes, the next one opens at once**, so a pointer that moves along a row of icon buttons reads
645
- each word without a new wait. **Keyboard focus opens the readout at once.** A mouse press that
646
- focuses the trigger waits for the hover.
647
-
648
- `control` is for a child that is one control and names itself, such as an icon button with an
649
- `aria-label`. The readout shows its word on hover and focus. It adds no tab stop and no
650
- description, and it is hidden from assistive technology, because the control's name already says it.
651
-
652
- `placement` selects the preferred top or bottom side. **The open readout sits in the top layer**,
653
- over a sticky table cell and over a cut one. It stays within the viewport and within each clipping
654
- ancestor that can hold it beside its mark, and updates its position on scroll and resize. A browser
655
- with no popover support keeps it in its host, within every clipping ancestor.
217
+ **What the user sees.** A link with an arrow and the name of the parent page, as the sidebar
218
+ writes it. It stands above the title, in the place of a trail. A long name is cut, not wrapped.
219
+ The section of the parent page stays marked with `aria-current="true"`. Without an `href`, or with
220
+ a `javascript:` address, it draws nothing. `as` lets a router link draw it.
656
221
 
657
- ### Pagination
222
+ **Keyboard and screen reader.** It is an `<a href>`. The arrow is hidden from screen readers.
658
223
 
659
- The pager renders a page you have already computed. It uses the current page, the page size and,
660
- where you know it, the total. A page counted by a server and a page sliced from an array therefore
661
- produce the same markup. **A result whose size is not known is a supported shape, not a degraded
662
- one:** without a total, the pager offers the step before and the step after. It does not claim a
663
- page count. **A control that would leave the result is disabled and stays where it is**. It is
664
- never removed or replaced with text. **One page of content gets no steps.** **The row range is
665
- announced**, politely and as one whole message. It is the only part of the pager that announces.
666
- **The page size is a scale the kit names**. You choose which sizes a table offers and whether to
667
- remember the reader's choice. **A page turn does not move the ground under the reader:** the
668
- pager keeps its numbers legible, marks itself busy and stops accepting input while the next page
669
- loads.
224
+ ### Route tabs
670
225
 
671
- ### Stat bands
226
+ Use `NavTabs` for a row of links between sibling routes of one page. Each tab is a link to an
227
+ address. Do not use it to show panels on one page. Use [`Tabs`](#tabs) for that.
672
228
 
673
- `statBand()` renders a row of key figures as a description list. A screen reader can then read each
674
- figure as one statement. **A figure's value is never broken across lines and never truncated;**
675
- the words below it give way instead. A band that is too narrow for its figures folds before normal
676
- wrapping would leave one figure alone on a row. It decides this from **its own width**, not the
677
- window's. In a flex row or an `auto` grid track, you give it one:
229
+ ```tsx
230
+ <NavTabs items={[{ id: 'open', label: 'Open', href: '/invoices/open', badge: 4 },
231
+ { id: 'paid', label: 'Paid', href: '/invoices/paid' }]} active="open" />
232
+ ```
678
233
 
679
- | Layout | Four fold two by two at | An odd count stacks at | One column at | Smaller value below |
680
- |---|---|---|---|---|
681
- | Band and tiles | 56rem | 42rem | 28rem | 14rem |
682
- | Open | 66rem | 50rem | 32rem | 15rem |
234
+ `variant` is `underline`, the default, or `pill`. `renderLink` takes the same signature as in
235
+ `AppShell`, so your router can draw each link. Item ids must be unique. An item with no `href`
236
+ uses its id as a fragment.
237
+
238
+ **What the user sees.** The tabs stay on one row and never wrap. When they are wider than the
239
+ column, the row scrolls inside itself and a shade marks each edge with more tabs. The page does not
240
+ get wider. The current tab has an accent label, on a soft fill in the pill appearance and above an
241
+ accent bar in the underline appearance. A disabled item is text that the user cannot focus. A badge
242
+ of zero stays visible. A null or empty badge is not drawn.
243
+
244
+ **Keyboard and screen reader.** The tabs are native links, and the current one has
245
+ `aria-current="page"`. When the keyboard reaches a tab, the row scrolls to show the tab and its full
246
+ focus band, and the page does not move. A row that overflows and has only disabled tabs becomes one
247
+ keyboard stop. In forced colours, both appearances keep a visible mark on the current tab.
248
+
249
+ **Room on the screen.** The row sizes itself on mount, on a route change and on a resize, and it
250
+ keeps the user's scroll position.
683
251
 
684
- Below 14rem, band and tile values use the next smaller type rank. Open values step down below 15rem.
685
- Longer values remain the caller's responsibility. Totals that are the sum of a list go in the
686
- table's footer rows, not in a stat band.
687
-
688
- A band can use `basisId` to reference comparison text before the figures. An explicit `basis` takes precedence.
689
- When a period control already states the window, omit a caption that repeats it, including for totals without changes.
690
-
691
- **A change shows which way it went with an arrow read off the sign you printed**, and colour follows
692
- your verdict alone. No tone and `neutral` are the same neutral change. **A figure with nothing to
693
- compare draws no row at all:** never `+0%`, and never a sentence saying there is nothing to say.
694
- **A change says what it is measured against, in text a reader can reach**. Put it once for the band
695
- in its caption, or beside the change when one figure is measured against something else. A hover
696
- `title` does not count. **The caption comes before the figures**, as a table's `<caption>` does.
697
- **A figure says at most one thing under its value, and it says it in one row**. A caption earns that
698
- row only by giving a unit, a period or a limit that the figure cannot. **The trend is a slot:** the
699
- kit sizes and colours your `<svg>` and draws no chart. Three layouts ship. `tiles`, the default,
700
- puts each figure on its own card. `band` is one card. `open` draws no surface and sets the value
701
- larger.
702
-
703
- ### Dense financial tables
704
-
705
- The table is markup. A named scroll region contains a native `<table>`, and you apply the
706
- recipes as classes. Zebra adds no grey stripes. Hover gives a row a quiet neutral fill across the table width. On a dense hover table, the fill has round ends, and the first and last content sit 8px inside it. No row line crosses those ends. A dense table marks a selected row with its check box only, with no wash, because a round hover with selected rows looks bad.
707
- Keyboard focus keeps its ring, and a landed row keeps its own mark. On a zebra or dense table, `compact` sets a 33px minimum row, but larger or wrapped content makes the row
708
- taller. **Columns scroll rather than disappear**, while sticky headers and pinned identity cells
709
- keep opaque backgrounds, the shared focus composition, and their full accessible names. **A
710
- pinned column draws its divider only where the region can actually scroll:** at a width where
711
- every column fits, the line divides nothing, so it is not drawn. **The region draws no shade at
712
- its edges.** The divider is CSS alone, so vanilla and React tables carry it alike, and it does not
713
- reach the focus ring. An engine that cannot report a scroll state keeps the divider at every
714
- width. **A link
715
- inside a cell uses the row's ink, gets an underline on hover, and uses the shared ring on
716
- `:focus-visible`**. The ring surrounds the whole link, including a title-cell link that wraps.
717
- In a cell after the first, the band keeps 8px of room before the name, and the name does not move.
718
- `numericValue` distinguishes missing from zero. `deltaValue` prints your sign and uses your
719
- explicit judgement. **Colour never supplies the sign.** **Every body and header cell aligns its
720
- content to the top**, so when one cell wraps, the other values stay level with its first line. A
721
- React sort mark stands on the first line of a wrapped label. A badge, a logo, a selection box or
722
- an icon button in a cell stays level with the text beside it. A badge in a cell is 19px high,
723
- against 24px elsewhere, and never makes its row taller.
724
-
725
- Use a badge for the status of the record. Use an ink word for a second status in the same row.
726
- `.ui-status--success`, `--danger`, `--warn`, `--info` and `--neutral` give a word the ink of
727
- its tone with no fill. Each one is at least 4.5:1 on a plain or a selected row, in both themes
728
- and under every accent. In light, warn, info and danger take a deeper ink than their badge, so
729
- they are at least 7:1 on a plain row, a selected row and a selected row under the pointer.
730
-
731
- **A hover table that is neither zebra nor dense is a row table.** Its body rows have no lines
732
- and no column lines, and the head keeps its rule. **A row is 48px tall, 36px with `compact` and
733
- 56px with `comfortable`**, and larger or wrapped content makes it taller. The space above a
734
- row's first line centres that line in this height, so a one-line row looks centred. Hover gives the row a
735
- neutral fill, and a checked selection box gives it an accent wash at a tinted card's strength: 5% in
736
- light and 8% under the pointer, 9% in dark and 12% under the pointer. Both fills are square, and the
737
- first and last content sit 12px inside them. The name
738
- in the first column takes the strongest ink. **`.ui-table__sub` puts a second value under the
739
- first**, such as an email under a name, in full ink at a smaller size. An act cell that holds icon
740
- buttons is as wide as its buttons, and they are 32px, so the row keeps its height. In a card, the
741
- table reaches the card's edges and its end cells keep the card's text edge. A scroll frame in a
742
- card keeps a 4px band at each side and above the header for its focus ring, so a row fill stops
743
- 4px inside the card's edges. The header gives that top band back, so the table keeps its place, and
744
- the header follows the ring's rounded corners. The band shows no line at rest, and the frame adds no
745
- room below the table.
746
-
747
- A cell can group its reference and status with `.ui-table__pair`. They stack when the cell cannot fit them side by side.
748
- A landed row's `.is-target` mark shows on pointer arrival as well as keyboard focus, and it outlives focus, so arrival and focus show together and stay distinguishable.
749
- The caller brings the target row into view and keeps its mark until the next arrival.
750
-
751
- **A cell marked `.ui-table__linked` holds one link and nothing else, and the kit then gives that
752
- link the whole cell.** The focus ring and the pointer target become the cell rather than the two
753
- words inside it, and the ring there is the inward band. The cell hands its padding over, so
754
- nothing on the page moves and no row changes height. Mark the cell yourself: a cell reading
755
- `Invoice 1162` with the number linked looks the same to a stylesheet, and filling that one would
756
- put the number on a line of its own. A marked cell holding anything else keeps the plain link box.
757
- **Every other anchor the kit styles keeps the box, the corner and the paint its own component
758
- sets**, marked cell or not: `.ui-btn`, and a `.ui-dropdown__item`, or `.ui-nav__item`
759
- composed into a cell.
760
-
761
- **Below 720px a pinned identity cell keeps its content on one line**, capped at
762
- `--ui-table-identity-max` and cut with an ellipsis past the cap. The default cap is
763
- `min(var(--panel-sm), 50vw)`, and that one property is yours to retune. A table with a
764
- selection column leaves less room on a phone. Lower the cap there. The whole text stays in
765
- the markup, so the accessible name is unchanged and the company link remains the disclosure. The
766
- decorative logo is not drawn there. A sub-line stays running text, which is a rule in
767
- [Dense tables](../guidelines/dense-tables.md). **Focusing a link inside a sub-line draws the band
768
- around the whole line**, because the cell clips and a band around the link alone could not close
769
- its right side.
770
-
771
- **On a phone, a table stays a table.** No kit table lays its rows out as blocks. A table wider
772
- than the screen scrolls sideways inside its frame, and the page does not scroll. A pinned identity
773
- column stays at the frame's left edge on the table's own surface, so it follows the theme.
774
- **Below 560px the frame shows no scrollbar**, because a finger scrolls it. **A screen-reader label
775
- in the table stays inside the frame**, so it cannot widen the page. This is a rule in
776
- [Dense tables](../guidelines/dense-tables.md).
777
-
778
- `FilterBar` is controlled by you. Selections, removal, and clear-all request changes. They never
779
- change the filters you supplied. Given `add` and `onAdd` it also draws the way to add one; see
780
- [A filter row holds its panels](#a-filter-row-holds-its-panels). **A chip shows only the chosen value**, while the field's name
781
- appears only when nothing is chosen. Next to a value, the name reaches the reader through the
782
- trigger's accessible name and a hidden legend.
783
-
784
- ### The command palette
785
-
786
- The kit provides the palette shell, its ranking, and its keyboard. It does not name result kinds.
787
- What a result *is* — an invoice, a campaign, or a domain — comes from your product's vocabulary.
788
- The groups also come from your product. **A row can behave in three ways**, because Enter must
789
- give a different result in each case. A row that goes somewhere has an `href`. A row that runs
790
- something reports a `ui-command` event. A row that destroys something names a confirm and opens
791
- it. **A destructive row with no confirm is rendered disabled instead of running.**
792
-
793
- **A same-tab pick can go through a client router.** Give the palette `onNavigate`, and a
794
- same-tab pick on an `href` row calls it with the href instead of setting `window.location.href`,
795
- so the page changes without a reload. A Cmd- or Ctrl-held pick still opens the tab itself.
796
- Without the prop, a same-tab pick navigates the way it always has.
252
+ ### Sidebar navigation
253
+
254
+ Use `SidebarNav` for a section list in a layout of your own. In a product page, use
255
+ [`AppShell`](#page-shell), which draws this list for you.
797
256
 
798
257
  ```tsx
799
- <CommandPalette open groups={groups} onClose={close} onNavigate={(href) => router.push(href)} />
258
+ <SidebarNav sections={[{ label: 'Billing', items: [{ id: 'inv', label: 'Invoices', href: '/invoices', badge: 4 }] }]}
259
+ active="inv" />
800
260
  ```
801
261
 
802
- **Results are ranked by how the query matches the item, and you break every tie.** A whole label
803
- beats a prefix. A prefix beats a word start. A word start beats a substring. A keyword beats a
804
- note. Initials come last. Groups use the score of their best row. Equal scores keep the order
805
- you passed. The kit remembers nothing between openings, and **a palette fed by a server does not
806
- rank results at all**: the client keeps the order it was handed, and the ranking above becomes
807
- the server's to apply — with `rankGroups`, the exported function both faces use, rather than a
808
- second one written beside it, so a list drawn on a server and the same list after a keystroke
809
- cannot disagree about what comes first. **The keyboard is these keys and no others.** Cmd or
810
- Ctrl+K opens the palette, the arrows move the active row and wrap at both ends, Enter runs it,
811
- and Escape closes the top overlay. Tab is trapped in the panel. Home and End stay with the text
812
- caret, which is what the ARIA combobox pattern gives them for, and Ctrl+K inside another text
813
- box is left alone, because it is kill-to-end-of-line there — Cmd+K still opens from one.
814
- **Focus opens in the text box and never leaves it while the palette is open**, over an inert page.
815
- The search row shows the accent ring inside its edges while the text box has keyboard focus. The ring follows the panel's top corners, and the divider hides under the ring.
816
- **It opens empty**, and **it paints one step above the drawer and one below the confirm**. A
817
- confirm opened by a row appears over both and answers the first Escape.
262
+ It takes flat `items` or captioned `sections`, nested groups, badges and `renderLink`. Nesting
263
+ stops at one level. A collapsed row keeps its name and its count.
818
264
 
819
- ### Success confirmations
265
+ ### Top bar
820
266
 
821
- A confirmation has **one title and at most one short line below it**. It has no eyebrow:
822
- `success()`, `<Success>`, and `successPanel()` take a title and one detail line. Nothing adds a
823
- third tier above or between them. They draw the confirmation on a plain elevated card. The card
824
- uses the kit surface and its border, with nothing behind it. There is no backdrop layer and no
825
- `backdrop` option. The mark is one of two, selected with `check`:
267
+ Use `TopBar` for the product band of a site or documentation page that has no `AppShell`. Do not
268
+ put it in an `AppShell` page, because a page has one band.
826
269
 
827
- | `check` | Mark | Size | Motion |
828
- | --- | --- | --- | --- |
829
- | `line` (default) | Lucide `check`, bare, in the success colour | 56px hero, 72px split, 28px compact, 28px inline panel | strokes itself on over `--dur-slow` |
830
- | `circled` | Lucide `circle-check-big` (the kit's `circleCheck`) | 20px, the kit's label size — every layout, inline panel included | at rest |
831
-
832
- `line` uses the size for the layout where it appears. `circled` uses one size everywhere. Both
833
- are unmodified Lucide paths in a 24 box. Neither has a filled disc or a burst ring behind it.
834
- [Iconography](../guidelines/iconography.md) reserves a circled glyph for a state, so `circled`
835
- is the mark that rule requires. `line` is the default because it carries the moment at page
836
- size. An action that is not a kit `Button` — a router link or a plain `<a>` — is ringed already and
837
- needs no class; `.ui-focusable` is for a focusable that is neither a link nor a kit control.
838
-
839
- `callout()` uses the same status split as toasts. Success, danger and warning use
840
- `circleCheck`, `circleX` and `circleAlert`. Info and neutral callouts use `info`. A caller can
841
- still pass `icon` when the tone does not say enough.
842
-
843
- ### Pending and denied states
844
-
845
- Every screen has two states: it is still fetching, and the reader is not allowed to see it.
846
- **One region has three renders:** `busyRegion()` is a live region that *outlives* what it
847
- reports on. It first renders with a skeleton inside. `setBusy()` then replaces its body and
848
- writes a line into the screen-reader node that the region already contains. A live region whose
849
- text changes is the only thing assistive technology reliably speaks. It reuses the pair
850
- `toast()` and `success()` carry. There is no second mechanism. A skeleton is `aria-hidden`.
851
- **`deniedState()` has no role of its own**, so the region where you place it announces it. It does
852
- not need to announce itself as a whole page. There is **no spinner factory**. At screen scale, a
853
- skeleton shows what shape is coming.
854
-
855
- ```js
856
- const el = document.querySelector('#report');
857
- el.innerHTML = busyRegion({ label: 'Loading your report…', lines: 4 });
858
- const rows = await fetch(…);
859
- setBusy(el, { busy: false, message: `${rows.length} rows`, body: table(rows) });
270
+ ```tsx
271
+ <TopBar word="Strategy" view={<ViewSwitch items={views} active="deck" />}
272
+ version={<VersionSwitcher versions={versions} value="v3" onChange={setVersion} />}
273
+ theme={<ThemeToggle />} account={<AccountMenu name="Dana Reyes" email="dana@example.com" onSignOut={signOut} />} />
860
274
  ```
861
275
 
862
- ### Busy button labels
276
+ Each slot is optional. A bar with no account is the signed-out bar. On a phone the bar has two rows.
277
+ The current view in `ViewSwitch` has the accent fill. The version button shows only the chosen
278
+ name, and its menu shows each name with its badge and a tick on the chosen one. They follow
279
+ `value` until you change it. `AccountMenu` marks the page named by `current` in accent ink.
863
280
 
864
- A busy button replaces its visible label with three centred pulsing dots in the variant's full
865
- label ink. The brightest dot clears 3:1 against every variant fill in both themes. Text does not
866
- fade or blink. The retained label and icons keep the button's dimensions stable. Reduced motion
867
- switches directly between the label and static dots. **A wired busy button keeps focus:**
868
- `aria-disabled` communicates the state. Click, Enter and Space activation are blocked. Both faces
869
- announce through a status region outside `aria-busy`. This region stays through completion, so it
870
- can announce both progress and completion. React takes `completionMessage` to word that
871
- completion. Use `completionMessage=""` to say nothing when a form error or another live region
872
- announces the outcome. An explicitly disabled button stays natively disabled. Unwired
873
- `button({ busy: true })` markup keeps native disabled as a safe fallback.
281
+ ### Auth shell
282
+
283
+ Use `AuthShell` for a sign-in or sign-up page. It centres one card and puts the brand above it.
284
+
285
+ ```tsx
286
+ <AuthShell brand={<img src="/logo.svg" alt="Example" />}><SignInForm /></AuthShell>
287
+ ```
288
+
289
+ ### Footer
290
+
291
+ Use `Footer` at the end of a site page or an app page. `variant` is `full`, `slim` or `app`.
292
+
293
+ ```tsx
294
+ <Footer variant="full" word="Ledger" tagline="Made for finance teams" legal="© 2026 Example Ltd" />
295
+ ```
874
296
 
875
- ### Extra-small buttons
297
+ The `slim` and `app` footers draw only the legal row: `legal`, `legalLinks` and the `switcher`.
298
+ The `full` footer adds the brand, the `tagline`, the link `columns` and the `social` links. Its
299
+ columns stand side by side above the phone width and stack on a phone. `brand={false}` hides the
300
+ whole brand block. Set `word` and `legal`, because their defaults are `Strategy` and
301
+ "© <year> Apliteni".
876
302
 
877
- `button({ size: 'xs' })` and React `<Button size="xs">` draw a 13px glyph at stroke-width 2.8.
878
- They have a minimum 24×24px target. An icon-only xs button is 24×24px. A labelled button grows
879
- to fit its label at `--text-xs`. Other sizes keep their 16px glyph at stroke-width 2.4. Busy
880
- dots fit inside the smaller target. The size does not change the variant's colour or its
881
- interaction states.
303
+ ## Actions
304
+
305
+ ### Button
306
+
307
+ Use `Button` for each action that the user runs. Use `variant="link"`, or pass `href`, when the
308
+ action goes to another page. Use [`Dropdown`](#dropdown) for a list of actions, and
309
+ [hold to confirm](#hold-to-confirm) for an action that the user cannot undo.
310
+
311
+ ```tsx
312
+ <Button variant="primary" icon="download" busy={exporting} onClick={exportRows}>Export</Button>
313
+ ```
314
+
315
+ `variant` is `primary`, `secondary`, `ghost`, `danger` or `link`. `size` is `xs`, `sm`, `md` or
316
+ `lg`. `icon` puts a glyph before the label and `iconRight` after it. `leading` puts your own
317
+ decorative content before the label, and it wins over `icon`. `block` fills the row.
318
+
319
+ **Links.** With `href`, the button is an `<a>` with the button classes. Without `href`, it is a
320
+ `<button type="button">`. Refs and native attributes go to the element that it draws.
321
+
322
+ **Icon-only buttons.** With `iconOnly`, the glyph is the whole button. The button copies its
323
+ string children, or else its icon name, into `aria-label` and `title`. With neither, it has no
324
+ name. Earn a wordless button on the Button labels page of the guidelines.
325
+
326
+ **Busy.** `busy` shows three pulsing dots in place of the label, and the button keeps its size.
327
+ The button keeps the focus. Clicks, Enter and Space do nothing while it is busy. A status region
328
+ announces the progress and then the completion. `completionMessage` sets the completion words. Set
329
+ `completionMessage=""` when a form error or another live region announces the result. Under
330
+ reduced motion the dots do not move.
331
+
332
+ **Extra small.** `size="xs"` draws a 13px glyph in a target of at least 24×24px. A labelled xs
333
+ button grows to fit its label.
334
+
335
+ **Your props and the button state.** `className` adds to the kit classes. The button state wins
336
+ over your spread props: `aria-disabled`, `aria-busy`, the `data-btn-*` hooks, the `role` of a
337
+ link, and the `href` and `tabIndex` that a disabled or busy button removes. Space is blocked only
338
+ on a `<button>`, because Space scrolls the page on a link.
882
339
 
883
340
  ### Hold to confirm
884
341
 
@@ -912,653 +369,927 @@ not move. Leave room for one line above the button. An ancestor with `overflow:
912
369
  the hint. If a result replaces the button after the confirm, give the result the focus. Give
913
370
  its row a minimum height of `--btn-height-md`, so the row keeps the height of an md button.
914
371
 
915
- ### Code highlighting
916
-
917
- `hlCode(raw, lang)` returns highlighted HTML. `codeTokens(raw, lang)` returns the same tokens as
918
- data. `hlShell(raw)` is the shell case under the name it has always had. `codeLanguages` lists
919
- the values that `lang` accepts. An unrecognised name is read as shell. One tokenizer serves both
920
- faces, so vanilla HTML and React spans cannot drift apart. The five classes carry different
921
- meanings per language:
922
-
923
- | Language | `.k` | `.s` | `.f` | `.u` | `.c` |
924
- | --- | --- | --- | --- | --- | --- |
925
- | `shell` | the command | a quoted string | a flag | a URL | a `#` comment |
926
- | `json` | a property key | a string value | a number, `true`, `false`, `null` | — | — |
927
- | `ts` | a keyword | a string or template | a number or literal | — | a `//` or `/* */` comment |
928
-
929
- They colour short snippets, not arbitrary programs. All five clear WCAG AA in both themes, on
930
- every ground a code block can take. **In a card, a code block paints the page ground**, as an
931
- inline chip does, and a line divides its label row from the code. When more code lies past an
932
- edge, a shade marks that edge. In light, keywords, flags and URLs fall below AA where that
933
- shade is darkest: 4.15:1 and 4.36:1, and 3.91:1 and 4.10:1 in a table scroll. This is recorded
934
- debt. The reveal block keeps its own look. **The copy button is
935
- icon-only in both faces**, with `copyLabel` as its accessible name and `title`. **Confirming a copy does not change the control's size or its name**: the glyph
936
- swaps inside the same box, and the word goes to a hidden live region. Snippet descendants use
937
- the shared ring, except the browser-focusable code region. A `<pre>` sits flush with its card and
938
- has no radius, so **the card paints that ring instead**.
939
-
940
- ### A toolbar at one column
941
-
942
- A toolbar above a list opens with a search box, followed by its filters and then its view switch. A create action stands on its own row above the toolbar, at the left.
943
- `.ui-toolbar` gives its text field a `6rem` flex basis. The row breaks only when the field would
944
- be squeezed below that size. At `560px`, that basis would become the field's size rather than its
945
- floor. So at that width the field uses `flex-basis: 100%`. It takes the full line, and the rest
946
- of the row wraps below it.
947
-
948
- A title without an introduction keeps a 32px gap before the page body.
949
- A control row directly inside the page body, a `.ui-card-stack` or a `.ui-stack` sits one inner gap, 8px, above the block it controls. On a touch phone below `560px`, that gap is 20px.
950
- Use `.ui-toolbar--split` to place the final control at the row's end. On a phone, it stays in that row beside the control before it, rather than dropping to its own line.
951
- Every control on a toolbar line takes the line's height, so a button beside a field or a filter chip has the same top and bottom edge. Put a button and a field that share a row in `.ui-toolbar`, and change neither control's size.
952
-
953
- **A toolbar that opens with a small search field is a small row.** With a mouse, its filter
954
- chips, the add control and Clear all stand at 32px, level with the field, a dropdown trigger, a
955
- small Segmented and a small button. Give the Segmented and the button `size="sm"` yourself. The
956
- small search field stops at `--panel-sm`, 320px, and the free width goes before the last
957
- control. A full-size search field still takes the free width. At `560px` and below, each search
958
- field takes the full line. On a touch screen the row is 40px, a chip's height: the field keeps
959
- 16px text, and a chip, Clear all, a dropdown trigger, the Segmented and the button are 40px on
960
- every line of the row. At both sizes, the text and the glyphs of the row share one vertical centre,
961
- within about 1.5px.
962
-
963
- ### Segmented strips that outgrow their column
964
-
965
- The enabled selected pill uses the primary button's accent fill and label ink, with a thin accent edge that marks it wherever that fill is faint on the track. A disabled or underline selection has no edge. A disabled selected pill keeps a quiet fill and disabled ink. Only keyboard focus draws an outline.
966
-
967
- A pill strip lays out its choices in one row while they fit. When they do not fit, the choices
968
- wrap onto further rows. **It never widens past its container:** a twelve-month picker in a phone
969
- column becomes three rows of pills instead of pushing the page sideways. Below 560px, the
970
- standard-size pills reduce their side padding while keeping the same type rank. The underline
971
- appearance wraps too, so no tab is cut off at a phone width. A label that is too long for the
972
- column wraps inside its own tab. Arrow keys, Home and End skip disabled choices.
973
-
974
- ### The chosen tab in an underline strip
975
-
976
- The chosen tab is its own label with 2px of accent under it. It has no plate, hairline or upright
977
- rail. **The accent is spent once.** No tab draws a visible box against the strip's ground. The
978
- pill appearance marks its chosen button with a fill; the underline strip overrides that fill back
979
- to `none`, because the bar under the label is its whole mark. It has no background, border or
980
- inset shadow. Nothing in it reads as a card lying on the page. The
981
- strip also draws no rule under its tabs. A consumer that wants one draws it on the container.
982
-
983
- **Every mark that says "chosen" sits inside that tab's own box**, clear of its edges. This lets the
984
- strip wrap. A tab on a further row carries its whole highlight with it and is never read against
985
- the row above or below. Every tab reserves the bar, but only the chosen one draws it. The mark
986
- therefore grows in place when the choice moves. Hover is an ink step from `--text` to
987
- `--strong`, the step every kit tab takes. There is no second mark.
988
-
989
- ### A selected item in forced colours
990
-
991
- In forced colours, selected items use Highlight and HighlightText, unavailable selections use GrayText, and focus rings use CanvasText.
992
-
993
- ### Escaping and URL slots
994
-
995
- Factories return HTML strings. **Text and attribute values are escaped where written:** quotes and
996
- angle brackets in a name, identifier, class modifier or label cannot add an attribute or an
997
- element. Do not escape ordinary text or URL slots before passing them in. **URL slots reject
998
- `javascript:`, `data:` and `vbscript:`**, case-insensitively. This includes leading ASCII
999
- controls and embedded tabs or newlines. Other schemes, relative paths and fragments keep their
1000
- original values. A rejected navigation URL renders as `#`. A rejected image source renders as
1001
- an empty `src`. `backLink()` renders nothing at all for one.
1002
-
1003
- **Slots documented as trusted HTML are not sanitized**, and their author owns the markup and any
1004
- URLs inside it. They are a card's `title`, `sub` and `body`; a callout's `body` and `actions`; a
1005
- drawer's `body` and `footer` and a drawer section's `body` and row `value.html`; a dropdown's
1006
- `triggerContent`, `header`, `footer` and `foot`; a nav or footer `footer` and `switcher`; a tab
1007
- item's `label` and `panel`; an empty state's SVG `art` and `actions`; a field's `control`; a
1008
- checkbox `label`; a snippet's code; a stat's `trend`; a brand `word`; a version switcher's label,
1009
- meta and custom badge; and `appShell()`'s `title`, `sub` and `body` plus the nested topbar slots.
1010
- A nested option inherits the contract of the factory it invokes.
1011
-
1012
- ## React components
1013
-
1014
- The React wrapper publishes components over the same CSS. Its own notes are in
1015
- [react/README.md](../react/README.md). This section explains what React promises beyond the
1016
- vanilla sections above.
1017
-
1018
- ### React tables
1019
-
1020
- Tables fill their container by default. Inside `.ui-card--fit`, tables size to their content.
1021
- A `.ui-table__title` cell gives a text column the remaining width. **A title cell is never narrower
1022
- than 20 characters**, or a pinned column's ceiling, so a table wider than its frame scrolls and a
1023
- two-word name in a pinned column stays on one line. A column takes `cell` for it:
1024
- `title`, `code`, `long`, `strong` or `act`. **A column's `width`, such as `'12ch'`, holds while
1025
- the rows reload or are empty**, so the columns do not move when data arrives; longer content still
1026
- widens it. The columns with no `width` share the free room, so set the narrow columns and leave the
1027
- title column unset to keep it the widest. When the set widths and a title column's 20 characters add up to more than the table, the
1028
- columns share the room by their content, so the edges can move on a narrow screen. `rowHeader` renders the column's body cells as `th scope="row"`.
1029
- `DataTable` takes the vanilla hooks as props: `zebra`, `hover` (on unless `false`), `density`
1030
- (`dense`, `compact` or `comfortable`),
1031
- `stickyHeader` and `pinnedIdentity`. **`pinnedIdentity: true` pins column 0; a column key pins that column**,
1032
- so a date can stand before the pinned identity. `rowState` marks a row `target` or `dead`, `footer` takes totals rows
1033
- and `caption` names the table for assistive technology. A `dead` row is muted and shows its state as a word,
1034
- with no strike line. `stack` is deprecated and ignored: a phone table scrolls sideways like any other. A table that does not scroll is the card's own child, so a dense table reaches the card's text edge.
1035
- Its pager follows the measured table width and wraps when necessary.
1036
- Without `ResizeObserver`, the pager keeps its container width.
1037
- A pager that renders no controls takes no space.
1038
-
1039
- Use `.ui-card--fit` when a card must end at its content.
1040
- The company comparison story aligns its heading, filters, tabs and first column through one shared inset.
1041
- Its empty result keeps the Clear filters action outside the scroll region.
1042
- Both filter bars accept `clearVariant="link"` with a custom `clearLabel`. Their existing defaults remain available.
1043
-
1044
-
1045
- Column labels accept React content, including a kit Tooltip that explains a header.
1046
-
1047
- **A scrollable table reaches its far columns by scrolling, and offers no button for it.** Give it
1048
- `stickyHeader` or `pinnedIdentity`. The table then sits in a named scroll region. The region takes
1049
- keyboard focus and draws the kit's ring inward. A trackpad, a finger and the arrow keys can then
1050
- reach the same columns. `scrollLabel` provides the region's name. It defaults to `Table`, which
1051
- only says what the region contains. Pass the table's own subject instead, such as `Invoices`.
1052
- Name the gesture only when the columns overflow at every width the surface supports:
1053
- `Selectable companies, scroll for more columns`. A name has one state. If it names a gesture, that
1054
- gesture must be correct at every supported width.
1055
-
1056
- **Sorting is yours to control or the table's to manage, and one table stays in one of those modes
1057
- for as long as it is on the page**. The default is the first sortable column, descending. An absent
1058
- sort key and equal values both preserve input order. Ordering returns its own list, so the rows you
1059
- supply are never reordered through the result. **Paging is on the same terms:** a controlled table
1060
- shows all the rows it was given. Those rows are the page, and you provide the count it reports.
1061
- `DataTable` builds its own class list and takes no `className`. It renders its sort control inside
1062
- the header cell. A stacked table clips that control. **A sortable header's label gives way with an
1063
- ellipsis rather than pushing the sort caret out of a capped column**, so a pinned sortable identity
1064
- keeps its direction visible on a phone.
1065
-
1066
- **A column marked `linked` marks that column's body cells, and never its header**, which holds a
1067
- label or a sort control of its own. It is how a React table opts a column of ID or identity links
1068
- into the filled cell described under Dense financial tables.
1069
-
1070
- ### React auth shell
1071
-
1072
- `AuthShell` centers one sign-in card and places the brand above its content. Pass the brand and the task content as React elements. The shell adds no background glow.
1073
-
1074
- ### React fields
1075
-
1076
- `TextField`, `TextArea`, `SelectField` and `FileField` generate IDs for their controls and
1077
- messages. They also name their controls. **An error marks the control invalid and is described
1078
- before the hint rather than in its place**. This keeps a hint with consent, safety or legal detail
1079
- on screen while the reader decides whether to retry. The error also uses `role="alert"`, so a new
1080
- error is announced without moving focus. Required markers are decorative. Native controls carry
1081
- `required`. `Field` exposes the frame for a control that you render yourself. Its child function
1082
- receives a stable ID, `required`, `aria-invalid` and `aria-describedby`. Spread them on a `Dropdown` and the label and then the value name its trigger. `FileField` accepts one
1083
- file from the picker or by drop. `accept` only filters the system picker, so you validate before
1084
- upload.
1085
-
1086
- ### React toasts
1087
-
1088
- React notices accept `compact`, `dismissible` and `timer`. `compact` omits body text.
1089
- `dismissible={false}` hides the close button without changing timing or action behavior.
1090
- `timer={false}` keeps the notice until the reader dismisses it. A numeric `timer` sets the
1091
- auto-dismiss seconds.
1092
-
1093
- `Toast` and `useToast()` render the vanilla toast classes in a fixed stack. The newest notice is
1094
- at the bottom. The stack is anchored to the bottom-right corner. **The provider publishes how far
1095
- the stack reaches up the viewport** as `--rx-toast-stack` on the document root. It is `0px` while
1096
- the stack is empty. A fixed page action can use this value to stay clear of any number of notices.
1097
- Use **one** provider per document, because that property is a document-root global. Notices without
1098
- actions dismiss after five seconds. Their countdown and timer bar pause while hovered, focused or
1099
- held in a collapsed pile, then resume with the remaining time. Notices with an action stay until
1100
- the reader selects or dismisses it. Ordinary notices are polite. Danger notices are assertive.
1101
- Adding a notice does not move focus.
1102
-
1103
- Pass `collapse` to `<Toast>` to draw the stack as a pile, as described under [Toast stacks](#toast-stacks).
1104
- The pile fans out on hover and on focus within it, and the stack stays a plain column on a device without hover.
1105
-
1106
- ## Toast stacks
1107
-
1108
- A stack of notices can collapse into a pile. `.ui-toast-stack--collapsed` draws its notices on top
1109
- of one another, bottom-aligned, with the newest in front. Notices past `TOAST_TIERS` rest on the
1110
- last tier, so a ninth notice makes the pile no taller than a third one. The cards peeking behind
1111
- the front one are what say more is waiting. The pile carries no counted chip above it.
1112
-
1113
- The pile fans out into the ordinary column on `:hover` and on `:focus-within`. Thus a keyboard
1114
- reader opens it by tabbing into it, and it collapses again when both states end. Nothing listens
1115
- for either state. The stylesheet switches between two sets of published values, which lets the
1116
- reduced-motion net cap the travel like any other transition.
1117
-
1118
- The values are measured, because notices are not the same height. For each notice, a script
1119
- publishes `--toast-card-lift`, `--toast-card-scale`, `--toast-card-fan` and
1120
- `--toast-card-depth`. For the stack, it publishes `--toast-pile-height` and
1121
- `--toast-fan-height`. The React `Toast` measures and publishes them itself. A pile re-measures
1122
- when notices arrive or leave and when one changes height.
1123
-
1124
- A notice behind the front one that is taller than the front one rests cut short, so no part of it
1125
- shows below the front notice, even while the browser is busy. It opens to its own height when the
1126
- pile fans out. The pile publishes `--toast-card-box` and `--toast-card-natural` for such a notice.
1127
-
1128
- Under `(hover: none)` the stack stays the plain column. Half of what opens a pile is hover, and
1129
- the notices behind the front card are not focusable. A pile there would be one nobody could open.
1130
-
1131
- `.ui-toast__timer` spends the notice's own dismiss timer. It pauses on the notice's `:hover`,
1132
- `:focus-within`, and on a held pile, so the line and the countdown stop together. Under reduced
1133
- motion the line is not drawn at all, because its animation is capped to nothing. The countdown
1134
- still pauses while the notice or the pile is held.
1135
-
1136
- ### React search field
1137
-
1138
- `SearchField` is the unlabelled search box that a toolbar opens. It has a decorative leading glyph
1139
- and a native `type="search"` control on the shared input class. **`ariaLabel` is required and is
1140
- the control's only name**, because no label appears in the row. It declares no CSS of its own. The
1141
- toolbar's row rule and the field's focus ring therefore reach it from the kit's stylesheet.
1142
- **There is no clear button**, because the browser paints its own near-black button on the light
1143
- field and white button on the dark one.
1144
- **`size="sm"` is the field above a dense table.** With a mouse it is 32px high with `--text-sm`, the
1145
- text of the dense rows, and the pill corner. Without `size`, the field keeps its full size. At every
1146
- size, the leading glyph sits on the vertical centre of the text and the caret. A `TextField` glyph
1147
- does the same. On a touch screen a
1148
- small field is 40px with 16px text, because iOS zooms into a field with smaller text. Only `SearchField` takes a size: `TextField` and `SelectField` keep
1149
- one size, because a form keeps the full size. See
1150
- [A toolbar at one column](#a-toolbar-at-one-column).
1151
-
1152
- ### React date and month picker
1153
-
1154
- `DatePicker` picks one month, a range of months, one date or a range of dates. At its ordinary
1155
- width, it uses the dropdown's shell and adds only the grid inside it. The panel is a `dialog`,
1156
- because a calendar is a grid and a listbox may own only options. The panel is `inert` while closed,
1157
- and a shut panel carries `data-dd-shut`, as a shut Dropdown does. **Escape closes only the calendar,
1158
- wherever focus is in the picker, and the next Escape closes the dialog around it.**
1159
-
1160
- **The grain and the span are two questions, not one:** `month` and `day` pick a single period.
1161
- `range` and `day-range` pick a start and an end in the same two presses. Periods are ISO strings in
1162
- the mode's own grain. Every step and comparison uses arithmetic on one integer per period. Nothing
1163
- walks a `Date` across a daylight-saving boundary. **A period written in the other grain still
1164
- counts**. A month read in day grain is its whole span. A date read in month grain is the month it
1165
- falls in. A string that is neither is no bound. Bounds mark a cell `aria-disabled` and refuse the
1166
- press, but **the cell stays focusable**, so a reader meets the bound instead of losing it.
1167
-
1168
- **One tab stop in the grid, on the cell the keyboard is on**, and **Home and End go to the ends
1169
- of the row without leaving the page**. **Every cell says what it is in its own accessible name.**
1170
- **A range spans what lies between its ends — blocked periods included**, because
1171
- `{ start, end }` cannot say "all of this but not that". Such a period keeps its place in the value
1172
- and loses only the tint. **Blocked beats every other state in the paint, and its label is struck
1173
- through.** **Hover is the kit's row hover**, not a tint of the accent. **The current period is a
1174
- ring**, a hairline in the accent, and it stands aside while the cell holds focus, so a focused
1175
- current period draws one band and not two. **Nothing is drawn under the grid:** no legend and no per-period
1176
- swatch. **Below 560px the panel is a sheet, and a sheet is the kit's drawer**. **Inside a `Field`,
1177
- the sheet's title is the field's label**, because the sheet covers the field. An `ariaLabel` wins
1178
- over the label, and outside a `Field` the placeholder is the title. The trigger's name is
1179
- that label or `ariaLabel` and then the value it shows, such as "Due date, August 2026". **In a `Modal`, the open panel draws over the dialog's edge**,
1180
- below the field, or above it where there is more room, and scrolls inside itself when neither
1181
- side holds it. Below the phone step the gap between weeks opens to reach the 44px tap floor. Its one breakpoint literal is one of
1182
- the steps in [Breakpoints](foundations.md#breakpoints).
1183
-
1184
- ### React file drop
1185
-
1186
- `FileDrop` is the compact drop: at rest, it shows one row with the button that opens the
1187
- system picker. Beside the button, it shows the accepted types and size limit in your words.
1188
- The field-sized dashed box remains with `FileField`. **You own the upload:** `FileDrop` sends
1189
- a chosen or dropped file through `onFile` and renders the `file` you provide. **A file with no
1190
- `status` is uploading**, so the kit never reports success unless you claim it. **A status the
1191
- row draws includes a circled mark and a word**, because colour alone does not show status. When
1192
- `progress` is provided, the track shows the status instead. `Remove` and `Retry` appear only
1193
- when you provide `onRemove` and `onRetry`. **A file keeps the resting row's 32px height:** the
1194
- name, the size, and the status or the track stand on one line, and `Remove` ends it. The track
1195
- fills the free room on the line. The name gives way first: it truncates its stem but keeps its
1196
- extension, and the full name is in a `title`. **One layout serves every width.** In a row of
1197
- 352px or less, the size leaves the line, and a screen reader still reads it. A refused file
1198
- shows its reason on the name's line. When the full name and the reason do not fit there, the
1199
- reason moves under the name and the row grows by one line, to 61px. In a parent that sizes to its
1200
- content, `FileDrop` is 420px wide, or narrower when the parent has less room. **The drop target is painted only while a file is over the region. It covers
1201
- that region instead of joining it**, so the row stays in place while the reader aims. Children
1202
- render above the row inside the same region. This lets one panel, or a whole page, become the
1203
- target. A disabled drop never calls `preventDefault` on `dragover`, so it does not declare
1204
- itself as a target the pointer can aim at. When a page uses a row, a region or a dialog, see
372
+ ### Dropdown
373
+
374
+ Use `Dropdown` with `variant="select"` to choose one value from a list, and with
375
+ `variant="menu"` for a list of actions. Use [`Segmented`](#segmented) when all the choices fit on
376
+ one row and must stay visible. When a
377
+ dropdown must have a search field: [Component choice](../guidelines/component-choice.md).
378
+
379
+ ```tsx
380
+ <Field label="Owner">{control => (
381
+ <Dropdown {...control} variant="select" items={people} value={owner?.label}
382
+ selectedValue={owner?.value} search={{ count: people.length }} onSelect={setOwnerById} />
383
+ )}</Field>
384
+ ```
385
+
386
+ `items` is a list of rows. A row has `label`, and can have `value`, `description`, `icon`,
387
+ `avatar`, `badge`, `selected` and `disabled`. `'---'` is a separator. `sections` groups rows under
388
+ captions. `header` and `footer` add content above and below the rows. `onSelect` gets the value
389
+ and the row. `open`, `defaultOpen` and `onOpenChange` control the panel. `disabled` turns the
390
+ trigger off: no keyboard stop, no panel and the disabled paint.
391
+
392
+ **What the user sees.**
393
+
394
+ - The panel opens below the trigger. `direction="up"` opens it above. `align` chooses the edge of
395
+ the trigger that the panel hangs from. The panel keeps that edge where it fits, and moves along
396
+ the row where it does not.
397
+ - The panel stays inside the view, open and closed. It never makes the page wider. It keeps
398
+ `--ui-dropdown-edge` from the edge of the view. Set that property to 0 for a panel flush with
399
+ the edge. At 720px and below, the gap is the 16px page margin, or the safe area of the phone
400
+ when that is wider.
401
+ - The panel is at least 240px wide where the view allows. A long unbroken word, such as a file
402
+ name or a URL, breaks in the middle, so one row cannot make the panel wider than the screen.
403
+ - An open panel is never taller than the room between the trigger and the edge of the view. It
404
+ scrolls inside, and the wheel stops at its end. By default the panel stops at 300px, in the
405
+ middle of a row, so the user sees that the list continues. `scroll={n}` asks for another cap
406
+ in px. A panel with fewer rows keeps its content height.
407
+ - When the room is less than 120px, a panel that can go to the other side flips there. Otherwise
408
+ the page can grow so that the user can scroll to the last rows.
409
+ - In a Modal or a Drawer, the panel opens below the trigger and the body scrolls the least
410
+ distance that shows the whole panel, with the label and the trigger above it. A body that is too
411
+ short or too narrow for the panel lifts the panel over the body and its footer.
412
+ - A closed panel adds no scroll room at the end of a page or a body. Closing a panel does not move
413
+ the field while the user is still scrolled into the room that the panel needed.
414
+ - The panel follows its trigger when the page moves the trigger: a new layout, a sideways scroll
415
+ or a transition.
416
+ - Each row answers the pointer with a fill and draws no edge. A destructive row turns `--pink` on
417
+ hover and focus. In forced colours a separator stays a visible line.
418
+
419
+ **Search.** `search` adds a text field above the rows. Typing filters the rows, and the focus stays
420
+ in the field. The match is anywhere in the label, without case or accents. Descriptions are not
421
+ searched, so put the words that a user types in the label. `search={{ count, noun }}` names the
422
+ size of the set, for example "Search 214 people". Each open starts with the whole list. A query
423
+ with no matches says so.
424
+
425
+ **Submenus.** The account menu of `AppShell` has a Theme row that opens a submenu. Right and Enter
426
+ open it, Left and Escape close it, and the focus goes back to the row. On a phone the submenu
427
+ replaces the rows, under a back row.
428
+
429
+ **Your own rows.** `row` lets you draw each row. It gets the row and the props that the row must
430
+ spread: the class, the role, `tabIndex`, `data-dd-item`, the selected and disabled state and the
431
+ click handler. Use it when a row must be a native `<button>` or a router link.
432
+
433
+ **Keyboard and screen reader.** The arrow keys move between rows. Escape closes only the panel and
434
+ sends the focus to the trigger. A click outside also closes it. A select panel is a `listbox` of
435
+ options and a menu panel is a `menu` of menu items. With `search`, the panel is a `dialog`, because
436
+ a listbox may own only options. The focus ring of a row is drawn inside the row, so the panel edge
437
+ never cuts it. Inside a [`Field`](#fields), the label and then the value name the trigger. Outside
438
+ a field, give `ariaLabel`. A placeholder is not a name.
439
+
440
+ ### Command palette
441
+
442
+ Use `CommandPalette` to let the user find a page, a record or an action and run it with the
443
+ keyboard. `AppShell` draws one when you pass `palette`. Do not use it as the only way to reach a
444
+ page.
445
+
446
+ ```tsx
447
+ <CommandPalette open={open} onClose={close} groups={groups}
448
+ onNavigate={(href) => router.push(href)} />
449
+ ```
450
+
451
+ `groups` holds your items. An item has `id` and `label`, and can have `description`, `icon`,
452
+ `keywords`, `shortcut`, `badge` and `href`. Your product names the groups and the kinds of result.
453
+ Every pick calls `onSelect` with the item first. Then the palette closes, and a row with `href`
454
+ goes to the address: `onNavigate` sends a same-tab pick to your router, and a Cmd- or Ctrl-held
455
+ pick opens a new tab.
456
+
457
+ **Destructive rows.** After `onSelect`, an item with `danger` calls its `onConfirm`, and the
458
+ palette stays open, so open your [`Confirm`](#confirm) there. A `danger` item without `onConfirm`
459
+ is disabled. An item with `disabled` cannot be picked. `density` is
460
+ `compact` or `roomy`.
461
+
462
+ **Ranking.** The palette ranks rows by how the query matches. A whole label beats a prefix, a
463
+ prefix beats a word start, a word start beats a substring, a keyword beats a note, and initials
464
+ come last. Groups take the score of their best row. Equal scores keep your order. When a server
465
+ ranks the results, pass `rank={false}` and use `rankGroups` from the root entry on the server, so
466
+ both sides rank the same way. `onQueryChange` gives you the query.
467
+
468
+ **Keyboard and screen reader.** Cmd+K or Ctrl+K opens the palette. Ctrl+K inside another text box
469
+ is left alone. The arrow keys move the active row and wrap at both ends. Enter runs the row, and
470
+ Escape closes the top overlay. Tab stays in the panel. Home and End move the text caret. The focus
471
+ starts in the text box and stays there, over an inert page. The palette opens empty. It stands
472
+ above a drawer and below a confirm.
473
+
474
+ ## Forms and filters
475
+
476
+ ### Fields
477
+
478
+ Use `TextField`, `TextArea`, `SelectField` and `FileField` for each labelled control in a form.
479
+ Use `Field` to give the same label, hint and error to a control of your own, such as a `Dropdown`
480
+ or a `DatePicker`. Do not use a placeholder as the label.
481
+
482
+ ```tsx
483
+ <TextField label="Invoice number" hint="As printed on the invoice" error={errors.number} required />
484
+ <Field label="Due date">{control => <DatePicker {...control} mode="day" value={due} onChange={setDue} />}</Field>
485
+ ```
486
+
487
+ **What the user sees.** The label stands above the control, then the hint. An error marks the
488
+ control invalid and stands before the hint, so a hint with consent, safety or legal words stays on
489
+ the screen. A required field shows a decorative marker, and the control has the native
490
+ `required` attribute. `TextField` takes `unit` and `icon`. `FileField` takes one file from the
491
+ picker or by drop. `accept` only filters the system picker, so check the file before you upload it.
492
+
493
+ **`Field` with your own control.** The child function gets the `id`, `required`, `aria-invalid`
494
+ and `aria-describedby`. Spread them on the control. A dropdown or date picker trigger then has the
495
+ label and the value as its name, and the error gives it the invalid edge. In a field, a dropdown
496
+ trigger has the height of a text input and keeps the pill corner. A long value stays on one line
497
+ and ends with an ellipsis.
498
+
499
+ **Keyboard and screen reader.** The component makes the ids and points the label, the hint and the
500
+ error at the control. The error has `role="alert"`, so a new error is announced and the focus does
501
+ not move.
502
+
503
+ **Room on the screen.** Put a form on a card, not on the page ground. A field is drawn by its edge,
504
+ and on the page ground that edge is too faint. See
505
+ [Colour and contrast](foundations.md#colour-and-contrast). A filter bar is the one exception.
506
+
507
+ ### Search field
508
+
509
+ Use `SearchField` for the search box that starts a toolbar above a list. Do not use it in a form.
510
+ Use `TextField type="search"` with a label there.
511
+
512
+ ```tsx
513
+ <SearchField ariaLabel="Search invoices" size="sm" value={query} onChange={(e) => setQuery(e.target.value)} />
514
+ ```
515
+
516
+ `ariaLabel` is required, because no visible label names the field. `size="sm"` is the field above
517
+ a dense table. With a mouse it is 32px high with `--text-sm`. On a touch screen it is 40px high with
518
+ 16px text, because iOS zooms into a field with smaller text. The field has no clear button of its
519
+ own, because the browser draws one. See [Toolbar](#toolbar).
520
+
521
+ ### Checkbox and switch
522
+
523
+ Use `Checkbox` for an option that the user turns on or off and then submits. Use
524
+ `type="radio"` for one choice of a few that all stay visible. Use `CheckList` to group options
525
+ under a legend. Use `Switch` for a setting that takes effect at once.
526
+
527
+ ```tsx
528
+ <CheckList legend="Notify me">
529
+ <Checkbox label="Paid invoices" hint="One email for each payment" defaultChecked />
530
+ <Checkbox label="Overdue invoices" />
531
+ </CheckList>
532
+ ```
533
+
534
+ **What the user sees.** A resting box has the field fill and an edge that is clear on the page, a
535
+ card, a menu and a hovered row. A checked box, a partial box and a checked radio have a light
536
+ accent tint, an accent edge and an accent mark. `Checkbox` has no `indeterminate` prop. Set the DOM
537
+ property through a ref, and the box shows a short dash. `hint` stands under the label and describes the box. A disabled box has the same disabled
538
+ paint as every other control, and dims its hint.
539
+
540
+ ### Date picker
541
+
542
+ Use `DatePicker` to choose a month, a range of months, a date or a range of dates. Do not use it for
543
+ a date and a time.
544
+
545
+ ```tsx
546
+ <Field label="Period">{control => (
547
+ <DatePicker {...control} mode="range" range={period} onRangeChange={setPeriod} max="2026-12" />
548
+ )}</Field>
549
+ ```
550
+
551
+ `mode` is `month`, `range`, `day` or `day-range`. A single period uses `value` and `onChange`. A
552
+ range uses `range` and `onRangeChange`. Values are ISO strings in the grain of the mode: `2026-08`
553
+ or `2026-08-14`. A value in the other grain still counts: a month in day grain is the whole month.
554
+ `min`, `max` and `disabledPeriods` block periods. `presets`, `locale`, `weekStartsOn` and `today`
555
+ are optional. `placeholder` is the trigger text while nothing is chosen, such as "Select a date"
556
+ by default. `ariaLabel` names the trigger and the title of the phone sheet, and wins over the label
557
+ of a `Field`. Outside a `Field` and without `ariaLabel`, the placeholder is the sheet title.
558
+
559
+ **What the user sees.** The panel opens like a dropdown and holds a grid. A blocked cell has a
560
+ struck label and refuses a press, but the keyboard can still reach it. A range covers everything
561
+ between its ends, also blocked periods. The current period has an accent hairline. Below 560px the
562
+ panel is a sheet from the bottom of the screen. The sheet opens with the chosen period in view and
563
+ the focus on it. In a Modal, the panel opens over the edge of the dialog.
564
+
565
+ **Keyboard and screen reader.** The grid has one Tab stop. The arrow keys move between cells, and
566
+ Home and End go to the ends of the row. Each cell says what it is in its own name. Escape closes
567
+ only the calendar, and the next Escape closes the dialog around it. In a `Field`, the label of the
568
+ field is the title of the sheet, and the trigger reads like "Due date, August 2026".
569
+
570
+ ### File drop
571
+
572
+ Use `FileDrop` to upload a file in a form or a panel. Use `FileDrop` with `title` for the empty
573
+ page of a list that the user fills by upload. Use `FileField` for a file field that matches the
574
+ other fields of a form. When a page uses a row, a region or a dialog:
1205
575
  [File drop](../guidelines/file-drop.md).
1206
576
 
1207
- React `FileDrop` takes `title` to become the empty page's drop. It then draws a dashed box around
1208
- a first-run block with the title, the accepted types and the Upload button. **The button is the
1209
- keyboard path.** A click on the box opens the picker too. A file dropped anywhere in the box
1210
- reaches `onFiles` with every file and `onFile` with the first; pass either or both, and add
1211
- `multiple` to let the picker take several. A file over the box turns its edge to the accent. A
1212
- disabled area accepts nothing.
1213
-
1214
- `.ui-drop--page` is the kit's layer for a page that takes a file anywhere. Put it on the area's own
1215
- markup, `.ui-drop.ui-drop--area.is-dragging`, and it becomes that area made large: a fixed box
1216
- inset from the window and below the topbar, with the same dashed accent edge and radius, holding an
1217
- `EmptyState` with the upload glyph, a line that says to drop the files and the accepted types.
1218
- **Its ground is the page ground, slightly transparent and blurred, so the table shows through softly and no row stays sharp under the words.** Where the browser cannot blur what is behind, or the reader asks for less transparency, the ground is solid. The layer takes no pointer
1219
- events, so the page keeps working under it. **Mount it only while a file is dragged over the page.** It has no fade and no rise, so reduced motion needs no
1220
- second path. The page owns the drag logic, and its own Upload button stays the keyboard path.
1221
- React ships no component for the layer.
1222
-
1223
- ### React Button links and leading artwork
1224
-
1225
- React `Button` accepts `href` and then renders an anchor with the existing button classes.
1226
- Without `href`, it renders a native button defaulting to `type="button"`. Refs and native
1227
- attributes belong to whichever element it renders. `leading` accepts decorative content before
1228
- the label wrapper and takes precedence over `icon`. For an icon-only control, the component
1229
- copies string children, then the icon name, into `aria-label` and `title`. **With neither, it
1230
- stays nameless instead of receiving an invented name.** `className` merges with the kit's
1231
- classes. **The component's state wins over your spread props** — `aria-disabled`, `aria-busy`,
1232
- the `data-btn-*` hooks, a link's `role`, and the `href` and `tabIndex` that a disabled or busy
1233
- control removes. This prevents a caller from leaving a busy or disabled control looking idle.
1234
- **Space is blocked on button roots only**, because it never activates an anchor. A busy link
1235
- that swallowed Space would also prevent the reader from scrolling the page.
1236
-
1237
- ### React charts
1238
-
1239
- `Chart` draws seven shapes: `months`, a column per period with bars and a line across them;
1240
- `bridge`, one period walked from a starting total to a result; `spark`, one series at text
1241
- size with no axis, for a stat band's `trend` slot; and `line`, `area`, `stacked` and `donut`. The numbers, the wording and the formatting
1242
- are yours — `format` prints exact values in the readout, the live region and the table, and
1243
- `formatAxis` prints the ticks, which are whole units.
1244
-
1245
- **`line`, `area` and `stacked` take `periods` and `series`, and `donut` takes `slices`.** A series
1246
- or a slice has no `shape`. Each of the four variants takes `look`, which picks one drawing of
1247
- the same numbers:
1248
-
1249
- | `variant` | `look` values | Default |
1250
- | --- | --- | --- |
1251
- | `line` | `thin`, `points` (a point on each value), `labels` (the last value at the line's end, and a chart that scrolls opens on its latest period) | `thin` |
1252
- | `area` | `flat` (each series from zero), `curves` (each series from zero as a smooth curve, with a point on each value), `stacked`, `share` (each column is 100%) | `stacked` |
1253
- | `stacked` | `columns`, `share` (each column is 100%), `rows` (a bar for each period) | `columns` |
1254
- | `donut` | `thin` (the total in the centre), `table` (a list of the shares beside the ring), `labels` (the name, value and share at each slice) | `table` |
1255
-
1256
- A series or a slice without a `tone` takes the next tone of `accent`, `accent-soft`, `info`,
1257
- `warn`, `good`, `bad` and `neutral`. `area`, `stacked` and `donut` take only values of 0 or more, and a negative value throws a `RangeError` before anything is drawn. A stacked look reads a missing value as zero. The readout of
1258
- a stacked or a share look lists each series of the column and the total, and the table adds a
1259
- `Total` column. A share look gives the parts as percentages, and its table keeps your values.
1260
- The arrow keys step through the periods, the rows or the slices. A donut slice says its value
1261
- and its share of the whole. `totalLabel` names the whole, and it defaults to `Total`. A donut has
1262
- no `selectable`.
1263
-
1264
- **A mark is capped, whatever its column is worth.** A bar never passes a mark's width, so a chart
1265
- that grows with the card gains ground between its columns rather than twelve wider blocks. Two bar
1266
- series on the same side of the zero line stand side by side with ground between them; a
1267
- `bars-below` series takes positive magnitudes and hangs under the line instead. A bar is
1268
- rounded only at the end away from zero, and its foot stands square on the rule it is measured
1269
- from. A bridge carries each step's running total across to the step beside it.
1270
-
1271
- **A series takes one of seven fixed tones, and the product accent does not change them.** The
1272
- tones are `accent`, `accent-soft`, `good`, `bad`, `warn`, `info` and `neutral`, with a light and a
1273
- dark step for each theme. A bar fades from a light tint of its tone at its base on the zero line
1274
- to the full tone at its data end, and a bar under zero fades the other way. The fill is opaque.
1275
- The full tone clears 3:1 on the card and on the page in both themes. The tint is below 3:1 by
1276
- design, because the data end, the zero line and the base carry the value. A bridge bar fades from
1277
- the previous running total to the full tone at the new one, so a fall fades downwards. Lines,
1278
- points and legend keys stay solid in the full tone. **An area ramps with its values:** the tint
1279
- is at the series' lowest top and the full tone at its highest, in every column. An area with one
1280
- value, a share band, a stacked part and a donut slice have no ramp. A `curves` area has a wash
1281
- instead: its tone fades to clear at zero, under each series in the order you give them. Its curve
1282
- never passes the values on each side of it and never goes under zero. Use `curves` for two or
1283
- three series that the reader compares by shape, not by total.
1284
-
1285
- **The legend shows only when you pass `legend`.** **An unfinished period keeps its series fill
1286
- with a dashed edge.** The legend names the estimated state. The readout and the table show the
1287
- state and its `note`.
1288
-
1289
- **The value axis, the period row and the legend are quiet, and nothing is only there.** Every
1290
- data value is reachable at full strength through pointer readouts and keyboard announcements.
1291
-
1292
- **A switch in the top right corner shows the same numbers as a chart or as a table.** It is a
1293
- toolbar of two glyph buttons named Chart and Table, with the pressed one marked. The chart shows
1294
- first. The table replaces the plot, and the switch keeps its place. In a titled `<Card>` the
1295
- switch sits at the end of the card's title row instead, and the chart draws no row of its own for
1296
- it. When a card holds two charts, the first one puts its switch there. When that chart leaves,
1297
- the next one takes the place. Pass `table={false}` to drop the switch and the table.
1298
-
1299
- **Selection is a band behind the column, and focus is the ring on the chart.** Picking a column
1300
- paints the column's own ground and sets its label in the strong ink at a heavier weight; no mark
1301
- changes colour, so each tone stays with the series it names. The switch is the first tab stop
1302
- and the chart is the second: Left,
1303
- Right, Home and End step columns and announce each one politely, Enter picks one when `selectable`
1304
- is set, and `title` names the plot, the table and the switch without being drawn, because the card
1305
- around a chart already carries its title. A plot that scrolls adds one more tab stop after the
1306
- chart: the scrolling box, named after `title` and ringed by the kit.
1307
-
1308
- **On a touch screen a tap opens the readout and a second tap on the same mark closes it. The tap
1309
- that opens a readout does not call `onSelect`** — it is the reader asking what a mark is worth.
1310
- The tap that closes one, and an ordinary mouse click, do, and the click itself is never swallowed,
1311
- so your own listener around the chart still hears every tap. Below 560px, to a coarse pointer, a
1312
- line's point grows to the room its column gives. It never crosses into a neighbour's column. A
1313
- narrow sparkline can therefore own less than 44px across, but it still owns at least 24px
1314
- across and the full 44px down. A sparkline's slot grows with that vertical target, so a
1315
- `trend` slot is 44px tall there instead of 32.
1316
-
1317
- The table carries its columns sideways in a named scroller, so your card and your page keep their
1318
- width whatever series you pass. At phone widths the plot scrolls with the value axis held in
1319
- place, and a column cut by the edge shows that more periods are there. While the plot scrolls,
1320
- the keyboard can scroll it from its own tab stop after the chart. Nothing animates.
1321
-
1322
- ### React route navigation
1323
-
1324
- `NavTabs` uses the same presentation as the vanilla factory, so every
1325
- guarantee above holds for it too. `NavTabs` takes unique item IDs, a controlled active ID, the
1326
- underline or pill presentation, and optional badges. It uses native links and
1327
- `aria-current="page"`, with no tablist or panel roles. **A disabled item is non-focusable text**
1328
- marked `aria-disabled`, and cannot be the current link. An item with no destination uses its ID as
1329
- a fragment. A badge of zero stays visible; a null or empty badge is dropped, the way the vanilla
1330
- factory drops it.
1331
-
1332
- It forwards root attributes and refs, keeps native link keyboard behaviour, and sends every
1333
- destination through the kit's URL boundary.
1334
-
1335
- **It takes `renderLink` with the signature `AppShell` uses**, so a router renders each link from
1336
- the kit's class, destination, current state and children, and a route change need not reload the
1337
- document.
1338
-
1339
- `NavTabs` sizes its row on mount, on a route change and on window resize, preserving the reader's
1340
- scroll position during content and container changes. It reveals the current route after mount and
1341
- route changes, and reveals a link a focus event lands on. There is nothing to wire for it;
1342
- `wireNav()` is for the vanilla rows. React imports the kit's own `safeUrl` and reveal functions
1343
- rather than a copy bundled into `react/dist`.
1344
-
1345
- ### React top bar
1346
-
1347
- `TopBar` composes `ViewSwitch`, `VersionSwitcher`, `ThemeToggle` and `AccountMenu` into the vanilla
1348
- `topbar()` band, with the same classes and the same two rows on a phone. Each slot is optional, and
1349
- no account is the signed-out bar. **The current view in the Deck and Text switch is filled with the
1350
- accent fill of a chosen Segmented option**, in the vanilla switch as well as React's. **The version
1351
- button shows only the chosen name**. **The open version menu shows each name and badge and ticks the chosen version**.
1352
- The button and tick follow `value` until the caller updates it. `AccountMenu` marks the page named by `current` in accent ink.
1353
-
1354
- ### The rest of the React surface
1355
-
1356
- - **`Tabs`** unmounts inactive panel content. Arrow keys, Home and End move between tabs and
1357
- activate them.
1358
- - **`Segmented`** is a controlled choice toolbar: one named toolbar, pressed buttons and **one
1359
- Tab stop whatever the choice is.** Arrow keys wrap past disabled options; Home and End reach
1360
- the first and last enabled choice. `block` fills the container with either appearance. An
1361
- option's `icon` names a kit glyph drawn before its label. With `iconOnly`, the glyph is the
1362
- whole button and the label becomes its accessible name and its hover title.
1363
- **`size="sm"` compacts the pill appearance only:** under the underline appearance it changes
1364
- the type size and leaves the tab at its full height.
1365
- - **`Confirm`** builds on `Modal` as an `alertdialog`. It focuses the safe action and draws it
1366
- before the committing action. `onConfirm` only reports the press. Saving, errors and closing
1367
- are yours.
1368
- - **`Feedback`** offers a "Give feedback" pill on a text selection and opens a form with the
1369
- quoted passage and a note. `onSend` files the note. A failed send keeps the note and shows the
1370
- error in place. A sent note shows one line of thanks. Escape returns focus to the prior visible
1371
- control, or to the pill if that control is unavailable.
1372
- - **`Timeline`** renders your events from oldest to newest. **Only the last event's marker is
1373
- filled.** A new ID in a non-empty history plays an entrance. Editing existing IDs does not.
1374
- - **`AppShell`** shares the vanilla fold cookie and 720px fold. `layout="rail"` places the
1375
- account at the rail foot and leaves only Sign out in its menu. It shows no section counts.
1376
- Pass `back` to show the way up from a subpage, above the page title.
1377
- **`tools` puts small tools for the whole page at the end of the title row** (#736), such as
1378
- a version badge, a period picker or a `size="sm"` button. The lede stands under the whole row.
1379
- **Tools that do not fit beside the title go under it**, so a period picker and a view action
1380
- can stay on a 390px phone. `actions` keeps
1381
- the page's buttons in their own row under the title.
1382
- **`accountItems` adds a product's rows, such as Account settings and Support, at the top of
1383
- every account menu,** above the Theme row and Sign out. A row takes `href` to go somewhere,
1384
- or `onSelect` to open something in place.
1385
- The existing band layout stays the default. The longest matching section
1386
- path wins. **At 720px and below, a menu button and the brand mark on the band replace the
1387
- rail:** the button opens the full section list in a drawer, and the page takes the full
1388
- width. **The drawer opens from the side of its menu button:** the right in the topbar
1389
- layout, where the button ends the band, and the left in the rail layout. Set `drawerSide`
1390
- to `'left'` or `'right'` to choose the side in either layout (#790,
1391
- `react/src/AppShell.tsx:185` `side={drawerSide ?? 'left'}`). A press on a section, Escape or a wider window closes the drawer, and focus returns to
1392
- the button. **A shell whose list has nowhere to go — one section and no back
1393
- link — draws no rail, no fold control and no menu button;** the brand lockup moves to the band
1394
- and the section stays in the command palette. One section under a child page is a destination,
1395
- the page's parent, so that list is drawn and the row takes `aria-current="true"`.
1396
- `searchLabel` names the band trigger's words. `searchShortLabel` is deprecated and not drawn.
1397
- **`onNavigate` hands the built-in palette's same-tab picks to a client router,** so the page
1398
- changes without a reload. An app's own `palette` wins: its `onNavigate` is used when it sets one.
1399
- **With a sidebar, the account and `bandControl` stand in the sidebar, not on the band, and the
1400
- theme is a row of the account menu** (#732). The rail keeps the fold's control
1401
- in its head, `bandControl` under the head, then the sections and the account at its foot. A
1402
- folded rail keeps the account mark, and makes `bandControl` inert. The drawer puts
1403
- `bandControl` above the sections, and the account in its footer (`react/src/AppShell.tsx:233` `{accountBlock(true, true)}`).
1404
- **`headControl` is one glyph control in the sidebar head, before the fold button** (#732). It
1405
- is drawn as the fold is: a plain glyph with no border and no fill, the fold's size, ink and
1406
- hover (`react/src/AppShell.css:56` `.ui-react-app__head-control > :is(button, a)`). A folded
1407
- rail moves it out of the head row onto the glyph column, one rail gap under the head, and it
1408
- stays usable. The drawer puts it in the panel's head, before the close button, as a 40px tap
1409
- target (`react/src/AppShell.tsx:233` `headerActions={headSlot}`). `Drawer` takes
1410
- `headerActions` for controls between its title and its close button. A shell with no sidebar
1411
- puts `headControl` on the band after `bandControl`.
1412
- **The Theme row opens a submenu of Auto, Light and Dark** (#736). The row shows the current
1413
- choice, and a check marks it in the submenu. Right or Enter opens the submenu, Left or Escape
1414
- closes it, and focus returns to the Theme row. A pick sets the theme and closes only the
1415
- submenu. In the sidebar the submenu flies out beside the menu, past the sidebar's edge. In the
1416
- drawer it replaces the menu's rows, under a Theme back row
1417
- (`react/src/AccountMenu.tsx:18` `function AccountMenu`). A separator stands before Sign out. In the drawer a `.toggle` in
1418
- `bandControl` and each account menu row are 40px tap targets, and focus starts on the first row.
1419
- **Above 720px the band's search field stands in its centre** (`react/src/AppShell.css:93` `@media (min-width: 721px)`).
1420
- **At 720px and below the band holds the mark, the page title on one line, search and Menu at
1421
- the end, and nothing else.** The title ends in an ellipsis when it is long, and is hidden from
1422
- screen readers, because the page's `h1` keeps its name (`react/src/AppShell.css:101` `.ui-react-app__title {`). **Below
1423
- 560px each band control is a bare 40px glyph with no border and no box**, so the band fits
1424
- 300px. The search trigger shows only its glyph there, an exception in
1425
- `guidelines/iconography.md` (#729). The shared stylesheet clips the sentence and the key cap
1426
- rather than dropping them, so the button keeps one accessible name at every width. A shell
1427
- without a sidebar keeps `bandControl`, the theme switch and the account on its band.
1428
- **When it mounts, the theme switch applies the stored theme choice, or follows the system when
1429
- there is none.**
1430
- A page that sets its own `data-theme` must also set `data-theme-choice`, or store the choice,
1431
- to keep that theme. For example, `<html data-theme="light">` on a dark system turns dark
1432
- when the shell mounts.
1433
- - **`SidebarNav`** accepts flat items or captioned sections, nested groups, counts and
1434
- router-link rendering. **Nesting stops one level deep.** Each row keeps its name and count when
1435
- collapsed.
1436
- - **`Checkbox` and `Switch`** render native inputs inside the existing label classes, and **a
1437
- disabled one uses the same paint as every other disabled control in the kit.** A resting box
1438
- has a field's fill and an edge of at least 3:1 on the page, a card, a menu and a hovered row.
1439
- It measures 5.36:1 or more in light and 5.38:1 or more in dark. **A checked or partial box is a
1440
- light tint of the accent with an accent edge and an accent mark, not a solid accent block.** A
1441
- checked radio uses the same paint. Under every accent, the edge measures 5.74:1 or more in light
1442
- and 4.61:1 or more in dark on a card and on a selected or hovered selected row. The mark measures
1443
- 5.23:1 or more on the tint in light and 4.46:1 or more in dark.
1444
- - **A checkbox whose `indeterminate` property is true shows the checked fill with a short dash**
1445
- in place of the tick. **`DataTable`'s selection boxes use the kit box and show the dash when some,
1446
- but not all, rows on the page are selected.** **A selection column takes the width of its box in
1447
- every selectable table, and in a dense or compact table the box's phone tap area stays 24px tall so
1448
- it never reaches the next row.**
1449
- - **`Checkbox` takes an optional `hint`,** which sits under the label words and is linked to the box as
1450
- its description; the label stays the box's name. **`CheckList` groups `Checkbox` children in a
1451
- fieldset under a legend** set in the field label's type. A disabled box dims its hint with its label.
1452
- - **`Snippet`** displays `code` as plain text, and **copying always writes the original `code`
1453
- string**, whatever `children` displays. **`Snippet` is a block of code, not the only way to
1454
- copy.** To copy an identifier where it stands, in a drawer row or a table cell, put an
1455
- icon-only `Button` with the `copy` glyph beside it, such as
1456
- `<Button variant="ghost" size="sm" icon="copy" iconOnly>Copy INV-1162</Button>`. Its words
1457
- become its accessible name and its hover title. Swap the glyph to `check` for a moment after
1458
- the copy, as `Snippet` does.
1459
- - **`EmptyState`** uses the vanilla markup and CSS, and **the page supplies its own `h1`.**
1460
- - **`ThemeToggle`** cycles through dark, light, auto, then dark. It stores explicit choices
1461
- and follows the OS otherwise. It sets `data-theme-choice` and the resolved `data-theme` on
1462
- `html` and exports `THEME_INIT_SCRIPT` for a head script.
1463
- - **`Tooltip`** renders the vanilla host, panel and label classes. Escape keeps focus on the
1464
- trigger. A hover opens it after 300ms and keyboard focus at once; see
1465
- [The React tooltip](#the-react-tooltip).
1466
- - **`Pill`** and **`StatusDot`** add no interactive role and create no live region. Visible
1467
- status text belongs beside the dot.
1468
- - **`SuccessPanel`** is the inline confirmation. **`SuccessCheck`** is the bare shared mark.
1469
- - **Shared logic.** `dropdownMatch`, `dropdownFiltering`, `rankGroups`, `rankCommands`,
1470
- `scoreCommand`, `paletteHotkey`, `segmentedNextIndex`, `PAGE_SIZES`, `DEFAULT_PAGE_SIZE`,
1471
- `calloutIcons`, `chartScale`, `bridgeWalk`, `pointTarget` and `CHART_FLOOR` come from the main
1472
- entry. So do `formatNumericValue` and
1473
- `formatDeltaValue`. They return plain text and classes for React to render and never HTML.
577
+ ```tsx
578
+ <FileDrop label="Upload invoice" note="PDF up to 10 MB" accept=".pdf"
579
+ file={upload} onFile={startUpload} onRemove={clearUpload} onRetry={retryUpload} />
580
+ ```
1474
581
 
1475
- ## What the kit does not do
582
+ You own the upload. `FileDrop` sends a chosen or dropped file to `onFile` and shows the `file` that
583
+ you pass back: `name`, `size`, `status`, `progress` and `error`. A file with no `status` is
584
+ uploading, so the kit never shows success that you did not report. `onFiles` gets every dropped
585
+ file. `multiple` lets the picker take more than one.
1476
586
 
1477
- This is stated so nobody has to discover it by trying:
587
+ **What the user sees.** At rest, one row with the button that opens the picker and your note
588
+ beside it. A file keeps the 32px height of the row: the name, the size, and the status or the
589
+ progress track on one line, then Remove. A long name keeps its extension. A status has a circled
590
+ mark and a word. A refused file shows its reason, under the name when the line is full. Remove and
591
+ Retry show only when you pass `onRemove` and `onRetry`. The drop target shows only while a file is
592
+ over the region, over the content and not in place of it. Children of `FileDrop` stand above the
593
+ row, inside the same region, so a whole panel can take the drop. In a parent that sizes to its
594
+ content, the row is 420px wide or less.
1478
595
 
1479
- - **No build step**, whose consequence is
1480
- [breakpoints as literals](foundations.md#breakpoints).
1481
- - **No density system.** `.ui-table--dense`, `.ui-table--compact`, `.ui-table--comfortable` and
1482
- `.ui-cmdk--roomy` are the only density modifiers, and each is local to its component.
1483
- - **No container scale.** There is one `--container`, not a narrow/wide set.
1484
- - **No second bar for a control's glyph.** 1.5 CSS px is the line for every stroked mark.
1485
- - **No charts.** A stat band's trend is a slot for your `<svg>`.
1486
- - **No hand-written markup contract, except a row the kit renders as a control** — a `<div>` with
1487
- a role and a tabindex, or an `<a>`, which you must rewrite as a `<button>` when it needs to
1488
- work from the keyboard. Those class names are a supported surface.
1489
- - **No support for a vertical writing mode.**
596
+ With `title`, `FileDrop` is a dashed box with the title, the accepted types and an Upload button.
597
+ The button is the keyboard path. A click on the box also opens the picker. A disabled drop accepts
598
+ nothing.
1490
599
 
1491
- ## Recipes
600
+ **A page that takes a file anywhere.** Put `.ui-drop--page` on
601
+ `.ui-drop.ui-drop--area.is-dragging` markup, and mount it only while a file is over the page. It is
602
+ a fixed layer with the dashed accent edge and an `EmptyState`. It takes no pointer events. Your
603
+ page owns the drag logic, and its Upload button stays the keyboard path.
1492
604
 
1493
- ### A dropdown row you write yourself
605
+ ### Segmented
1494
606
 
1495
- `<button class="ui-dropdown__item">` renders the same row that `dropdown()` emits. Write
1496
- one when the row must be a native control. The reason is explained in
1497
- [A dropdown row is a div, a link or a button](#a-dropdown-row-is-a-div-a-link-or-a-button).
607
+ Use `Segmented` when a choice narrows a list, flips a unit or sets a preference, and all the options
608
+ fit on one row. Use [`Tabs`](#tabs) when each choice shows a different panel. See
609
+ [Segmented or tabs?](#segmented-or-tabs).
1498
610
 
1499
- ```html
1500
- <button type="button" class="ui-dropdown__item" data-dd-item role="menuitem" tabindex="-1">
1501
- <span class="ui-dropdown__main"><span class="ui-dropdown__label">Rename</span></span>
1502
- </button>
611
+ ```tsx
612
+ <Segmented label="Period" value={period} onChange={setPeriod}
613
+ options={[{ value: 'm', label: 'Month' }, { value: 'q', label: 'Quarter' }, { value: 'y', label: 'Year' }]} />
614
+ ```
615
+
616
+ `appearance` is `pill`, the default, or `underline`. `size="sm"` makes the pill smaller, and in
617
+ the underline appearance it changes only the type size. `block` fills the row. An option's `icon`
618
+ draws a glyph before its label. With `iconOnly`, the glyph is the whole button and the label is
619
+ its name and its hover title.
620
+
621
+ **What the user sees.** The chosen pill has the accent fill of a primary button. The chosen
622
+ underline tab is its label with a 2px accent bar under it, and no box. Hover changes only the
623
+ ink. When the options do not fit, they wrap onto more rows, so the strip never makes the column
624
+ wider. A long label wraps inside its own option.
625
+
626
+ **Keyboard and screen reader.** One named toolbar of pressed buttons, with one Tab stop. The arrow
627
+ keys move and choose, wrap at the ends and skip disabled options. Home and End go to the first and
628
+ last enabled option. In forced colours the chosen option uses the system highlight colours.
629
+
630
+ ### Tabs
631
+
632
+ Use `Tabs` when each choice shows a different block of content on the same page. Use
633
+ [`NavTabs`](#route-tabs) when each choice is its own address.
634
+
635
+ ```tsx
636
+ <Tabs label="Invoice" value={tab} onChange={setTab}
637
+ items={[{ value: 'lines', label: 'Lines', count: 12, panel: <Lines /> }, { value: 'notes', label: 'Notes', panel: <Notes /> }]} />
638
+ ```
639
+
640
+ It draws a tablist and the panel of the chosen tab. Content of the other panels is not mounted.
641
+ The arrow keys, Home and End move between tabs and choose them.
642
+
643
+ ### Filter bar
644
+
645
+ Use `FilterBar` for the row of filter chips above a table. Each chip narrows the rows by one field.
646
+ Use a [`Dropdown`](#dropdown) instead when a list of values needs more room than a chip gives.
647
+
648
+ ```tsx
649
+ <FilterBar filters={filters} add={addable}
650
+ onChange={(id, value) => setFilter(id, value)} onRemove={removeFilter} onClear={clearFilters}
651
+ onAdd={(id, value) => addFilter(id, value)} />
652
+ ```
653
+
654
+ You control the bar. A filter has `id`, `label`, `items` and an optional `value`. A pick, a remove
655
+ and Clear all call your handlers. They never change your filters. `add` and `onAdd` add a Filter
656
+ control after the chips. Its menu holds one section for each filter that the bar does not show,
657
+ with a search field from ten values. When you add the filter in the same update, the focus goes to
658
+ the new chip. `clearLabel`, `clearVariant` and `addLabel` change the words and the look.
659
+
660
+ **What the user sees.** A chip shows only the chosen value. Without a value, it shows the filter
661
+ name. The open menu is at least 240px wide, or the width of the row when the row is narrower. It
662
+ stays inside the row and never makes the page wider. The menu marks the chip's value with a soft
663
+ accent wash and a check. Clear all and the remove mark of a chip show only when there is a value to
664
+ clear. A disabled or busy bar answers nothing. A menu of your own in the bar that needs more than
665
+ 240px, such as a catalogue with a search field, declares `--ui-filter-panel-ask` in your
666
+ stylesheet. It is then 320px wide where the row has the room, and the width of the row where it
667
+ does not.
668
+
669
+ **Keyboard and screen reader.** The name of each filter reaches the user through the trigger name
670
+ and a hidden legend. When the user clears the last filter, the focus goes to the Filter control,
671
+ or else to the next control that Tab would reach. If the focused remove mark goes, the focus goes
672
+ to the chip's trigger.
673
+
674
+ **Room on the screen.** The bar stands on the page directly above its table card, with no card of
675
+ its own. Keep its search field live, because a disabled field is too faint on the page ground.
676
+
677
+ ### Toolbar
678
+
679
+ Use `.ui-toolbar` for the row of controls above a list: a search field, then the filters, then the
680
+ view switch. Put a create action on its own row above the toolbar, at the left.
681
+
682
+ ```tsx
683
+ <div className="ui-toolbar">
684
+ <SearchField ariaLabel="Search invoices" size="sm" />
685
+ <FilterBar … />
686
+ <Segmented label="View" size="sm" … />
687
+ </div>
688
+ ```
689
+
690
+ **What the user sees.** Each control on a toolbar line has the same height, so a button beside a
691
+ field has the same top and bottom edge. Do not change the size of a control to make it fit. A
692
+ toolbar that starts with a small search field is a small row: with a mouse, the chips, Filter,
693
+ Clear all, a dropdown trigger, a small Segmented and a small button are 32px. Give the Segmented
694
+ and the button `size="sm"` yourself. The small search field stops at 320px. On a touch screen the
695
+ row is 40px. `.ui-toolbar--split` puts the last control at the end of the row, also on a phone.
696
+
697
+ **Room on the screen.** The row wraps only when the text field would be narrower than 6rem. At
698
+ 560px and below, each search field takes the full line and the other controls wrap under it. The
699
+ toolbar stands 8px above the block that it controls, or 20px on a touch phone below 560px.
700
+
701
+ ## Content and status
702
+
703
+ ### Card
704
+
705
+ Use `Card` to group the content of one topic on a surface: a form, a table, a chart or a setting
706
+ list. Do not put a card in a card, and do not use a card only to add space.
707
+
708
+ ```tsx
709
+ <Card title="Payments" sub="Last 30 days" tools={<Button size="sm" variant="ghost" icon="download" iconOnly>Download PDF</Button>}>
710
+ <PaymentsTable />
711
+ </Card>
712
+ ```
713
+
714
+ `title` is a heading one level under the page's: an `h2` by default, and `level` moves it to
715
+ `h3`–`h6`. `variant` is `accent` or `live`, a tinted surface without a coloured edge. `pad="sm"`
716
+ gives less vertical space, and `pad="lg"` makes a centred landing card. `icon` adds a title chip.
717
+ `href` makes the whole card a link. `tools` puts small controls at the end of the title row,
718
+ centred on the title line. On a touch phone the tools stand `--tap-gap` apart. A `Chart` in a
719
+ titled card puts its Chart and Table switch there.
720
+
721
+ **Setting rows.** A setting row keeps its choice on one line. On a phone, the control stands under
722
+ its label and hint. Use `ui-card__row--tight-choice` for a three-option row that must stay on one
723
+ line below 360px.
724
+
725
+ **A document in a card.** Wrap a `.ui-toolbar` and a `.ui-table-scroll` in `.ui-card__viewer`, and
726
+ give the document `.ui-card__page`. The toolbar is a slim row between two lines. The page is a
727
+ white sheet with dark text in both themes, with A4 proportions at the least.
728
+
729
+ ### Badge, pill and status dot
730
+
731
+ Use `Badge` for the status of a record, such as Paid or Overdue. Use `Pill` for a `live` or `soon`
732
+ marker on a product or a feature. Use `StatusDot` beside a word that says live or off. Use an
733
+ [ink word](#data-table) for a second status in the same row.
734
+
735
+ ```tsx
736
+ <Badge variant="success">Paid</Badge> <Pill variant="live">Live</Pill> <StatusDot live /> Connected
737
+ ```
738
+
739
+ None of them has an interactive role or a live region. Put the status words beside the dot. The
740
+ colour never carries the status alone.
741
+
742
+ ### Avatar
743
+
744
+ Use `Avatar` to show a person beside their name. Do not use it in place of the name.
745
+
746
+ ```tsx
747
+ <Avatar personKey={user.id} name="Dana Reyes" src={user.photo} size={32} />
1503
748
  ```
1504
749
 
1505
- `wireDropdown()` finds rows with `data-dd-item` inside `[data-dropdown-panel]`. It does not
1506
- find them by class. These attributes make the row work:
1507
-
1508
- - `data-dd-item` — without it, the row is not in the arrow-key ring or the click handler
1509
- - `role="menuitem"` in a `menu` dropdown, `role="option"` in a `select` one
1510
- - `tabindex="-1"` — the panel moves focus itself, while a `<button>` is in the tab order by default
1511
- - `type="button"` — without it, a row inside a form submits the form
1512
- - `aria-disabled="true"` for a disabled row, not the native `disabled` attribute: the item walk
1513
- filters rows using this attribute
1514
- - `aria-selected="true|false"` on a `select` row, and keep the `.ui-dropdown__label` span — the
1515
- pick is written to `aria-selected` on the row itself, never on a span inside it, and the row
1516
- also takes `is-selected`, which is what shows its tick. The trigger's `.ui-dropdown__value`
1517
- text is copied from the picked row's `.ui-dropdown__label`
1518
- - `data-value="…"` if you read the pick from the element
1519
-
1520
- ### Forms
1521
-
1522
- `field()` provides wiring that a control cannot provide for itself. It sets the label's `for=`,
1523
- adds an id to the hint or error and points to it with `aria-describedby`, adds `aria-invalid`
1524
- to a field with an `error`, and adds the native `required` attribute under the decorative
1525
- asterisk. **A `dropdown()` inside `field()` is wired through its trigger button**, because the
1526
- dropdown's `id` sits on a wrapper that a label cannot name. The label and then the chosen value name
1527
- the trigger, the error or hint describes it, and an error marks it invalid. The list is named by the
1528
- label unless you give it an `ariaLabel`. A control outside a `field()` needs its own `ariaLabel`. A
1529
- placeholder is not a name. **In a field, a dropdown trigger has the shape of a text input.** It
1530
- has the input's pill corner, its top and bottom padding and its type size, so the two have the
1531
- same height. Its side padding is 16px, 1px more than the input's. On a touch screen its text is a
1532
- fixed 16px, as the input's is, also when the host changes `--text-base`. A long value stays on
1533
- one line, starts at the left and ends with an ellipsis, as in a select, so the trigger keeps the
1534
- input's height at every value length. A person mark stands as far from the left edge as from the
1535
- top and bottom edges. A date picker in a field does the same. Outside a field, for example in a
1536
- filter bar, a toolbar or the topbar, the trigger is the same pill. See
1537
- [Control corners](foundations.md#control-corners).
1538
- Put a form on a card, not on the page ground. A field is drawn by its edge, but the page ground
1539
- is too close to the field's own fill for you to see that edge. See
1540
- [Colour and contrast](foundations.md#colour-and-contrast). **A filter bar is the one exception.**
1541
- It stands on the page directly above its table card, with no card of its own. On the page ground,
1542
- the edge of its search field measures 1.37:1 in light and 1.50:1 in dark. Keep that search field
1543
- live on the page, because a field that is off measures 1.12:1 there.
750
+ **What the user sees.** A filled circle with the first and last initials, 24px or 32px. The hue
751
+ comes from `personKey`, the stable id of the person, so one person keeps one hue on every screen.
752
+ The letters are readable on each hue in both themes and under every accent. A name with no letters
753
+ shows the `user` glyph. `empty` shows a dashed ring for "no one". A `src` photo covers the letters,
754
+ and the letters show when the photo does not load. The top bar account button, its menu and the
755
+ shell's reader block show the same mark. A dropdown row takes `avatar: { key, name, src }`, and a
756
+ select shows the mark of the chosen row in its trigger.
757
+
758
+ **Keyboard and screen reader.** The mark is hidden from assistive technology, because the name
759
+ stands beside it. It has no hover, focus or cursor of its own.
760
+
761
+ ### Callout
762
+
763
+ Use `Callout` for a message that belongs to the page that the user is on, such as a warning above a
764
+ form. Use a [toast](#toast) for a short notice after an action.
765
+
766
+ ```tsx
767
+ <Callout variant="warn" actions={<Button size="sm">Review</Button>}>Two invoices have no due date.</Callout>
768
+ ```
769
+
770
+ `variant` is `neutral`, `info`, `success`, `warn` or `danger`. Success, danger and warn take a
771
+ circled status glyph. Info and neutral take `info`. Pass `icon` when the tone does not say enough.
772
+
773
+ ### Toast
774
+
775
+ Use a toast for a short notice that an action finished or failed. Do not use it for a message that
776
+ the user must read before going on. Use a [callout](#callout) or a [confirm](#confirm) for that.
777
+
778
+ ```tsx
779
+ <Toast collapse><App /></Toast>
780
+
781
+ const push = useToast();
782
+ push({ tone: 'success', title: 'Invoice sent', action: { label: 'Undo', onClick: undoSend } });
783
+ ```
784
+
785
+ Use one `Toast` provider for each document. A notice has `title`, and can have `text`, `tone`,
786
+ `action`, `compact`, `dismissible` and `timer`. `compact` has no body text.
787
+ `dismissible={false}` hides the close button. `timer={false}` keeps the notice until the user
788
+ closes it. A number sets the seconds.
789
+
790
+ **What the user sees.** The stack is at the bottom right, with the newest notice at the bottom. A
791
+ notice without an action closes after five seconds. Its timer line and its countdown stop while it
792
+ is hovered, focused or held in a pile. A notice with an action stays until the user picks the
793
+ action or closes it. With `collapse`, the stack is a pile with the newest notice in front. The pile
794
+ opens into a column on hover and on focus. A ninth notice makes the pile no taller than a third. A
795
+ device without hover always shows the column. Under reduced motion the timer line is not drawn.
796
+
797
+ **Keyboard and screen reader.** An ordinary notice is polite and a danger notice is assertive. A
798
+ new notice does not move the focus.
799
+
800
+ **Room on the screen.** The provider sets `--rx-toast-stack` on the document root to the height of
801
+ the stack, or `0px` when it is empty. A fixed page action can use it to stay clear of the notices.
802
+
803
+ ### Success confirmations
804
+
805
+ Use `SuccessPanel` to confirm a task inside the page where the user stays, such as after a form
806
+ submit. Use `Success` when the confirmation is the whole screen and the user needs somewhere to go
807
+ next. See [SuccessPanel or Success?](#successpanel-or-success).
808
+
809
+ ```tsx
810
+ <Success title="Payment sent" body="Dana will get an email." actions={<Button href="/payments">Back to payments</Button>} />
811
+ ```
812
+
813
+ A confirmation has one title and at most one short line under it. It has no eyebrow. It stands on
814
+ a plain elevated card. `Success` takes `layout` (`hero`, `split` or `compact`), `level`, `actions`,
815
+ `confetti` and `countdown` with `onCountdownEnd` for a redirect. `SuccessCheck` is the mark alone.
816
+
817
+ `check` chooses the mark:
818
+
819
+ | `check` | Mark | Size | Motion |
820
+ | --- | --- | --- | --- |
821
+ | `line` (default) | the `check` glyph, in the success colour | 56px hero, 72px split, 28px compact, 28px in a panel | draws itself over `--dur-slow` |
822
+ | `circled` | the `circleCheck` glyph | 20px in every layout | none |
823
+
824
+ A circled glyph reports a state, so use `circled` where [Iconography](../guidelines/iconography.md)
825
+ asks for a state mark.
826
+
827
+ ### Loading and denied states
828
+
829
+ Use `BusyRegion` around content that loads after the page. Use `Skeleton` and `SkeletonTable` as
830
+ its placeholder. Use `Denied` when the user may not see the content. Do not show a spinner for a
831
+ screen-sized wait.
832
+
833
+ ```tsx
834
+ <BusyRegion busy={loading} label="Loading your report…" message={`${rows.length} rows`}
835
+ placeholder={<SkeletonTable rows={4} />}>
836
+ <ReportTable rows={rows} />
837
+ </BusyRegion>
838
+ ```
839
+
840
+ **What the user sees.** While `busy`, the region shows the placeholder, which has the shape of the
841
+ content that comes. Then it shows the content.
842
+
843
+ **Keyboard and screen reader.** The region stays mounted and announces `label` while busy and
844
+ `message` when done. It is the one part of the kit that announces a pending state. A skeleton is
845
+ hidden from screen readers. `Denied` has no role of its own, so the region where you put it
846
+ announces it. Pass `need` to say what access the user needs.
847
+
848
+ ### Empty state
849
+
850
+ Use `EmptyState` when a list, a table or a page has nothing to show. Say why and give the next
851
+ step. Do not use it for an error.
852
+
853
+ ```tsx
854
+ <EmptyState variant="no-matches" actions={<Button onClick={clearFilters}>Clear filters</Button>} />
855
+ ```
856
+
857
+ `variant` is `first-run`, `no-matches`, `not-found` or `not-yet-built`, and each has default words
858
+ and art. `title`, `sub`, `icon` and `art` replace them. The page keeps its own `h1`.
859
+
860
+ ### Snippet
861
+
862
+ Use `Snippet` for a block of code that the user reads or copies, such as an API key or a command.
863
+ To copy one identifier where it stands, in a drawer row or a table cell, use an icon-only
864
+ `Button` with the `copy` glyph instead.
865
+
866
+ ```tsx
867
+ <Snippet label="Install" code="npm install @apliteni/apliteni-ui" />
868
+ <Button variant="ghost" size="sm" icon="copy" iconOnly>Copy INV-1162</Button>
869
+ ```
870
+
871
+ `label` is the head line, `shell` by default. `code` is the text. `children` can show other markup, and copy still writes `code`. `reveal` hides
872
+ the code until the user shows it. `copy={false}` removes the copy button. `copyLabel` names it.
873
+
874
+ **What the user sees.** The copy button has only a glyph. After a copy the glyph changes to a check
875
+ in the same box, and a hidden live region says the word. In a card, the block has the page ground.
876
+ A shade marks an edge with more code past it. The highlight colours are readable in both themes.
877
+ In light, keywords, flags and URLs are below AA where the shade is darkest. This is a known gap.
878
+
879
+ **Highlighting.** `hlCode(raw, lang)` from the root entry returns highlighted HTML for `shell`,
880
+ `json` and `ts`. `codeLanguages` lists them, and another name is read as shell. It colours short
881
+ snippets, not whole programs.
882
+
883
+ ### Timeline
884
+
885
+ Use `Timeline` for the history of one record, such as who changed an invoice and when.
886
+
887
+ ```tsx
888
+ <Timeline events={[{ id: 'e1', actor: 'Dana Reyes', dateTime: '2026-08-14T09:30', timestamp: '14 Aug, 09:30', description: 'Sent the invoice' }]} />
889
+ ```
890
+
891
+ The events show from oldest to newest. Only the marker of the last event is filled. An event can
892
+ have `kind`, `meta` and `undo`. A new event in a list that is not empty plays an entrance.
893
+
894
+ ### Icon
895
+
896
+ Use `Icon` for a line glyph beside words. Use `Button icon` for a glyph in a button.
897
+
898
+ ```tsx
899
+ <Icon name="download" />
900
+ ```
901
+
902
+ `iconNames` from the root entry lists the names. A glyph without a word is allowed only for the
903
+ names in `iconOnlyAllowed`. See [Icons and glyphs](foundations.md#icons-and-glyphs).
904
+
905
+ ## Overlays
906
+
907
+ ### Modal
908
+
909
+ Use `Modal` for a short form or a question that must finish before the user goes on. Use a
910
+ [drawer](#drawer) to look at or change a record beside its list. Use [`Confirm`](#confirm) for a
911
+ destructive question.
912
+
913
+ ```tsx
914
+ <Modal open={open} title="Rename workspace" onClose={close}
915
+ footer={<><Button onClick={close}>Cancel</Button><Button variant="primary" onClick={save}>Save</Button></>}>
916
+ <TextField label="Name" defaultValue={name} />
917
+ </Modal>
918
+ ```
919
+
920
+ **What the user sees.** A raised surface over a deep scrim, at most 96% of the viewport high. The
921
+ body scrolls, and the title, the close control and the footer stay visible. The title is an `h2`.
922
+ `initialFocusRef` chooses the first focus.
923
+
924
+ ### Confirm
925
+
926
+ Use `Confirm` before a destructive action that the page must stop for. Use
927
+ [hold to confirm](#hold-to-confirm) when the user can confirm on the button itself.
928
+
929
+ ```tsx
930
+ <Confirm open={open} title="Delete 3 invoices?" body="This cannot be undone." danger
931
+ confirmLabel="Delete" cancelLabel="Keep" busy={deleting} onConfirm={remove} onCancel={close} />
932
+ ```
933
+
934
+ It is an `alertdialog`. The safe action gets the focus and stands before the committing action.
935
+ `onConfirm` only reports the press. You save, show errors and close.
936
+
937
+ ### Drawer
938
+
939
+ Use `Drawer` to look at or change one record without leaving the list that opened it. Use a page
940
+ when the task needs more than one record. When a flow needs a drawer or a page:
941
+ [Drawer](../guidelines/drawer.md).
942
+
943
+ ```tsx
944
+ <Drawer open={open} title="Invoice INV-1162" onClose={close} footer={<Button>Edit</Button>}>
945
+ <DrawerSection title="Details">
946
+ <KeyValueList rows={[{ label: 'Customer', value: 'Northwind' }, { label: 'Due', value: '14 Aug 2026' }]} />
947
+ </DrawerSection>
948
+ </Drawer>
949
+ ```
950
+
951
+ `side` is `right`, `left`, `top` or `bottom`. `size` is `sm`, `md` or `lg`. `headerActions` puts
952
+ controls between the title and the close button.
953
+
954
+ **What the user sees.** The panel slides in over a scrim. The body groups by heading, never by
955
+ card. `DrawerSection` puts a heading on a 1px line, and groups stand 32px apart. `KeyValueList`
956
+ shows label and value pairs, in one or two columns. A value stays beside its label. An icon button
957
+ at the end of a value, such as a copy button, stays on the value's line. Nothing in a drawer draws a
958
+ card, a row rule or an `<hr>`. The actions stay outside the scrolling body. Under reduced motion
959
+ the panel does not slide.
960
+
961
+ **A key figure.** Put a `<dl class="ui-drawer__figure">` in a first group with no heading. Its
962
+ `<dd>` holds a `.ui-drawer__figure-value` at 22px, with a status badge beside it.
963
+
964
+ **A table in a drawer.** It takes the 13px text of the drawer, a semibold head and no lines between
965
+ rows. Its first and last columns line up with the drawer text.
966
+
967
+ **Keyboard and screen reader.** A screen reader hears each label with its value. Escape that a
968
+ tooltip or a picker already used closes only that overlay. The next Escape closes the drawer.
969
+
970
+ ### Account window
971
+
972
+ Use `AccountWindow` for account and settings. Do not make account and settings a page of the
973
+ product: [Account and settings](../guidelines/account-and-settings.md).
974
+
975
+ ```tsx
976
+ <AccountWindow open={open} onClose={close} reader={{ name: 'Dana Reyes', email: 'dana@example.com' }}
977
+ sections={[{ id: 'profile', label: 'Profile', icon: 'user', content: <Profile /> }]} />
978
+ ```
979
+
980
+ You give the reader and the sections. The window draws the scrim, the close control, the section
981
+ title and the rail. `section` with `onSectionChange` controls the open section. `defaultSection`
982
+ leaves it to the window.
983
+
984
+ **What the user sees.** A window 1024px wide and 76% of the viewport high, with a rail of sections
985
+ and the reader at the top. The open section has the accent. When the section changes, the pane
986
+ mounts again, so a half-filled form does not follow the user. At 560px and below, the window
987
+ floats with a gap on each side and is as tall as its content. The sections become tabs under the
988
+ reader.
989
+
990
+ **Keyboard and screen reader.** Each rail row is a button with `aria-current`. On a phone the tabs
991
+ have one Tab stop, and the arrow keys, Home and End move between them.
992
+
993
+ ### Tooltip
994
+
995
+ Use `Tooltip` to show a word or a value when the user rests on or focuses a mark, such as the name
996
+ of an icon button or the value of a chart bar. Do not put a value only in a tooltip. When a value
997
+ may be in a readout: [Hover readouts](../guidelines/hover-readouts.md).
998
+
999
+ ```tsx
1000
+ <Tooltip control text="Download PDF"><Button variant="ghost" icon="download" iconOnly>Download PDF</Button></Tooltip>
1001
+ <Tooltip label="Revenue" value="€12,400" detail="August 2026"><span tabIndex={0}>€12.4k</span></Tooltip>
1002
+ ```
1003
+
1004
+ `label`, `value` and `detail` are the parts, and empty parts are hidden. `text` is a short form of
1005
+ `label`. `placement` is `top` or `bottom`. Use `control` when the child is one control that names
1006
+ itself: the readout then adds no Tab stop and no description.
1007
+
1008
+ **What the user sees.** A pointer that rests for 300ms opens the readout, and it closes at once when
1009
+ the pointer leaves. Within 300ms after one closes, the next opens at once. The readout is in the
1010
+ top layer, over a sticky cell. It stays inside the viewport and moves with a scroll or a resize. It
1011
+ never moves anything else on the page. On a touch screen, a tap opens the readout and does not
1012
+ also run the mark's action.
1013
+
1014
+ **Keyboard and screen reader.** Keyboard focus opens the readout at once, and the trigger gets it
1015
+ as its description. Escape closes only the readout and keeps the focus on the trigger. The next
1016
+ Escape reaches the dialog around it.
1017
+
1018
+ ### Feedback
1019
+
1020
+ Use `Feedback` to let a reader select a passage and send a note about it, such as on a report.
1021
+
1022
+ ```tsx
1023
+ <Feedback container={articleRef} onSend={sendFeedback} />
1024
+ ```
1025
+
1026
+ A "Give feedback" pill shows on a text selection in `container`. It opens a form with the quoted
1027
+ passage and a note. `onSend` files the note. A failed send keeps the note and shows the error. A
1028
+ sent note shows one line of thanks. Escape sends the focus back to the control before it.
1029
+
1030
+ ## Tables and figures
1031
+
1032
+ ### Data table
1033
+
1034
+ Use `DataTable` for rows of records that the user compares, sorts or selects. Use a
1035
+ [`KeyValueList`](#drawer) for the fields of one record. Do not lay a table out as cards on a phone.
1036
+ The table rules: [Dense tables](../guidelines/dense-tables.md).
1037
+
1038
+ ```tsx
1039
+ <DataTable caption="Invoices" scrollLabel="Invoices" selectable={false} pinnedIdentity
1040
+ columns={[{ key: 'name', label: 'Customer', cell: 'title', sortable: true },
1041
+ { key: 'amount', label: 'Amount', num: true, width: '12ch' }]}
1042
+ rows={invoices} />
1043
+ ```
1044
+
1045
+ Each row needs a `name`, which is also the key of a selection. A column has `key` and `label`, and
1046
+ can have `num`, `sortable`, `render`, `cell`, `width`, `linked` and `rowHeader`. A `label` can hold
1047
+ React content, such as a [`Tooltip`](#tooltip). `empty` is the text of a table with no rows, "No
1048
+ rows" by default. `DataTable` takes no `className`. `stack` is deprecated and does nothing: a table
1049
+ scrolls sideways on a phone.
1050
+
1051
+ **Columns.** `cell` is `title`, `code`, `long`, `strong` or `act`. A `title` column takes the free
1052
+ width and is never narrower than 20 characters. A `width` such as `'12ch'` holds while the rows
1053
+ reload or are empty, so the columns do not move when data arrives. Set the narrow columns and leave
1054
+ the title column unset. `rowHeader` draws the body cells as `th scope="row"`. `linked` marks a
1055
+ column whose cells hold one link and nothing else: the link then fills the cell and its ring is the
1056
+ cell.
1057
+
1058
+ **Look.** `zebra`, `hover` (on by default) and `density` (`dense`, `compact` or `comfortable`)
1059
+ choose the look. A hover table that is not zebra or dense is a row table: rows 48px tall, 36px with
1060
+ `compact` and 56px with `comfortable`, with no lines between rows. Every cell aligns its content to
1061
+ the top, so other values stay level with the first line of a cell that wraps. A badge in a cell is
1062
+ 19px high and never makes its row taller. `rowState` marks a row `target` or `dead`. A dead row is
1063
+ muted, so put the word that names its state in one of its cells. `footer` takes totals rows. `caption` names the table for
1064
+ assistive technology.
1065
+
1066
+ **Status words.** Use a badge for the status of the record. For a second status in the same row,
1067
+ use an ink word: `.ui-status--success`, `--danger`, `--warn`, `--info` or `--neutral`. Each is at
1068
+ least 4.5:1 on a plain or a selected row.
1069
+
1070
+ **Scrolling.** With `stickyHeader` or `pinnedIdentity`, the table stands in a named scroll region.
1071
+ `pinnedIdentity` pins the first column, or the column whose key you give. A table wider than its
1072
+ frame scrolls sideways, and the page does not. The pinned column draws its divider only when the
1073
+ region can scroll. Below 720px a pinned cell keeps one line and is cut at
1074
+ `--ui-table-identity-max`. Lower that cap for a table with a selection column. Below 560px the
1075
+ frame has no scrollbar. `scrollLabel` names the region, `Table` by default. Use the subject of the table, such as
1076
+ `Invoices`, and name the gesture only when the columns overflow at every width.
1077
+
1078
+ **Sorting and paging.** A table either controls its sort with `sort` and `onSortChange`, or leaves
1079
+ the sort to the table, and keeps that mode while it is on the page. The default sort is the first
1080
+ sortable column, descending. Equal values keep your order, and your array is never reordered. A
1081
+ controlled pager (`page`, `onPageChange`, `total` or `hasMore`) shows all the rows that you give. A
1082
+ sortable header label is cut with an ellipsis before its sort mark is.
1083
+
1084
+ **Selection.** Pass `selected`, `onToggle` and `onTogglePage`, or `selectable={false}`. The
1085
+ selection boxes are kit checkboxes. The header box shows the dash when some rows of the page are
1086
+ selected. A dense table marks a selected row only with its box.
1087
+
1088
+ **Links in cells.** A link in a cell uses the row's ink, gets an underline on hover and the ring on
1089
+ focus. A `.ui-table__sub` puts a second value under the first, such as an email under a name.
1090
+ `.ui-table__pair` groups a reference and a status, and stacks them when the cell is narrow.
1091
+
1092
+ **Keyboard and screen reader.** The scroll region takes the focus and draws the ring inside its
1093
+ edge, so the arrow keys, a trackpad and a finger reach the same columns.
1094
+
1095
+ **In a card.** The table reaches the card's edges, and its end cells keep the card's text edge.
1096
+ `.ui-card--fit` makes the card end at the table's content.
1097
+
1098
+ ### Pagination
1099
+
1100
+ Use `Pagination` under a table or a list that is too long for one page. `DataTable` draws one for
1101
+ you when you give it a page.
1102
+
1103
+ ```tsx
1104
+ <Pagination page={page} pageSize={50} total={total} onPageChange={setPage} onPageSizeChange={setSize} />
1105
+ ```
1106
+
1107
+ **What the user sees.** The pager shows a page that you already have. When you do not know the
1108
+ total, pass `total={null}` and `hasMore`. The pager then offers the step before and the step after
1109
+ and does not show a page count. A control that would leave the result is disabled and stays in its
1110
+ place. One page of content gets no steps. `pageSizes` chooses the sizes from the kit's scale.
1111
+ `loading` keeps the numbers readable, marks the pager busy and stops input. `variant` is `steps`,
1112
+ `numbered` or `jump`.
1113
+
1114
+ **Keyboard and screen reader.** The row range is announced politely, as one message. It is the only
1115
+ part of the pager that announces.
1116
+
1117
+ ### Stat bands
1118
+
1119
+ Use `StatBand` for a row of key figures above a report, such as revenue and its change. Put the
1120
+ totals of a list in the table's footer rows, not in a stat band.
1121
+
1122
+ ```tsx
1123
+ <StatBand basis="vs. July" stats={[
1124
+ { label: 'Revenue', value: '€124,800', delta: { value: '+8.2%', tone: 'good' } },
1125
+ { label: 'Open invoices', value: '42' }]} />
1126
+ ```
1127
+
1128
+ `variant` is `tiles`, the default, with each figure on its own card, `band` on one card, or `open`
1129
+ with no surface and a larger value. A figure has `label`, `value`, `caption`, `delta` and `trend`.
1130
+
1131
+ **What the user sees.** A value never wraps and is never cut. The words under it give way first. A
1132
+ change shows an arrow from the sign that you print, and its colour follows your `tone` only. A
1133
+ figure with nothing to compare shows no change row, never `+0%`. A figure shows at most one line
1134
+ under its value. Use a caption only for a unit, a period or a limit that the figure cannot say.
1135
+ `trend` is a slot for a small chart, such as a `Chart variant="spark"`.
1136
+
1137
+ **Say what a change compares with.** Put it once for the band in `basis`, or with `basisId` point
1138
+ at text before the figures. A caption comes before the figures. A hover `title` does not count.
1139
+ When a period control already states the window, do not repeat it.
1140
+
1141
+ **Room on the screen.** A band folds by its own width, not the window's, so give it a width in a
1142
+ flex row or an `auto` grid track:
1143
+
1144
+ | Layout | Four fold two by two at | An odd count stacks at | One column at | Smaller value below |
1145
+ |---|---|---|---|---|
1146
+ | Band and tiles | 56rem | 42rem | 28rem | 14rem |
1147
+ | Open | 66rem | 50rem | 32rem | 15rem |
1148
+
1149
+ **Keyboard and screen reader.** The band is a description list, so a screen reader reads each
1150
+ figure as one statement.
1151
+
1152
+ ### Chart
1153
+
1154
+ Use `Chart` to show numbers over periods or the parts of a whole. Use a [stat band](#stat-bands)
1155
+ for one figure, and a [table](#data-table) when the user must read exact values side by side.
1156
+
1157
+ ```tsx
1158
+ <Chart variant="line" title="Revenue" format={eur} formatAxis={eurShort}
1159
+ periods={[{ label: 'June 2026', short: 'Jun' }, { label: 'July 2026', short: 'Jul' }]}
1160
+ series={[{ id: 'rev', name: 'Revenue', values: [118400, 124800] }]} />
1161
+ ```
1162
+
1163
+ `title` names the plot, the table and the switch, and is not drawn, because the card around the
1164
+ chart has the title. `format` prints exact values in the readout, the live region and the table.
1165
+ `formatAxis` prints the axis ticks, which are whole units.
1166
+
1167
+ **Variants.**
1168
+
1169
+ | `variant` | Data | `look` values | Default look |
1170
+ | --- | --- | --- | --- |
1171
+ | `months` | `periods`, `series` | none: bars per period with a line across them | |
1172
+ | `bridge` | `steps` | none: one period from a start total to a result | |
1173
+ | `spark` | `periods`, `series` | none: one series at text size, for a stat band `trend` | |
1174
+ | `line` | `periods`, `series` | `thin`; `points`, a point on each value; `labels`, the last value at the line's end, and a chart that scrolls opens on its latest period | `thin` |
1175
+ | `area` | `periods`, `series` | `flat`, each series from zero; `curves`, each series from zero as a smooth curve with a point on each value; `stacked`; `share`, each column is 100% | `stacked` |
1176
+ | `stacked` | `periods`, `series` | `columns`; `share`, each column is 100%; `rows`, a bar for each period | `columns` |
1177
+ | `donut` | `slices` | `thin`, the total in the centre; `table`, a list of the shares beside the ring; `labels`, the name, value and share at each slice | `table` |
1178
+
1179
+ `area`, `stacked` and `donut` take only values of 0 or more. A negative value throws a `RangeError`.
1180
+ A stacked look reads a missing value as zero. The readout of a stacked or a share look lists each
1181
+ series of the column and the total, and the table adds a `Total` column. A share look shows the
1182
+ parts as percentages, and its table keeps your values. Use `curves` for two or three series that
1183
+ the user compares by shape, not by total. A donut slice says its value and its share of the whole.
1184
+ `totalLabel` names the whole, `Total` by default. A donut has no `selectable`.
1185
+
1186
+ **Series.** A series is `{ id, name, values }`, with an optional `tone`. In `months`, its `shape`
1187
+ is `bars`, `bars-below` or `line`. `bars` stand on the zero line. `bars-below` takes positive
1188
+ values and hangs them under the line.
1189
+
1190
+ **Tones.** A series without `tone` takes the next of `accent`, `accent-soft`, `info`, `warn`,
1191
+ `good`, `bad` and `neutral`. The product accent does not change them. Each full tone is at least
1192
+ 3:1 on the card and the page in both themes.
1193
+
1194
+ **What the user sees.** A bar is never wider than a mark, so a wider card adds space between
1195
+ columns. `legend` shows the legend. A period with `estimated` keeps its fill with a dashed edge, and
1196
+ the readout and the table show its `note`. A switch at the top right shows the same numbers as a
1197
+ chart or as a table. In a titled `Card`, the switch stands in the card's title row. `table={false}`
1198
+ removes the switch and the table. `selectable` with `selected` and `onSelect` lets the user pick a
1199
+ column, which gets a band behind it. At phone widths the plot scrolls and the value axis stays.
1200
+
1201
+ **Keyboard and screen reader.** The switch is the first Tab stop and the chart is the second. Left,
1202
+ Right, Home and End move between columns and announce each one. Enter picks a column when
1203
+ `selectable` is set. A plot that scrolls adds one more Tab stop for the scroll box. On a touch
1204
+ screen, the first tap on a mark opens its readout and does not call `onSelect`. Every value is
1205
+ reachable at full strength by pointer or keyboard.
1206
+
1207
+ ### Table values
1208
+
1209
+ Use `NumericValue` and `DeltaValue` for a number and a change in a table cell. Use `RowIdentity` for
1210
+ a company cell with a logo.
1211
+
1212
+ ```tsx
1213
+ <NumericValue value={1250.5} unit="EUR" missing="No amount" />
1214
+ <DeltaValue value="-3.1%" tone="danger" basisId="basis" />
1215
+ <RowIdentity symbol="NWD" name="Northwind" logo={logoUrl} href="/companies/nwd" />
1216
+ ```
1217
+
1218
+ `NumericValue` tells a missing value from zero. `DeltaValue` prints your sign and uses your `tone`.
1219
+ The colour never supplies the sign. `RowIdentity` shows the first letter of `symbol` when the logo
1220
+ does not load. `formatNumericValue` and `formatDeltaValue` from the root entry give the same result
1221
+ as plain text.
1222
+
1223
+ ## Shared helpers
1224
+
1225
+ The root entry `@apliteni/apliteni-ui` publishes the helpers that the React components use. Use
1226
+ them for markup that you write yourself, or on a server that must give the same result.
1227
+
1228
+ | Name | Use |
1229
+ |------|-----|
1230
+ | `esc(s)` | Escape a text value for HTML that you write yourself. |
1231
+ | `safeUrl(url, fallback?)` | Make an address safe. A `javascript:`, `data:` or `vbscript:` address becomes the fallback, `#` by default. |
1232
+ | `icon(name, cls)`, `illo(name)`, `iconNames`, `illoNames`, `iconCategories` | Line glyphs and illustrations as SVG strings. `sun` and `moon` are also exported. |
1233
+ | `iconOnlyAllowed`, `iconOnlyNames`, `iconMeanings` | The icon rules as data: which glyphs may stand without a word, and the words that each one may mean. |
1234
+ | `seedling`, `prism`, `brand` | The brand mark. |
1235
+ | `ACCENTS`, `accentSwatchStyle(accent)` | The accent names, and the `--swatch` property of a swatch button. |
1236
+ | `ACCOUNT_NAV` | The kit's default account navigation. |
1237
+ | `AVATAR_HUES`, `avatarHue(key)`, `avatarInitials(name)` | The avatar hue and initials, for a mark that you draw yourself. |
1238
+ | `calloutIcons` | The default glyph of each callout tone. |
1239
+ | `hlCode`, `hlShell`, `codeTokens`, `codeLanguages` | Code highlighting. See [Snippet](#snippet). |
1240
+ | `rankGroups`, `rankCommands`, `scoreCommand`, `SCORE`, `paletteHotkey()` | The command palette ranking, for a server that sorts the same way. |
1241
+ | `dropdownMatch`, `dropdownFiltering` | The dropdown search match. |
1242
+ | `dropdownAvail` | The room that a dropdown panel has below or above its trigger. |
1243
+ | `filterChipText`, `filterChipName`, `filterChipUnset`, `filterChipItems`, `nextFocusStop`, `focusNextStop` | The filter bar logic, for a filter bar that you draw yourself. |
1244
+ | `dropdownViewportFit`, `dropdownHeightFit`, `dropdownLift`, `dropdownReveal`, `dropdownRest`, `dropdownSnap`, `filterPanelFit`, `filterPanelRow`, `DD_MENU_FLOOR` | The dropdown placement, for a second dropdown that must place its panel as the kit does. |
1245
+ | `observeNavFit(row)`, `revealCurrentNav(row)`, `revealFocusedNav(row, target)` | The route tab sizing and scrolling, for a tab row that you draw yourself. |
1246
+ | `chartScale`, `bridgeWalk`, `pointTarget`, `CHART_FLOOR` | The chart arithmetic, with no DOM. |
1247
+ | `formatNumericValue`, `formatDeltaValue` | Table values as plain text. |
1248
+ | `PAGE_SIZES`, `DEFAULT_PAGE_SIZE`, `segmentedNextIndex`, `nearestSection`, `themeIcon` | Small shared values and helpers. |
1249
+ | `prefersReducedMotion()`, `staggerDelay`, `initReveal`, `replay`, `playEntrance`, `transitionMs(el)`, `ENTRANCE_FALLBACK_MS` | The motion helpers. See [Motion](foundations.md#motion). |
1250
+
1251
+ The public surface is the set of names that the root entry exports. Other modules ship in the
1252
+ package, but you cannot import them.
1253
+
1254
+ ### Escaping and URLs
1255
+
1256
+ `Footer`, `NavTabs`, `TopBar` and `Card` send each address through `safeUrl`. `BackLink` draws
1257
+ nothing for an address that starts with `javascript:`. The other components, such as `AppShell`,
1258
+ `SidebarNav`, `Dropdown`, `Button`, `RowIdentity` and `Avatar`, write the address that you give.
1259
+ Check an address that comes from a user before you pass it to one of them.
1260
+
1261
+ `safeUrl` replaces an address that starts with `javascript:`, `data:` or `vbscript:`, in any case,
1262
+ with the fallback. Before it reads the scheme, it removes tabs and line breaks everywhere, and
1263
+ spaces and control characters at the start. Other schemes, relative paths and fragments stay as
1264
+ they are. Use `esc` and `safeUrl` when you write HTML yourself.
1265
+
1266
+ ## What the kit does not do
1267
+
1268
+ - **No build step.** As a result, the [breakpoints are literals](foundations.md#breakpoints).
1269
+ - **No density system.** `.ui-table--dense`, `.ui-table--compact`, `.ui-table--comfortable` and
1270
+ `.ui-cmdk--roomy` are the only density modifiers, and each belongs to one component.
1271
+ - **No container scale.** There is one `--container`.
1272
+ - **No second bar for the glyph of a control.** 1.5 CSS px is the line for every stroked mark.
1273
+ - **No spinner.** A skeleton shows the shape of the content that comes.
1274
+ - **No support for a vertical writing mode.**
1275
+
1276
+ ## Choices
1544
1277
 
1545
1278
  ### Segmented or tabs?
1546
1279
 
1547
- Ask what is behind the choice. If choosing an option reveals a different block of content, that
1548
- content is a panel. Use `tabs()`. It renders the panels and lets a screen reader announce
1549
- "tab, 1 of 3" truthfully. If choosing an option only narrows a list, flips a unit or sets a
1550
- preference, there is no panel. Use `segmented()`. It says "pressed" instead of "selected".
1551
- Both give a keyboard user one Tab stop. Both need a name, so pass `ariaLabel`.
1280
+ Ask what is behind the choice. If a choice shows a different block of content, that content is a
1281
+ panel. Use `Tabs`. It draws the panels, and a screen reader says "tab, 1 of 3". If a choice only
1282
+ narrows a list, flips a unit or sets a preference, there is no panel. Use `Segmented`. A screen
1283
+ reader says "pressed" for it. Both give one Tab stop, and both need a name in `label`.
1552
1284
 
1553
- ### successPanel or success?
1285
+ ### SuccessPanel or Success?
1554
1286
 
1555
- Ask how much of the screen the confirmation owns. After a form has been submitted, or inside a
1556
- card on a page where the reader stays, use `successPanel({ title, sub })`. When the confirmation
1557
- *is* the screen and the reader needs somewhere to go next, use `success()`. It chooses a layout,
1558
- carries follow-up buttons and can run a redirect countdown after you call `wireSuccess()` on the
1559
- mounted element. Restyling one does not move the other: `successPanel` is `.ui-success` and
1560
- `success` is `.ui-sx`. Both draw `successCheck()`.
1287
+ Ask how much of the screen the confirmation owns. After a form submit, or in a card on a page where
1288
+ the user stays, use `SuccessPanel` with `title` and `sub`. When the confirmation is the whole screen
1289
+ and the user needs somewhere to go next, use `Success`. It chooses a layout, holds the next-step
1290
+ buttons and can count down to a redirect. The two use different classes, so a style change to one
1291
+ does not change the other.
1561
1292
 
1562
1293
  ---
1563
1294
 
1564
- Install, usage and the publish flow are in the [top-level README](../README.md).
1295
+ Install, use and publish are in the [top-level README](../README.md).