@apliteni/apliteni-ui 0.179.0 → 0.179.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/components.md +1188 -1467
- package/docs/foundations.md +35 -45
- package/guidelines/INDEX.md +1 -1
- package/guidelines/the-page.md +5 -5
- package/package.json +1 -1
- package/react/README.md +2 -2
- package/react/dist/index.d.ts +2 -2
- package/src/html.js +1 -1
- package/src/index.d.ts +6 -6
- package/src/logic/accents.js +1 -1
- package/src/logic/account-nav.js +1 -1
- package/src/logic/chart.js +1 -1
- package/src/logic/dropdown-placement.js +11 -11
- package/src/logic/filter-bar.js +4 -4
- package/src/styles/back.css +2 -2
- package/src/styles/button.css +2 -2
- package/src/styles/card.css +1 -1
- package/src/styles/chart.css +2 -2
- package/src/styles/command-palette.css +2 -2
- package/src/styles/drawer.css +2 -2
- package/src/styles/dropdown.css +27 -27
- package/src/styles/file-drop.css +1 -1
- package/src/styles/filter-bar.css +7 -7
- package/src/styles/input.css +1 -1
- package/src/styles/layout.css +28 -28
- package/src/styles/loading.css +1 -1
- package/src/styles/nav.css +4 -4
- package/src/styles/segmented.css +3 -3
- package/src/styles/table.css +3 -3
- package/src/styles/tooltip.css +1 -1
- package/src/styles/topbar.css +7 -7
- package/src/tokens/tokens.css +1 -1
package/docs/components.md
CHANGED
|
@@ -1,79 +1,71 @@
|
|
|
1
1
|
# Components (`@apliteni/apliteni-ui`)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
| `…/
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
##
|
|
43
|
+
## Themes and accents
|
|
52
44
|
|
|
53
|
-
|
|
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="
|
|
48
|
+
<html data-theme="light" data-accent="phoenix">
|
|
58
49
|
```
|
|
59
50
|
|
|
60
|
-
- **`data-theme`**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
66
|
-
`--font-sans` is for
|
|
67
|
-
|
|
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
|
-
`
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
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
|
-
##
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
what
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
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
|
-
|
|
542
|
-
|
|
543
|
-
|
|
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
|
-
|
|
596
|
-
|
|
597
|
-
The
|
|
598
|
-
|
|
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
|
-
|
|
222
|
+
**Keyboard and screen reader.** It is an `<a href>`. The arrow is hidden from screen readers.
|
|
658
223
|
|
|
659
|
-
|
|
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
|
-
|
|
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
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
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
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
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
|
-
|
|
685
|
-
|
|
686
|
-
|
|
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
|
-
<
|
|
258
|
+
<SidebarNav sections={[{ label: 'Billing', items: [{ id: 'inv', label: 'Invoices', href: '/invoices', badge: 4 }] }]}
|
|
259
|
+
active="inv" />
|
|
800
260
|
```
|
|
801
261
|
|
|
802
|
-
|
|
803
|
-
|
|
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
|
-
###
|
|
265
|
+
### Top bar
|
|
820
266
|
|
|
821
|
-
|
|
822
|
-
|
|
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
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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
|
-
|
|
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
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
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
|
-
|
|
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
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
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,663 +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
|
-
###
|
|
916
|
-
|
|
917
|
-
`
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
A
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
`
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
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 field 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**. **The sheet opens
|
|
1177
|
-
with the chosen period in view.** Its body scrolls the least distance that shows the chosen cell
|
|
1178
|
-
with 20px below it, and focus starts on that cell. With no chosen period, the sheet opens at the
|
|
1179
|
-
top. Nothing moves, because the body scrolls before the sheet slides in. When the web font
|
|
1180
|
-
arrives after the first open, the sheet measures again after the font loads and one frame, so the
|
|
1181
|
-
20px holds. It does not move the body after the reader scrolls, touches or types in the sheet. **Inside a `Field`,
|
|
1182
|
-
the sheet's title is the field's label**, because the sheet covers the field. An `ariaLabel` wins
|
|
1183
|
-
over the label, and outside a `Field` the placeholder is the title. The trigger's name is
|
|
1184
|
-
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**,
|
|
1185
|
-
below the field, or above it where there is more room, and scrolls inside itself when neither
|
|
1186
|
-
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
|
|
1187
|
-
the steps in [Breakpoints](foundations.md#breakpoints).
|
|
1188
|
-
|
|
1189
|
-
### React file drop
|
|
1190
|
-
|
|
1191
|
-
`FileDrop` is the compact drop: at rest, it shows one row with the button that opens the
|
|
1192
|
-
system picker. Beside the button, it shows the accepted types and size limit in your words.
|
|
1193
|
-
The field-sized dashed box remains with `FileField`. **You own the upload:** `FileDrop` sends
|
|
1194
|
-
a chosen or dropped file through `onFile` and renders the `file` you provide. **A file with no
|
|
1195
|
-
`status` is uploading**, so the kit never reports success unless you claim it. **A status the
|
|
1196
|
-
row draws includes a circled mark and a word**, because colour alone does not show status. When
|
|
1197
|
-
`progress` is provided, the track shows the status instead. `Remove` and `Retry` appear only
|
|
1198
|
-
when you provide `onRemove` and `onRetry`. **A file keeps the resting row's 32px height:** the
|
|
1199
|
-
name, the size, and the status or the track stand on one line, and `Remove` ends it. The track
|
|
1200
|
-
fills the free room on the line. The name gives way first: it truncates its stem but keeps its
|
|
1201
|
-
extension, and the full name is in a `title`. **One layout serves every width.** In a row of
|
|
1202
|
-
352px or less, the size leaves the line, and a screen reader still reads it. A refused file
|
|
1203
|
-
shows its reason on the name's line. When the full name and the reason do not fit there, the
|
|
1204
|
-
reason moves under the name and the row grows by one line, to 61px. In a parent that sizes to its
|
|
1205
|
-
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
|
|
1206
|
-
that region instead of joining it**, so the row stays in place while the reader aims. Children
|
|
1207
|
-
render above the row inside the same region. This lets one panel, or a whole page, become the
|
|
1208
|
-
target. A disabled drop never calls `preventDefault` on `dragover`, so it does not declare
|
|
1209
|
-
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:
|
|
1210
575
|
[File drop](../guidelines/file-drop.md).
|
|
1211
576
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
`multiple` to let the picker take several. A file over the box turns its edge to the accent. A
|
|
1217
|
-
disabled area accepts nothing.
|
|
1218
|
-
|
|
1219
|
-
`.ui-drop--page` is the kit's layer for a page that takes a file anywhere. Put it on the area's own
|
|
1220
|
-
markup, `.ui-drop.ui-drop--area.is-dragging`, and it becomes that area made large: a fixed box
|
|
1221
|
-
inset from the window and below the topbar, with the same dashed accent edge and radius, holding an
|
|
1222
|
-
`EmptyState` with the upload glyph, a line that says to drop the files and the accepted types.
|
|
1223
|
-
**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
|
|
1224
|
-
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
|
|
1225
|
-
second path. The page owns the drag logic, and its own Upload button stays the keyboard path.
|
|
1226
|
-
React ships no component for the layer.
|
|
1227
|
-
|
|
1228
|
-
### React Button links and leading artwork
|
|
1229
|
-
|
|
1230
|
-
React `Button` accepts `href` and then renders an anchor with the existing button classes.
|
|
1231
|
-
Without `href`, it renders a native button defaulting to `type="button"`. Refs and native
|
|
1232
|
-
attributes belong to whichever element it renders. `leading` accepts decorative content before
|
|
1233
|
-
the label wrapper and takes precedence over `icon`. For an icon-only control, the component
|
|
1234
|
-
copies string children, then the icon name, into `aria-label` and `title`. **With neither, it
|
|
1235
|
-
stays nameless instead of receiving an invented name.** `className` merges with the kit's
|
|
1236
|
-
classes. **The component's state wins over your spread props** — `aria-disabled`, `aria-busy`,
|
|
1237
|
-
the `data-btn-*` hooks, a link's `role`, and the `href` and `tabIndex` that a disabled or busy
|
|
1238
|
-
control removes. This prevents a caller from leaving a busy or disabled control looking idle.
|
|
1239
|
-
**Space is blocked on button roots only**, because it never activates an anchor. A busy link
|
|
1240
|
-
that swallowed Space would also prevent the reader from scrolling the page.
|
|
1241
|
-
|
|
1242
|
-
### React charts
|
|
1243
|
-
|
|
1244
|
-
`Chart` draws seven shapes: `months`, a column per period with bars and a line across them;
|
|
1245
|
-
`bridge`, one period walked from a starting total to a result; `spark`, one series at text
|
|
1246
|
-
size with no axis, for a stat band's `trend` slot; and `line`, `area`, `stacked` and `donut`. The numbers, the wording and the formatting
|
|
1247
|
-
are yours — `format` prints exact values in the readout, the live region and the table, and
|
|
1248
|
-
`formatAxis` prints the ticks, which are whole units.
|
|
1249
|
-
|
|
1250
|
-
**`line`, `area` and `stacked` take `periods` and `series`, and `donut` takes `slices`.** A series
|
|
1251
|
-
or a slice has no `shape`. Each of the four variants takes `look`, which picks one drawing of
|
|
1252
|
-
the same numbers:
|
|
1253
|
-
|
|
1254
|
-
| `variant` | `look` values | Default |
|
|
1255
|
-
| --- | --- | --- |
|
|
1256
|
-
| `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` |
|
|
1257
|
-
| `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` |
|
|
1258
|
-
| `stacked` | `columns`, `share` (each column is 100%), `rows` (a bar for each period) | `columns` |
|
|
1259
|
-
| `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` |
|
|
1260
|
-
|
|
1261
|
-
A series or a slice without a `tone` takes the next tone of `accent`, `accent-soft`, `info`,
|
|
1262
|
-
`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
|
|
1263
|
-
a stacked or a share look lists each series of the column and the total, and the table adds a
|
|
1264
|
-
`Total` column. A share look gives the parts as percentages, and its table keeps your values.
|
|
1265
|
-
The arrow keys step through the periods, the rows or the slices. A donut slice says its value
|
|
1266
|
-
and its share of the whole. `totalLabel` names the whole, and it defaults to `Total`. A donut has
|
|
1267
|
-
no `selectable`.
|
|
1268
|
-
|
|
1269
|
-
**A mark is capped, whatever its column is worth.** A bar never passes a mark's width, so a chart
|
|
1270
|
-
that grows with the card gains ground between its columns rather than twelve wider blocks. Two bar
|
|
1271
|
-
series on the same side of the zero line stand side by side with ground between them; a
|
|
1272
|
-
`bars-below` series takes positive magnitudes and hangs under the line instead. A bar is
|
|
1273
|
-
rounded only at the end away from zero, and its foot stands square on the rule it is measured
|
|
1274
|
-
from. A bridge carries each step's running total across to the step beside it.
|
|
1275
|
-
|
|
1276
|
-
**A series takes one of seven fixed tones, and the product accent does not change them.** The
|
|
1277
|
-
tones are `accent`, `accent-soft`, `good`, `bad`, `warn`, `info` and `neutral`, with a light and a
|
|
1278
|
-
dark step for each theme. A bar fades from a light tint of its tone at its base on the zero line
|
|
1279
|
-
to the full tone at its data end, and a bar under zero fades the other way. The fill is opaque.
|
|
1280
|
-
The full tone clears 3:1 on the card and on the page in both themes. The tint is below 3:1 by
|
|
1281
|
-
design, because the data end, the zero line and the base carry the value. A bridge bar fades from
|
|
1282
|
-
the previous running total to the full tone at the new one, so a fall fades downwards. Lines,
|
|
1283
|
-
points and legend keys stay solid in the full tone. **An area ramps with its values:** the tint
|
|
1284
|
-
is at the series' lowest top and the full tone at its highest, in every column. An area with one
|
|
1285
|
-
value, a share band, a stacked part and a donut slice have no ramp. A `curves` area has a wash
|
|
1286
|
-
instead: its tone fades to clear at zero, under each series in the order you give them. Its curve
|
|
1287
|
-
never passes the values on each side of it and never goes under zero. Use `curves` for two or
|
|
1288
|
-
three series that the reader compares by shape, not by total.
|
|
1289
|
-
|
|
1290
|
-
**The legend shows only when you pass `legend`.** **An unfinished period keeps its series fill
|
|
1291
|
-
with a dashed edge.** The legend names the estimated state. The readout and the table show the
|
|
1292
|
-
state and its `note`.
|
|
1293
|
-
|
|
1294
|
-
**The value axis, the period row and the legend are quiet, and nothing is only there.** Every
|
|
1295
|
-
data value is reachable at full strength through pointer readouts and keyboard announcements.
|
|
1296
|
-
|
|
1297
|
-
**A switch in the top right corner shows the same numbers as a chart or as a table.** It is a
|
|
1298
|
-
toolbar of two glyph buttons named Chart and Table, with the pressed one marked. The chart shows
|
|
1299
|
-
first. The table replaces the plot, and the switch keeps its place. In a titled `<Card>` the
|
|
1300
|
-
switch sits at the end of the card's title row instead, and the chart draws no row of its own for
|
|
1301
|
-
it. When a card holds two charts, the first one puts its switch there. When that chart leaves,
|
|
1302
|
-
the next one takes the place. Pass `table={false}` to drop the switch and the table.
|
|
1303
|
-
|
|
1304
|
-
**Selection is a band behind the column, and focus is the ring on the chart.** Picking a column
|
|
1305
|
-
paints the column's own ground and sets its label in the strong ink at a heavier weight; no mark
|
|
1306
|
-
changes colour, so each tone stays with the series it names. The switch is the first tab stop
|
|
1307
|
-
and the chart is the second: Left,
|
|
1308
|
-
Right, Home and End step columns and announce each one politely, Enter picks one when `selectable`
|
|
1309
|
-
is set, and `title` names the plot, the table and the switch without being drawn, because the card
|
|
1310
|
-
around a chart already carries its title. A plot that scrolls adds one more tab stop after the
|
|
1311
|
-
chart: the scrolling box, named after `title` and ringed by the kit.
|
|
1312
|
-
|
|
1313
|
-
**On a touch screen a tap opens the readout and a second tap on the same mark closes it. The tap
|
|
1314
|
-
that opens a readout does not call `onSelect`** — it is the reader asking what a mark is worth.
|
|
1315
|
-
The tap that closes one, and an ordinary mouse click, do, and the click itself is never swallowed,
|
|
1316
|
-
so your own listener around the chart still hears every tap. Below 560px, to a coarse pointer, a
|
|
1317
|
-
line's point grows to the room its column gives. It never crosses into a neighbour's column. A
|
|
1318
|
-
narrow sparkline can therefore own less than 44px across, but it still owns at least 24px
|
|
1319
|
-
across and the full 44px down. A sparkline's slot grows with that vertical target, so a
|
|
1320
|
-
`trend` slot is 44px tall there instead of 32.
|
|
1321
|
-
|
|
1322
|
-
The table carries its columns sideways in a named scroller, so your card and your page keep their
|
|
1323
|
-
width whatever series you pass. At phone widths the plot scrolls with the value axis held in
|
|
1324
|
-
place, and a column cut by the edge shows that more periods are there. While the plot scrolls,
|
|
1325
|
-
the keyboard can scroll it from its own tab stop after the chart. Nothing animates.
|
|
1326
|
-
|
|
1327
|
-
### React route navigation
|
|
1328
|
-
|
|
1329
|
-
`NavTabs` uses the same presentation as the vanilla factory, so every
|
|
1330
|
-
guarantee above holds for it too. `NavTabs` takes unique item IDs, a controlled active ID, the
|
|
1331
|
-
underline or pill presentation, and optional badges. It uses native links and
|
|
1332
|
-
`aria-current="page"`, with no tablist or panel roles. **A disabled item is non-focusable text**
|
|
1333
|
-
marked `aria-disabled`, and cannot be the current link. An item with no destination uses its ID as
|
|
1334
|
-
a fragment. A badge of zero stays visible; a null or empty badge is dropped, the way the vanilla
|
|
1335
|
-
factory drops it.
|
|
1336
|
-
|
|
1337
|
-
It forwards root attributes and refs, keeps native link keyboard behaviour, and sends every
|
|
1338
|
-
destination through the kit's URL boundary.
|
|
1339
|
-
|
|
1340
|
-
**It takes `renderLink` with the signature `AppShell` uses**, so a router renders each link from
|
|
1341
|
-
the kit's class, destination, current state and children, and a route change need not reload the
|
|
1342
|
-
document.
|
|
1343
|
-
|
|
1344
|
-
`NavTabs` sizes its row on mount, on a route change and on window resize, preserving the reader's
|
|
1345
|
-
scroll position during content and container changes. It reveals the current route after mount and
|
|
1346
|
-
route changes, and reveals a link a focus event lands on. There is nothing to wire for it;
|
|
1347
|
-
`wireNav()` is for the vanilla rows. React imports the kit's own `safeUrl` and reveal functions
|
|
1348
|
-
rather than a copy bundled into `react/dist`.
|
|
1349
|
-
|
|
1350
|
-
### React top bar
|
|
1351
|
-
|
|
1352
|
-
`TopBar` composes `ViewSwitch`, `VersionSwitcher`, `ThemeToggle` and `AccountMenu` into the vanilla
|
|
1353
|
-
`topbar()` band, with the same classes and the same two rows on a phone. Each slot is optional, and
|
|
1354
|
-
no account is the signed-out bar. **The current view in the Deck and Text switch is filled with the
|
|
1355
|
-
accent fill of a chosen Segmented option**, in the vanilla switch as well as React's. **The version
|
|
1356
|
-
button shows only the chosen name**. **The open version menu shows each name and badge and ticks the chosen version**.
|
|
1357
|
-
The button and tick follow `value` until the caller updates it. `AccountMenu` marks the page named by `current` in accent ink.
|
|
1358
|
-
|
|
1359
|
-
### The rest of the React surface
|
|
1360
|
-
|
|
1361
|
-
- **`Tabs`** unmounts inactive panel content. Arrow keys, Home and End move between tabs and
|
|
1362
|
-
activate them.
|
|
1363
|
-
- **`Segmented`** is a controlled choice toolbar: one named toolbar, pressed buttons and **one
|
|
1364
|
-
Tab stop whatever the choice is.** Arrow keys wrap past disabled options; Home and End reach
|
|
1365
|
-
the first and last enabled choice. `block` fills the container with either appearance. An
|
|
1366
|
-
option's `icon` names a kit glyph drawn before its label. With `iconOnly`, the glyph is the
|
|
1367
|
-
whole button and the label becomes its accessible name and its hover title.
|
|
1368
|
-
**`size="sm"` compacts the pill appearance only:** under the underline appearance it changes
|
|
1369
|
-
the type size and leaves the tab at its full height.
|
|
1370
|
-
- **`Confirm`** builds on `Modal` as an `alertdialog`. It focuses the safe action and draws it
|
|
1371
|
-
before the committing action. `onConfirm` only reports the press. Saving, errors and closing
|
|
1372
|
-
are yours.
|
|
1373
|
-
- **`Feedback`** offers a "Give feedback" pill on a text selection and opens a form with the
|
|
1374
|
-
quoted passage and a note. `onSend` files the note. A failed send keeps the note and shows the
|
|
1375
|
-
error in place. A sent note shows one line of thanks. Escape returns focus to the prior visible
|
|
1376
|
-
control, or to the pill if that control is unavailable.
|
|
1377
|
-
- **`Timeline`** renders your events from oldest to newest. **Only the last event's marker is
|
|
1378
|
-
filled.** A new ID in a non-empty history plays an entrance. Editing existing IDs does not.
|
|
1379
|
-
- **`AppShell`** shares the vanilla fold cookie and 720px fold. `layout="rail"` places the
|
|
1380
|
-
account at the rail foot and leaves only Sign out in its menu. It shows no section counts.
|
|
1381
|
-
Pass `back` to show the way up from a subpage, above the page title.
|
|
1382
|
-
**`tools` puts small tools for the whole page at the end of the title row** (#736), such as
|
|
1383
|
-
a version badge, a period picker or a `size="sm"` button. The lede stands under the whole row.
|
|
1384
|
-
**Tools that do not fit beside the title go under it**, so a period picker and a view action
|
|
1385
|
-
can stay on a 390px phone. `actions` keeps
|
|
1386
|
-
the page's buttons in their own row under the title.
|
|
1387
|
-
**`accountItems` adds a product's rows, such as Account settings and Support, at the top of
|
|
1388
|
-
every account menu,** above the Theme row and Sign out. A row takes `href` to go somewhere,
|
|
1389
|
-
or `onSelect` to open something in place.
|
|
1390
|
-
The existing band layout stays the default. The longest matching section
|
|
1391
|
-
path wins. **At 720px and below, a menu button and the brand mark on the band replace the
|
|
1392
|
-
rail:** the button opens the full section list in a drawer, and the page takes the full
|
|
1393
|
-
width. **The drawer opens from the side of its menu button:** the right in the topbar
|
|
1394
|
-
layout, where the button ends the band, and the left in the rail layout. Set `drawerSide`
|
|
1395
|
-
to `'left'` or `'right'` to choose the side in either layout (#790,
|
|
1396
|
-
`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
|
|
1397
|
-
the button. **A shell whose list has nowhere to go — one section and no back
|
|
1398
|
-
link — draws no rail, no fold control and no menu button;** the brand lockup moves to the band
|
|
1399
|
-
and the section stays in the command palette. One section under a child page is a destination,
|
|
1400
|
-
the page's parent, so that list is drawn and the row takes `aria-current="true"`.
|
|
1401
|
-
`searchLabel` names the band trigger's words. `searchShortLabel` is deprecated and not drawn.
|
|
1402
|
-
**`onNavigate` hands the built-in palette's same-tab picks to a client router,** so the page
|
|
1403
|
-
changes without a reload. An app's own `palette` wins: its `onNavigate` is used when it sets one.
|
|
1404
|
-
**With a sidebar, the account and `bandControl` stand in the sidebar, not on the band, and the
|
|
1405
|
-
theme is a row of the account menu** (#732). The rail keeps the fold's control
|
|
1406
|
-
in its head, `bandControl` under the head, then the sections and the account at its foot. A
|
|
1407
|
-
folded rail keeps the account mark, and makes `bandControl` inert. The drawer puts
|
|
1408
|
-
`bandControl` above the sections, and the account in its footer (`react/src/AppShell.tsx:233` `{accountBlock(true, true)}`).
|
|
1409
|
-
**`headControl` is one glyph control in the sidebar head, before the fold button** (#732). It
|
|
1410
|
-
is drawn as the fold is: a plain glyph with no border and no fill, the fold's size, ink and
|
|
1411
|
-
hover (`react/src/AppShell.css:56` `.ui-react-app__head-control > :is(button, a)`). A folded
|
|
1412
|
-
rail moves it out of the head row onto the glyph column, one rail gap under the head, and it
|
|
1413
|
-
stays usable. The drawer puts it in the panel's head, before the close button, as a 40px tap
|
|
1414
|
-
target (`react/src/AppShell.tsx:233` `headerActions={headSlot}`). `Drawer` takes
|
|
1415
|
-
`headerActions` for controls between its title and its close button. A shell with no sidebar
|
|
1416
|
-
puts `headControl` on the band after `bandControl`.
|
|
1417
|
-
**The Theme row opens a submenu of Auto, Light and Dark** (#736). The row shows the current
|
|
1418
|
-
choice, and a check marks it in the submenu. Right or Enter opens the submenu, Left or Escape
|
|
1419
|
-
closes it, and focus returns to the Theme row. A pick sets the theme and closes only the
|
|
1420
|
-
submenu. In the sidebar the submenu flies out beside the menu, past the sidebar's edge. In the
|
|
1421
|
-
drawer it replaces the menu's rows, under a Theme back row
|
|
1422
|
-
(`react/src/AccountMenu.tsx:18` `function AccountMenu`). A separator stands before Sign out. In the drawer a `.toggle` in
|
|
1423
|
-
`bandControl` and each account menu row are 40px tap targets, and focus starts on the first row.
|
|
1424
|
-
**Above 720px the band's search field stands in its centre** (`react/src/AppShell.css:93` `@media (min-width: 721px)`).
|
|
1425
|
-
**At 720px and below the band holds the mark, the page title on one line, search and Menu at
|
|
1426
|
-
the end, and nothing else.** The title ends in an ellipsis when it is long, and is hidden from
|
|
1427
|
-
screen readers, because the page's `h1` keeps its name (`react/src/AppShell.css:101` `.ui-react-app__title {`). **Below
|
|
1428
|
-
560px each band control is a bare 40px glyph with no border and no box**, so the band fits
|
|
1429
|
-
300px. The search trigger shows only its glyph there, an exception in
|
|
1430
|
-
`guidelines/iconography.md` (#729). The shared stylesheet clips the sentence and the key cap
|
|
1431
|
-
rather than dropping them, so the button keeps one accessible name at every width. A shell
|
|
1432
|
-
without a sidebar keeps `bandControl`, the theme switch and the account on its band.
|
|
1433
|
-
**When it mounts, the theme switch applies the stored theme choice, or follows the system when
|
|
1434
|
-
there is none.**
|
|
1435
|
-
A page that sets its own `data-theme` must also set `data-theme-choice`, or store the choice,
|
|
1436
|
-
to keep that theme. For example, `<html data-theme="light">` on a dark system turns dark
|
|
1437
|
-
when the shell mounts.
|
|
1438
|
-
- **`SidebarNav`** accepts flat items or captioned sections, nested groups, counts and
|
|
1439
|
-
router-link rendering. **Nesting stops one level deep.** Each row keeps its name and count when
|
|
1440
|
-
collapsed.
|
|
1441
|
-
- **`Checkbox` and `Switch`** render native inputs inside the existing label classes, and **a
|
|
1442
|
-
disabled one uses the same paint as every other disabled control in the kit.** A resting box
|
|
1443
|
-
has a field's fill and an edge of at least 3:1 on the page, a card, a menu and a hovered row.
|
|
1444
|
-
It measures 5.36:1 or more in light and 5.38:1 or more in dark. **A checked or partial box is a
|
|
1445
|
-
light tint of the accent with an accent edge and an accent mark, not a solid accent block.** A
|
|
1446
|
-
checked radio uses the same paint. Under every accent, the edge measures 5.74:1 or more in light
|
|
1447
|
-
and 4.61:1 or more in dark on a card and on a selected or hovered selected row. The mark measures
|
|
1448
|
-
5.23:1 or more on the tint in light and 4.46:1 or more in dark.
|
|
1449
|
-
- **A checkbox whose `indeterminate` property is true shows the checked fill with a short dash**
|
|
1450
|
-
in place of the tick. **`DataTable`'s selection boxes use the kit box and show the dash when some,
|
|
1451
|
-
but not all, rows on the page are selected.** **A selection column takes the width of its box in
|
|
1452
|
-
every selectable table, and in a dense or compact table the box's phone tap area stays 24px tall so
|
|
1453
|
-
it never reaches the next row.**
|
|
1454
|
-
- **`Checkbox` takes an optional `hint`,** which sits under the label words and is linked to the box as
|
|
1455
|
-
its description; the label stays the box's name. **`CheckList` groups `Checkbox` children in a
|
|
1456
|
-
fieldset under a legend** set in the field label's type. A disabled box dims its hint with its label.
|
|
1457
|
-
- **`Snippet`** displays `code` as plain text, and **copying always writes the original `code`
|
|
1458
|
-
string**, whatever `children` displays. **`Snippet` is a block of code, not the only way to
|
|
1459
|
-
copy.** To copy an identifier where it stands, in a drawer row or a table cell, put an
|
|
1460
|
-
icon-only `Button` with the `copy` glyph beside it, such as
|
|
1461
|
-
`<Button variant="ghost" size="sm" icon="copy" iconOnly>Copy INV-1162</Button>`. Its words
|
|
1462
|
-
become its accessible name and its hover title. Swap the glyph to `check` for a moment after
|
|
1463
|
-
the copy, as `Snippet` does.
|
|
1464
|
-
- **`EmptyState`** uses the vanilla markup and CSS, and **the page supplies its own `h1`.**
|
|
1465
|
-
- **`ThemeToggle`** cycles through dark, light, auto, then dark. It stores explicit choices
|
|
1466
|
-
and follows the OS otherwise. It sets `data-theme-choice` and the resolved `data-theme` on
|
|
1467
|
-
`html` and exports `THEME_INIT_SCRIPT` for a head script.
|
|
1468
|
-
- **`Tooltip`** renders the vanilla host, panel and label classes. Escape keeps focus on the
|
|
1469
|
-
trigger. A hover opens it after 300ms and keyboard focus at once; see
|
|
1470
|
-
[The React tooltip](#the-react-tooltip).
|
|
1471
|
-
- **`Pill`** and **`StatusDot`** add no interactive role and create no live region. Visible
|
|
1472
|
-
status text belongs beside the dot.
|
|
1473
|
-
- **`SuccessPanel`** is the inline confirmation. **`SuccessCheck`** is the bare shared mark.
|
|
1474
|
-
- **Shared logic.** `dropdownMatch`, `dropdownFiltering`, `rankGroups`, `rankCommands`,
|
|
1475
|
-
`scoreCommand`, `paletteHotkey`, `segmentedNextIndex`, `PAGE_SIZES`, `DEFAULT_PAGE_SIZE`,
|
|
1476
|
-
`calloutIcons`, `chartScale`, `bridgeWalk`, `pointTarget` and `CHART_FLOOR` come from the main
|
|
1477
|
-
entry. So do `formatNumericValue` and
|
|
1478
|
-
`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
|
+
```
|
|
1479
581
|
|
|
1480
|
-
|
|
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.
|
|
1481
586
|
|
|
1482
|
-
|
|
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.
|
|
1483
595
|
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
`.ui-cmdk--roomy` are the only density modifiers, and each is local to its component.
|
|
1488
|
-
- **No container scale.** There is one `--container`, not a narrow/wide set.
|
|
1489
|
-
- **No second bar for a control's glyph.** 1.5 CSS px is the line for every stroked mark.
|
|
1490
|
-
- **No charts.** A stat band's trend is a slot for your `<svg>`.
|
|
1491
|
-
- **No hand-written markup contract, except a row the kit renders as a control** — a `<div>` with
|
|
1492
|
-
a role and a tabindex, or an `<a>`, which you must rewrite as a `<button>` when it needs to
|
|
1493
|
-
work from the keyboard. Those class names are a supported surface.
|
|
1494
|
-
- **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.
|
|
1495
599
|
|
|
1496
|
-
|
|
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.
|
|
1497
604
|
|
|
1498
|
-
###
|
|
605
|
+
### Segmented
|
|
1499
606
|
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
[
|
|
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).
|
|
1503
610
|
|
|
1504
|
-
```
|
|
1505
|
-
<
|
|
1506
|
-
|
|
1507
|
-
|
|
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} />
|
|
1508
748
|
```
|
|
1509
749
|
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
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
|
|
1554
1277
|
|
|
1555
1278
|
### Segmented or tabs?
|
|
1556
1279
|
|
|
1557
|
-
Ask what is behind the choice. If
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
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`.
|
|
1562
1284
|
|
|
1563
|
-
###
|
|
1285
|
+
### SuccessPanel or Success?
|
|
1564
1286
|
|
|
1565
|
-
Ask how much of the screen the confirmation owns. After a form
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
`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.
|
|
1571
1292
|
|
|
1572
1293
|
---
|
|
1573
1294
|
|
|
1574
|
-
Install,
|
|
1295
|
+
Install, use and publish are in the [top-level README](../README.md).
|