@tangible/ui 0.2.28 → 0.2.30
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/components/Accordion/Accordion.js +2 -1
- package/components/Avatar/Avatar.js +6 -2
- package/components/Button/types.d.ts +5 -5
- package/components/Chip/Chip.js +2 -1
- package/components/ChipGroup/ChipGroup.js +1 -1
- package/components/ChipGroup/types.d.ts +2 -1
- package/components/Chips/Chips.d.ts +2 -0
- package/components/Chips/Chips.js +2 -16
- package/components/ColorPicker/ColorField.d.ts +3 -3
- package/components/ColorPicker/ColorField.js +2 -1
- package/components/ColorPicker/ColorPicker.js +2 -1
- package/components/ColorPicker/usePointerDrag.d.ts +7 -0
- package/components/ColorPicker/usePointerDrag.js +15 -1
- package/components/Combobox/Combobox.js +3 -2
- package/components/ContentIndicator/types.d.ts +3 -3
- package/components/DatePicker/Calendar.js +4 -3
- package/components/DatePicker/DatePicker.js +3 -2
- package/components/DatePicker/PickerTrigger.js +2 -1
- package/components/DatePicker/types.d.ts +1 -1
- package/components/GradientPicker/GradientBar.js +3 -1
- package/components/GradientPicker/GradientPicker.js +4 -3
- package/components/Icon/Icon.d.ts +9 -2
- package/components/Icon/Icon.js +4 -3
- package/components/Icon/index.d.ts +1 -1
- package/components/IconButton/IconButton.js +13 -45
- package/components/IconButton/IconButtonCore.d.ts +9 -0
- package/components/IconButton/IconButtonCore.js +76 -0
- package/components/IconButton/types.d.ts +4 -3
- package/components/Modal/Modal.d.ts +12 -3
- package/components/Modal/Modal.js +38 -15
- package/components/MoveHandle/MoveHandle.js +3 -2
- package/components/MultiCombobox/MultiCombobox.js +3 -2
- package/components/MultiSelect/MultiSelect.js +3 -2
- package/components/NavMenu/NavMenu.js +2 -1
- package/components/NavMenu/types.d.ts +3 -3
- package/components/Notice/Notice.d.ts +7 -0
- package/components/Notice/Notice.js +6 -5
- package/components/Pager/Pager.js +5 -4
- package/components/Rating/Rating.js +2 -1
- package/components/SearchInput/SearchInput.js +3 -2
- package/components/SearchSelect/SearchSelect.js +3 -2
- package/components/SecretInput/SecretInput.js +3 -2
- package/components/Select/Select.js +3 -2
- package/components/Sidebar/Sidebar.js +2 -1
- package/components/StepIndicator/StepIndicator.js +4 -2
- package/components/StepIndicator/types.d.ts +2 -2
- package/components/StepList/types.d.ts +2 -2
- package/components/Tabs/types.d.ts +3 -3
- package/components/Toast/Toast.d.ts +5 -1
- package/components/Toast/Toast.js +3 -3
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +28 -6
- package/components/Tooltip/index.d.ts +1 -1
- package/components/Tooltip/types.d.ts +18 -0
- package/components/index.d.ts +2 -2
- package/figma-tokens.json +6 -4
- package/icons/cred/index.js +1 -0
- package/icons/icons.svg +7 -3
- package/icons/lms/index.d.ts +0 -3
- package/icons/lms/index.js +6 -33
- package/icons/manifest.json +71 -9
- package/icons/membersync/index.js +1 -0
- package/icons/player/index.js +1 -0
- package/icons/reaction/index.js +1 -0
- package/icons/registry.d.ts +14 -0
- package/icons/registry.js +7 -0
- package/icons/system/index.d.ts +11 -0
- package/icons/system/index.js +48 -0
- package/package.json +9 -2
- package/skills/building-with-tui/SKILL.md +249 -17
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +127 -13
- package/styles/all.expanded.unlayered.css +127 -13
- package/styles/all.unlayered.css +1 -1
- package/styles/app.css +41 -0
- package/styles/components/_bundle.scss +2 -0
- package/styles/components/button.scss +6 -1
- package/styles/components/card.scss +17 -1
- package/styles/components/chip-group.scss +45 -28
- package/styles/components/chips.scss +21 -0
- package/styles/components/color-picker.scss +15 -1
- package/styles/components/gradient-picker.scss +2 -2
- package/styles/components/modal.scss +61 -0
- package/styles/components/tooltip.scss +8 -1
- package/styles/core.css +1 -1
- package/styles/core.unlayered.css +1 -1
- package/styles/system/_text-styles.scss +4 -0
- package/styles/system/_tokens.scss +7 -2
- package/styles/utilities/_index.scss +3 -0
- package/tui-manifest.json +46 -19
- package/utils/focus-trap.d.ts +1 -24
- package/utils/focus-trap.js +2 -65
- package/utils/scroll-lock.d.ts +4 -0
- package/utils/scroll-lock.js +25 -0
- package/utils/tabbable.d.ts +29 -0
- package/utils/tabbable.js +74 -0
- package/vanilla/modal.d.ts +37 -0
- package/vanilla/modal.js +453 -0
- package/vanilla/modal.min.js +1 -0
- package/vanilla/styles.css +1 -0
- package/vanilla/styles.unlayered.css +1 -0
|
@@ -11,8 +11,10 @@ the repo's own CLAUDE.md and `.claude/agents/*`.)
|
|
|
11
11
|
The API is on disk and does not need guessing. What costs hours is the **wiring and the a11y
|
|
12
12
|
plumbing**, because both fail silently rather than erroring. That is most of what follows.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Inventory figures (component counts, manifest coverage, subpaths, icons, `data-testid` pass-through)
|
|
15
|
+
were re-measured against **0.2.28** (Oct 13 2026). Other sections were last verified against
|
|
16
|
+
**0.2.11 + main** (Aug 22 2026) unless a claim carries its own date. Re-check anything that reads as
|
|
17
|
+
surprising.
|
|
16
18
|
|
|
17
19
|
## The minimum that works
|
|
18
20
|
|
|
@@ -30,6 +32,10 @@ there is no CSS at all.
|
|
|
30
32
|
|
|
31
33
|
## Where the API lives
|
|
32
34
|
|
|
35
|
+
The docs are also fetchable as plain markdown, no JS needed: <https://storybook-tangible-ui.pages.dev/llms.txt> indexes
|
|
36
|
+
every guide and one page per component (props, defaults, API tokens); `llms-full.txt` is all of it in one file. Prefer it over
|
|
37
|
+
the Storybook UI when you can only fetch URLs.
|
|
38
|
+
|
|
33
39
|
`node_modules/@tangible/ui/` — read in this order, stop when answered:
|
|
34
40
|
|
|
35
41
|
| Question | File |
|
|
@@ -41,9 +47,9 @@ there is no CSS at all.
|
|
|
41
47
|
| which Storybook page is this? | `tui-manifest.json` → `components.<Name>.story.title` |
|
|
42
48
|
|
|
43
49
|
Directory and file name match, with two exceptions: `Table/DataTable.d.ts` and
|
|
44
|
-
`ColorPicker/ColorField.d.ts`. Props live in `types.d.ts` for
|
|
50
|
+
`ColorPicker/ColorField.d.ts`. Props live in `types.d.ts` for 35 of 46 components; the other eleven
|
|
45
51
|
declare them in the component file (Card, Chip, Chips, ColorPicker, Field, GradientPicker, Icon,
|
|
46
|
-
Modal, Notice, OverlapStack).
|
|
52
|
+
Modal, Notice, OverlapStack, Toast).
|
|
47
53
|
`<Dir>.d.ts` is still the better read for the **compound shape** — it spells out
|
|
48
54
|
`type SelectCompound = … & { Trigger; Content; Option; Group; Label }` in one place, which the
|
|
49
55
|
barrel's flat export list only implies.
|
|
@@ -58,21 +64,21 @@ the filter drops load-bearing API:
|
|
|
58
64
|
- Any prop without a JSDoc comment is dropped, required or not. The clearest tell: the manifest's
|
|
59
65
|
**`Checkbox` entry lists `rel` and `title` but not `checked`, `defaultChecked`, `indeterminate`
|
|
60
66
|
or `onCheckedChange`** — the entire state API is missing while inherited HTML noise survives.
|
|
61
|
-
-
|
|
67
|
+
- 39 components report `subcomponents: null`, and for 13 of those the compound API is real
|
|
62
68
|
(Select, MultiSelect, SearchSelect, Combobox, MultiCombobox, Dropdown, Popover, Tooltip, Field,
|
|
63
|
-
Sidebar, StepList, Toolbar) — [#87](https://github.com/TangibleInc/tangible-ui/issues/87).
|
|
64
|
-
- Only 8 of
|
|
69
|
+
Sidebar, StepList, Toolbar, NavMenu) — [#87](https://github.com/TangibleInc/tangible-ui/issues/87).
|
|
70
|
+
- Only 8 of 46 entries carry a `description`, and 4 carry `use`/`notFor`, so it is a thin guide to
|
|
65
71
|
*which* component too. The two `guides` entries (Tabs vs SegmentedControl, Chip vs Button) are
|
|
66
72
|
worth reading; the rest of that judgement is not in the file.
|
|
67
73
|
|
|
68
|
-
**Manifest silence is not absence.** What it *is* good for: `cssTokens` (
|
|
74
|
+
**Manifest silence is not absence.** What it *is* good for: `cssTokens` (43 of 46 components list
|
|
69
75
|
their full `--tui-<component>-*` API — the only shipped listing, since consumers have no SCSS) and
|
|
70
|
-
`story` (all
|
|
76
|
+
`story` (all 46, pointing into <https://storybook-tangible-ui.pages.dev>).
|
|
71
77
|
|
|
72
78
|
### Types that will not resolve from the barrel
|
|
73
79
|
|
|
74
80
|
`@tangible/ui` re-exports the main `*Props` types but systematically omits others. Import those from
|
|
75
|
-
`@tangible/ui/components/<Dir>` — all
|
|
81
|
+
`@tangible/ui/components/<Dir>` — all 46 component subpaths are exported.
|
|
76
82
|
|
|
77
83
|
- **Nearly every `*Labels` type** (the i18n prop): `ButtonLabels`, `FieldLabels`,
|
|
78
84
|
`ComboboxLabels`, `MultiSelectLabels`, `RatingLabels`, `DataTableLabels`, `AvatarLabels`,
|
|
@@ -133,7 +139,7 @@ resolve the same root yourself.
|
|
|
133
139
|
If `<html>` itself is the `.tui-interface`, portal roots mount inside `<body>`, not on `<html>`.
|
|
134
140
|
|
|
135
141
|
**3. Dark mode is `data-theme`, not a class.** TUI's palette is gated on `[data-theme="dark"]`
|
|
136
|
-
(`"auto"` follows `prefers-color-scheme`; absent means light and inherits the host's colour). With `data-theme="dark"`/`"auto"` on an ancestor such as `<html>` and an un-themed `.tui-interface` on `<body>`, TUI surfaces (panels, cards, filled controls) render correctly because they own their text colour, but in-flow text directly inside the interface still inherits the HOST's colour by design — so set the host's own body colour (e.g. `color: var(--tui-color-fg)` on `body`) if you want TUI's. A host
|
|
142
|
+
(`"auto"` follows `prefers-color-scheme`; absent means light and inherits the host's colour). With `data-theme="dark"`/`"auto"` on an ancestor such as `<html>` and an un-themed `.tui-interface` on `<body>`, TUI surfaces (panels, cards, filled controls) render correctly because they own their text colour, but in-flow text directly inside the interface still inherits the HOST's colour by design — so set the host's own body colour (e.g. `color: var(--tui-color-fg)` on `body`) if you want TUI's. A standalone app gets that, and more, from the app base sheet (§6). A host
|
|
137
143
|
that toggles a `.dark` class (Tailwind's strategy) drives nothing in TUI. Translate it: observe what
|
|
138
144
|
is actually applied to the document — a `MutationObserver` on `<html>`'s `class` catches boot,
|
|
139
145
|
explicit toggles and OS changes alike — and mirror it onto your wrapper. Resolve to explicit
|
|
@@ -165,6 +171,82 @@ components), or, if your build compiles Sass, the documented subset entry:
|
|
|
165
171
|
);
|
|
166
172
|
```
|
|
167
173
|
|
|
174
|
+
**Icons have the same problem in JavaScript.** Any component that renders an icon pulls in the
|
|
175
|
+
icon registry, every set, ~145 kB minified / ~30 kB gzipped, because names like `"system/check"`
|
|
176
|
+
are looked up at runtime. To ship only the icons you name, point the registry at a lean one of
|
|
177
|
+
your own:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
// src/tui-icons.ts: every icon name YOUR code passes to TUI, and nothing else
|
|
181
|
+
import { Check, Plus, Trash } from '@tangible/ui/icons/system/index.js';
|
|
182
|
+
export const iconRegistry = { 'system/check': Check, 'system/plus': Plus, 'system/trash': Trash };
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
// vite.config.ts: TUI imports the registry by a relative path, so match the specifier's tail
|
|
187
|
+
resolve: { alias: [{ find: /icons\/registry\.js$/, replacement: '/src/tui-icons.ts' }] }
|
|
188
|
+
// webpack.config.js
|
|
189
|
+
plugins: [new webpack.NormalModuleReplacementPlugin(/icons\/registry\.js$/, path.resolve('src/tui-icons.ts'))]
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
TUI's own icons (chevrons, close, check, …) are imported directly from 0.2.30, so
|
|
193
|
+
they never need listing. A name you use but forget to list renders an empty `<span data-tui-icon-missing="…">` and a
|
|
194
|
+
dev-mode warning. Or skip names altogether: every icon prop also takes the component itself,
|
|
195
|
+
`<IconButton icon={Trash} label="Delete" />`, which never touches the registry.
|
|
196
|
+
Import each icon from the set that owns its file: the `lms/info`, `lms/help-circle-fill` and
|
|
197
|
+
`lms/question-mark` aliases live in `system`. The alias is verified on Vite production builds; the
|
|
198
|
+
webpack line is the equivalent, untested.
|
|
199
|
+
|
|
200
|
+
**6. A standalone app that owns the whole page can add the app base sheet.** For Vite/React apps,
|
|
201
|
+
not plugin frontends:
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
import '@tangible/ui/styles';
|
|
205
|
+
import '@tangible/ui/styles/app';
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
It expects `.tui-interface` on `<html>` or `<body>`, with `data-theme` on either, and sets what
|
|
209
|
+
every Tangible app had been hand-rolling:
|
|
210
|
+
- no body margin;
|
|
211
|
+
- the body painted `--tui-color-bg-surface`, with `--tui-color-fg` text;
|
|
212
|
+
- `--tui-input-bg` set to `--tui-color-bg`, so fields don't vanish into the surface (declared per
|
|
213
|
+
interface, so Toast's dark scope resolves its own);
|
|
214
|
+
- `color-scheme` on `<html>`, for dark scrollbars;
|
|
215
|
+
- unclassed links in `--tui-theme-primary-strong` with a pointer cursor;
|
|
216
|
+
- `code` in the mono stack at 0.9em;
|
|
217
|
+
- app typography from the Figma templates (below).
|
|
218
|
+
|
|
219
|
+
**App typography.** Copy reads at 14px (`--tui-typography-size-sm`) on every interface, portals and
|
|
220
|
+
nested scopes included (on `<body>` when `<html>` is the interface, so `rem` stays 16px). Controls that
|
|
221
|
+
set their own font size keep their ladder; em-sized pieces inside copy, such as an inline Icon or a
|
|
222
|
+
bare Checkbox, follow the copy. The roles below use weights 400 and 600 only.
|
|
223
|
+
The sheet retunes `headline-04` to 600 / 1.25 and `body`/`body-sm` to line height 1.4, and sets Field
|
|
224
|
+
help to `fg-muted` for every Field in the app, so it matches app helper text. Pick the element from the document outline,
|
|
225
|
+
never from the size (page title `h1`, card title `h2` is a sensible default):
|
|
226
|
+
|
|
227
|
+
| Role | Class | Colour |
|
|
228
|
+
|---|---|---|
|
|
229
|
+
| Page title | `tui-text-style-headline-04` (24 / 600) | default |
|
|
230
|
+
| Card or section title | `tui-text-style-headline-07` (16 / 600) | default |
|
|
231
|
+
| Page, card and empty-state description; key labels | `tui-text-style-body-sm` | `--tui-color-fg-muted` |
|
|
232
|
+
| Body and value text | `tui-text-style-body-sm` | default |
|
|
233
|
+
| Setting-row title, inline emphasis, identity name | `body-sm` at weight 600 | default |
|
|
234
|
+
| Helper, meta, caption; secondary line of a two-line row | `tui-text-style-caption` (12) | muted (built in) |
|
|
235
|
+
| Nav group header | `tui-text-style-overline`; write the copy in sentence case, the style uppercases it | muted (built in) |
|
|
236
|
+
| Stat value | 20 / 600 / 1.4 in the body face | default |
|
|
237
|
+
| Stat trend | 12 / 400, coloured by **sentiment**, not arrow: `--tui-theme-{success,danger,secondary}-stronger` | |
|
|
238
|
+
| Empty-state title | 16 / 600 / 1.4 in the body face | default |
|
|
239
|
+
|
|
240
|
+
A brand heading face goes on `--tui-text-headline-family`. It reaches every headline level, so page and
|
|
241
|
+
card titles, and nothing in the body face (stat values and empty-state titles stay body). Field help on a light `bg-muted` panel measures 4.39:1 in `fg-muted`, under AA, so set
|
|
242
|
+
`--tui-field-helper-fg: var(--tui-color-fg-secondary)` on that panel.
|
|
243
|
+
|
|
244
|
+
It sits in the `defaults` layer at zero specificity, so TUI's components win over it and any
|
|
245
|
+
unlayered rule of yours wins over everything in it. It is layered only (there is no unlayered
|
|
246
|
+
build), which is why it isn't for WordPress. Fonts and page layout stay yours. Don't re-roll
|
|
247
|
+
screen-reader-only text or skip links: `.tui-visually-hidden` and `.tui-visually-hidden--focusable`
|
|
248
|
+
already work when `<body>` is the interface.
|
|
249
|
+
|
|
168
250
|
## Labels and errors: `Field` composition
|
|
169
251
|
|
|
170
252
|
`Field` wires `id` / `aria-labelledby` / `aria-describedby` / `aria-invalid` / `aria-required`
|
|
@@ -199,6 +281,51 @@ declare it there; the requirement still reaches AT through `Field.Label`'s visua
|
|
|
199
281
|
text. If axe reports `aria-allowed-attr` on a TUI trigger, it is TUI's to fix, not yours
|
|
200
282
|
(ColorField currently passes it through — verified Aug 22 2026, not yet filed).
|
|
201
283
|
|
|
284
|
+
## Translating TUI's built-in strings
|
|
285
|
+
|
|
286
|
+
TUI ships English defaults for every string it renders or announces on its own. Strings you pass
|
|
287
|
+
in (`label`, `aria-label`, titles) are already yours. Wire the rest to your translation layer
|
|
288
|
+
(`@wordpress/i18n`, tangible-strings) or the UI is partly English. Verified against main,
|
|
289
|
+
Oct 24 2026.
|
|
290
|
+
|
|
291
|
+
**`labels` objects** (pass a partial; unset keys keep the default). The defaults are exported as
|
|
292
|
+
`default<Name>Labels`; nine come from the barrel, the rest from `@tangible/ui/components/<Dir>`.
|
|
293
|
+
|
|
294
|
+
| Component | Keys |
|
|
295
|
+
|---|---|
|
|
296
|
+
| Avatar / AvatarGroup | `description` / `group`, `groupAll`, `overflow` |
|
|
297
|
+
| Button | `newTab` (" (opens in new tab)", the hidden hint on `target="_blank"` links) |
|
|
298
|
+
| Calendar | `prevMonth`, `nextMonth`, `prevYear`, `nextYear`, `openMonthPicker`, `day`, `today`, `selected` |
|
|
299
|
+
| ColorField | `trigger`, `dynamic`, `modes`, `solidTab`, `gradientTab` (its popover takes ColorPicker's) |
|
|
300
|
+
| ColorPicker | `group`, `area`, `hue`, `alpha`, `format`, `value`, `copy`, `copied`, `variable`, `formats`, `channels`, channel names, value texts |
|
|
301
|
+
| Combobox | `clear` |
|
|
302
|
+
| DataTable / BulkActionsBar | `selectAll`, `selectRow`, `pageStatus`, `sortBy`, `sorted` / `selected`, `actions` |
|
|
303
|
+
| DatePicker | `title`, `titleWithTime`, `now`, `close`, `placeholder`, `timeSection`, `dateSection`, `month`, `dayOfMonth`, `year`, `hour`, `minute`, `am`, `pm`, `meridiem`, `trigger`, `triggerEmpty` |
|
|
304
|
+
| DateRangePicker | `from`, `to`, `apply`, `cancel`, `placeholder`, `presets`, `trigger`, `triggerEmpty` |
|
|
305
|
+
| Field | `required` (the visually hidden "required" after the label) |
|
|
306
|
+
| GradientPicker | `group`, `bar`, `stop`, `value`, `copy`, `copied`, `reverse`, stop editing, type and geometry labels |
|
|
307
|
+
| MoveHandle | `moveUp`, `moveDown`, `drag`, `locked` (no exported default object) |
|
|
308
|
+
| MultiCombobox | `clear`, `remove`, `status` |
|
|
309
|
+
| MultiSelect | `selected`, `more`, `status` |
|
|
310
|
+
| NavMenu | `submenu` |
|
|
311
|
+
| Pager | `previous`, `next`, `first`, `last` (+ `*Text`), `page`, `navigation`, `pageStatus`, `itemsPerPage`, `perPage`, `jumpLabel`, `jumpText` |
|
|
312
|
+
| Rating | `rating`, `group`, `value` |
|
|
313
|
+
| SearchSelect | `search`, `clearSearch`, `noResults` |
|
|
314
|
+
| SecretInput | `reveal`, `hide`, `shown`, `hidden`, `valueSet`, `valueSetDescription`, `locked` |
|
|
315
|
+
| Sidebar.Toggle | `collapse`, `expand` |
|
|
316
|
+
| StepIndicator | `notStarted`, `inProgress`, `complete`, `locked`, `status`, `statusWithValue` |
|
|
317
|
+
|
|
318
|
+
Some keys are functions (counts, page status, value texts); the type says which.
|
|
319
|
+
|
|
320
|
+
**Flat string props:** Chip `removeLabel` ("Remove"); ChipGroup `multipleLabel`; DataTable
|
|
321
|
+
`loadingMessage`, `emptyMessage`; BulkActionsBar `clearLabel`; Modal `closeLabel`; Notice and
|
|
322
|
+
Toast `dismissLabel` ("Dismiss") and `dismissedMessage` ("Notification dismissed", announced after
|
|
323
|
+
the × closes it); SearchInput `searchLabel`, `clearLabel`; Select `clearLabel`; ToastProvider
|
|
324
|
+
`regionLabel` ("Notifications").
|
|
325
|
+
|
|
326
|
+
**Composed strings:** Button `loading` names itself "<label>, loading" in English. Pass
|
|
327
|
+
`loadingLabel` with the translated whole.
|
|
328
|
+
|
|
202
329
|
## Customising
|
|
203
330
|
|
|
204
331
|
Tokens, not class overrides. Four layers, and you only touch two:
|
|
@@ -254,15 +381,50 @@ Form controls show no border change on hover unless you set `--tui-input-border-
|
|
|
254
381
|
that component only. If you re-point an option state's background, set its `-fg-*` partner too:
|
|
255
382
|
the text defaults to the panel's own fg, which is tuned for TUI's default fills.
|
|
256
383
|
|
|
257
|
-
**Text styles** (0.2.24+) are classes: `.tui-text-style-{display-01…04, headline-01…
|
|
384
|
+
**Text styles** (0.2.24+) are classes: `.tui-text-style-{display-01…04, headline-01…07, body, body-sm, label, caption, overline}`. Restyle a treatment everywhere through its one class (`.tui-text-style-overline { text-transform: none }` reaches every listbox group label and the Dropdown header), or through its knobs, `--tui-text-{style}-{family,size,weight,line-height,tracking,transform,color}`. Knobs are never declared, so `:root` works. `--tui-text-headline-weight` retunes every headline level at once.
|
|
258
385
|
|
|
259
386
|
**Fonts:** TUI inherits the host's font. If your page has none (you see the browser's serif), add `tui-font-sans` next to `tui-interface`, or set `--tui-font-family-base` anywhere. `--tui-font-family-sans` / `-mono` replace the stacks those utilities use.
|
|
260
387
|
|
|
261
388
|
**Tooltips warm up in groups:** wrap a set of tooltips in `TooltipProvider` (a `Toolbar` does it for you), and after the first shows, the rest appear at once while you move between them (`skipDelayDuration`, default 300ms). Don't hand-roll delay logic per tooltip.
|
|
262
389
|
|
|
390
|
+
**A tooltip that repeats the trigger's name is `type="label"`.** The default tooltip is a
|
|
391
|
+
description: it puts `aria-describedby` on the trigger, so a screen reader hears "Settings, button,
|
|
392
|
+
Settings" when the text matches the `aria-label`. `<Tooltip type="label">` adds no ARIA and hides
|
|
393
|
+
its text from the accessibility tree; the trigger must carry its own name (a dev warning fires if
|
|
394
|
+
it doesn't). Use it only when the tooltip says the same words as the name: extra information is a
|
|
395
|
+
description, and `label` would hide it from screen readers. `IconButton showTooltip` and Avatar's tooltip already do this. Don't wrap the trigger
|
|
396
|
+
in a `<span>` to dodge the describedby. Set `--tui-tooltip-max-width` (default 250px, never wider
|
|
397
|
+
than the viewport) for a one-line tooltip, rather than a className.
|
|
398
|
+
|
|
263
399
|
`className` is for layout integration (margin, grid placement), not appearance. Beyond the token
|
|
264
400
|
API the sanctioned escape hatch is to **swizzle** — copy the component source and own the fork.
|
|
265
401
|
|
|
402
|
+
### Card spacing, container and links
|
|
403
|
+
|
|
404
|
+
- **Padding vs gap.** `--tui-card-padding` is the card's *outer* edge: inline on every slot, and
|
|
405
|
+
block on the first slot's top and the last slot's bottom. `--tui-card-gap` is the space
|
|
406
|
+
*between* slots (a slot's bottom padding when another follows it). A lone `Card.Body` is both
|
|
407
|
+
first and last, so padding alone sizes it. To make a compact card with Head + Body + Foot, set
|
|
408
|
+
both.
|
|
409
|
+
- **`tuiCard` is a public container name.** Card is `container-type: inline-size;
|
|
410
|
+
container-name: tuiCard`, so content inside can respond to the card's own width:
|
|
411
|
+
`@container tuiCard (max-width: 36rem) { .my-link { margin-inline-start: 0; } }`. Name it
|
|
412
|
+
explicitly; an unnamed `@container` query can match a nearer container instead.
|
|
413
|
+
- **Clickable card: `<Card interactive>` + `<Card.Link>`.** `Card.Link` is the stretched link
|
|
414
|
+
(its `::after` covers the card), and `interactive` adds the hover/focus border
|
|
415
|
+
(`--tui-card-border-interact`) and the whole-card focus ring. Hand-adding the
|
|
416
|
+
`tui-stretched-link` classes to a Card gets the click target without the hover affordance.
|
|
417
|
+
`Card.Link` takes the card's text colour, so it can wrap the title text itself
|
|
418
|
+
(`--tui-card-link-fg` changes it, and a plain `a { color }` rule won't; an override owns its own
|
|
419
|
+
contrast). A bare `tui-stretched-link` outside a Card sets no colour.
|
|
420
|
+
- **A custom block that should behave like one** (a promo banner that isn't a Card): put
|
|
421
|
+
`tui-stretched-link-container` on the block and `tui-stretched-link` on its one link, then
|
|
422
|
+
mirror the interactive Card yourself: a transparent border at rest, `border-color` on `:hover`
|
|
423
|
+
and `:has(:focus-visible)`. The utility classes only stretch the click target. The
|
|
424
|
+
whole-block focus ring is Card-only (`.tui-card .tui-stretched-link:focus-visible::after`);
|
|
425
|
+
outside a Card the ring stays on the link text unless you draw it on the block. Give the link its
|
|
426
|
+
colour too: outside a Card, `tui-stretched-link` sets none.
|
|
427
|
+
|
|
266
428
|
### Styling one member of a group
|
|
267
429
|
|
|
268
430
|
Selection components expose their state as attributes, so you can style a *particular* option
|
|
@@ -404,7 +566,10 @@ synthesise a second toggle. For a second control that toggles the same item (an
|
|
|
404
566
|
**ConfirmDialog / AlertDialog → `Modal role="alertdialog"`** (needs both `aria-labelledby` and
|
|
405
567
|
`aria-describedby`; the backdrop stops dismissing by default, Escape still cancels; put the actions in
|
|
406
568
|
`Modal.Foot`, which is already an end-aligned flex row — `justify="between"` separates a destructive one).
|
|
407
|
-
**Snackbar → `Toast`** (`ToastProvider` + `useToast()`).
|
|
569
|
+
**Snackbar → `Toast`** (`ToastProvider` + `useToast()`).
|
|
570
|
+
**Password / API key / token field → `SecretInput`** (a `TextInput` variant: masked, with a reveal
|
|
571
|
+
toggle whose name flips Show/Hide; `isSet` is a boolean so a stored secret never reaches the client,
|
|
572
|
+
it shows a "Saved" placeholder and typing replaces it; `locked` makes it read-only with no toggle). No Breadcrumb, no Skeleton, and no *standalone* time picker — but
|
|
408
573
|
`DatePicker` / `DateRangePicker` take `withTime` for an hour/minute field (12- or 24-hour via
|
|
409
574
|
`hour12`) plus a display-only `zoneLabel`; the value is a plain `Date` with wall-clock semantics,
|
|
410
575
|
so timezone interpretation stays yours.
|
|
@@ -420,9 +585,12 @@ Two clusters are easy to pick wrong:
|
|
|
420
585
|
chips in the trigger), `MultiCombobox` (multi, free-typing token field). All five share one
|
|
421
586
|
listbox engine, so navigation and ARIA behave identically; the trigger is the choice.
|
|
422
587
|
|
|
423
|
-
Icons are a registry, six sets,
|
|
588
|
+
Icons are a registry, six sets, 262 entries (Oct 24 2026): `system` (123), `lms` (45), `reaction`
|
|
424
589
|
(36), `player` (24), `membersync` (22), `cred` (12). `@tangible/ui/icons/manifest` is the
|
|
425
|
-
machine-readable list.
|
|
590
|
+
machine-readable list. Search it across all sets, by name and by `aliasOf`: an alias names the same
|
|
591
|
+
glyph a second way (`system/refresh` and `system/rotate` are `system/arrow-counterclockwise`).
|
|
592
|
+
General-purpose glyphs live in `system` (`system/info`, `system/help-circle-fill`,
|
|
593
|
+
`system/question-mark`); their old `lms/` keys still work as aliases.
|
|
426
594
|
|
|
427
595
|
```tsx
|
|
428
596
|
<Icon name="system/check" /> {/* decorative — hidden from AT automatically */}
|
|
@@ -435,8 +603,8 @@ There are no device icons (monitor / tablet / phone) in any set.
|
|
|
435
603
|
|
|
436
604
|
`data-testid` pass-through is uneven, and the split is not the one you would guess. These spread
|
|
437
605
|
rest props onto their primary element: **Button, Card, Checkbox, Chip, ColorPicker, ColorField,
|
|
438
|
-
`Field`'s slots, GradientPicker, IconButton, Modal,
|
|
439
|
-
Textarea, TextInput**, **DataTable** (onto the `<table>`), and — since 0.2.16 — the group members
|
|
606
|
+
`Field`'s slots, GradientPicker, IconButton, Modal, NavMenu (root, `.Group`, `.Sub`, `.Item`),
|
|
607
|
+
Notice, SearchInput, SearchSelect, SecretInput, Switch, Textarea, TextInput, Toast**, **DataTable** (onto the `<table>`), and — since 0.2.16 — the group members
|
|
440
608
|
**SegmentedControl.Item, Tabs.Tab and Radio**. Everything else drops them silently,
|
|
441
609
|
including several that look like they would take them — Dropdown, Popover, Tooltip, Select,
|
|
442
610
|
MultiSelect, Combobox, MultiCombobox, Sidebar, Toolbar, Pager, Rating, Progress,
|
|
@@ -467,6 +635,36 @@ One live trap there: **memoize `data`, or pass `autoResetPageIndex={false}`.** A
|
|
|
467
635
|
a new identity every render, TanStack queues a page-0 reset on every `data` identity change, and
|
|
468
636
|
with a controlled `pageIndex` that races your parent back to page 0 permanently.
|
|
469
637
|
|
|
638
|
+
## Vanilla modal (no React)
|
|
639
|
+
|
|
640
|
+
For templates and plugin PHP with no React build (Tangible Blocks, L&L): `@tangible/ui` ships a framework-free modal on the native `<dialog>`. It replaces MicroModal; there is no compat layer, so the markup differs.
|
|
641
|
+
|
|
642
|
+
```html
|
|
643
|
+
<link rel="stylesheet" href="https://unpkg.com/@tangible/ui/vanilla/styles.css"> <!-- or all.css, not both -->
|
|
644
|
+
<script src="https://unpkg.com/@tangible/ui/vanilla/modal.min.js" defer></script>
|
|
645
|
+
|
|
646
|
+
<button type="button" data-tui-modal-open="intro">Watch</button>
|
|
647
|
+
|
|
648
|
+
<dialog id="intro" class="tui-interface tui-modal" aria-labelledby="intro-title">
|
|
649
|
+
<div class="tui-modal__dialog is-size-lg"> <!-- required: a click on the <dialog> itself is the backdrop -->
|
|
650
|
+
<div class="tui-modal__head"><h2 id="intro-title">Intro</h2></div>
|
|
651
|
+
<div class="tui-modal__body"><div class="tui-modal__body-inner">
|
|
652
|
+
<iframe class="tui-modal__embed" title="Intro video" data-tui-modal-src="https://www.youtube.com/embed/ID?autoplay=1"></iframe>
|
|
653
|
+
</div></div>
|
|
654
|
+
<div class="tui-modal__foot">
|
|
655
|
+
<button type="button" class="tui-button" data-tui-modal-close>Close</button>
|
|
656
|
+
</div>
|
|
657
|
+
</div>
|
|
658
|
+
</dialog>
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
- **Attributes.** `data-tui-modal-open="<id>"` and `data-tui-modal-close` go on any element (delegated, so markup added later works; `aria-disabled` triggers are ignored). On the dialog, `role="alertdialog"` (add `aria-describedby`) and `data-tui-modal-backdrop="dismiss" | "static"`; alertdialog defaults to static. `[autofocus]` / `[data-autofocus]` picks initial focus. A submit button or link carrying `data-tui-modal-close` keeps its default action. `data-tui-modal-restore-focus="<id>"` on the dialog names where focus goes on close, for when the opener is gone (a Delete-row confirm); otherwise it returns to the opener. Put `.tui-modal__close` last in the box: initial focus skips it unless it's the only control.
|
|
662
|
+
- **State and events.** The script sets `data-state` to `open`, `closing` or `closed`. `tui-modal-open` and `tui-modal-close` bubble from the dialog; close's `detail.returnValue` is the submitting button's value in a `<form method="dialog">`. `window.TangibleUI.modal` exposes `open(idOrDialog)` and `close(...)`.
|
|
663
|
+
- **Embeds.** `data-tui-modal-src` loads on open and is dropped on close, which stops a YouTube or Vimeo player with no `postMessage` script. `<audio>`/`<video>` pause. Always give the iframe a `title`.
|
|
664
|
+
- **Name it.** The dialog needs `aria-labelledby` pointing at an element that exists (a phantom id leaves it unnamed) or an `aria-label`, and an icon-only close needs its own `aria-label` (the script can't see that one). The script warns in the console about a missing or phantom name, a dangling `aria-describedby`, an alertdialog without `aria-describedby`, a missing `.tui-modal__dialog` box and no close control; warnings are always on.
|
|
665
|
+
- **Two enqueues are fine.** If Blocks and L&L both load the script, only the first copy installs.
|
|
666
|
+
- **Limit: the top layer.** A native modal puts everything else inert and renders above it. A React Select, datepicker or any widget portaled to `<body>` renders under the dialog and can't be used inside it. Keep such controls in the dialog's own markup.
|
|
667
|
+
|
|
470
668
|
## Known issues
|
|
471
669
|
|
|
472
670
|
Each is tracked in the repo, so **follow the link for current state rather than trusting this
|
|
@@ -480,6 +678,40 @@ Re-verify before you work around anything.
|
|
|
480
678
|
- **`tui-manifest.json` is lossy** — see "Where the API lives" above for the shape of it.
|
|
481
679
|
([#87](https://github.com/TangibleInc/tangible-ui/issues/87))
|
|
482
680
|
|
|
681
|
+
## House patterns, by app type
|
|
682
|
+
|
|
683
|
+
Decisions Julia has made for a kind of app, recorded so the next app of that kind starts from them.
|
|
684
|
+
They are house style for that app type, not TUI rules: check the app type before applying one.
|
|
685
|
+
|
|
686
|
+
### Public single-purpose web app
|
|
687
|
+
|
|
688
|
+
A public React app with one job and a handful of screens: HushNote (`tangible-hush`,
|
|
689
|
+
hush.tangible.one) is the reference. `<body class="tui-interface">` with `data-theme` on `<html>`,
|
|
690
|
+
and tangible-strings' `brand.css`.
|
|
691
|
+
|
|
692
|
+
- **Action rows.** Primary action `variant="solid"`, secondary `variant="outline"`, and an
|
|
693
|
+
escape or start-again action as `variant="link" theme="secondary"` pushed to the far end of the
|
|
694
|
+
row with `margin-inline-start: auto`. Every button has a leading icon (Copy link
|
|
695
|
+
`system/copy`, Email link `system/envelope`, Write another note `system/arrow-counterclockwise`
|
|
696
|
+
aka `system/refresh`).
|
|
697
|
+
- **Every Notice has an icon,** mapped from its theme: warning → `system/alert-triangle`,
|
|
698
|
+
danger → `system/alert-circle-fill`, info → `lms/info`. Use `<Notice inline>` with
|
|
699
|
+
`<Notice.Head icon={…} />` and no title for a one-line message. Use `theme="info"`, not
|
|
700
|
+
neutral, for "this is gone once you leave" warnings.
|
|
701
|
+
- **Toasts are non-dismissible and always time out:** `dismissible: false`, 3s for success, 8s
|
|
702
|
+
for a failure that asks the user to act. A repeated action reuses one toast `id`, so it
|
|
703
|
+
refreshes instead of stacking. (Never pair `dismissible: false` with `duration: null`; TUI
|
|
704
|
+
warns in dev.)
|
|
705
|
+
- **Clickable cards are `<Card interactive>` + `<Card.Link>`;** a non-Card promo block mirrors
|
|
706
|
+
it (see "Card spacing, container and links"). Dark-mode hover border in the block's own text
|
|
707
|
+
colour; light mode `--tui-theme-primary-base`, as Card does.
|
|
708
|
+
- **Sibling surfaces share one radius,** fed from one list-level property
|
|
709
|
+
(`--offer-radius: var(--tui-radius-lg)`) into both `--tui-card-radius` and a custom block's
|
|
710
|
+
`border-radius`, so they can't drift.
|
|
711
|
+
- **Single-action screens are centred both ways** between header and footer
|
|
712
|
+
(`main:has(> .centred-screen)` as a flex column with even padding), with
|
|
713
|
+
`text-wrap: balance` on the heading and lede.
|
|
714
|
+
|
|
483
715
|
## Verify
|
|
484
716
|
|
|
485
717
|
`tsc --noEmit` catches guessed props immediately — TUI ships types, and most unions are literal.
|