@tangible/ui 0.2.11 → 0.2.12
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 +35 -22
- package/components/Accordion/Accordion.js +2 -2
- package/components/Combobox/Combobox.js +37 -5
- package/components/Combobox/types.d.ts +6 -0
- package/components/DatePicker/DatePicker.d.ts +3 -0
- package/components/DatePicker/DatePicker.js +8 -2
- package/components/DatePicker/DateRangePicker.d.ts +3 -0
- package/components/DatePicker/DateRangePicker.js +8 -2
- package/components/DatePicker/types.d.ts +36 -0
- package/components/Dropdown/Dropdown.js +2 -1
- package/components/MultiCombobox/MultiCombobox.js +1 -1
- package/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/components/MultiSelect/MultiSelect.js +29 -5
- package/components/MultiSelect/types.d.ts +13 -0
- package/components/Pager/Pager.d.ts +65 -1
- package/components/Pager/Pager.js +83 -10
- package/components/Pager/index.d.ts +1 -1
- package/components/Pager/types.d.ts +39 -0
- package/components/Pager/types.js +6 -0
- package/components/Popover/Popover.js +2 -1
- package/components/SearchSelect/SearchSelect.d.ts +1 -1
- package/components/SearchSelect/SearchSelect.js +3 -5
- package/components/SearchSelect/types.d.ts +0 -2
- package/components/Select/Select.d.ts +1 -1
- package/components/Select/Select.js +29 -5
- package/components/Select/types.d.ts +13 -0
- package/components/Table/DataTable.d.ts +6 -0
- package/components/Textarea/Textarea.js +7 -0
- package/components/Tooltip/Tooltip.js +2 -1
- package/components/index.d.ts +2 -2
- package/components/index.js +1 -1
- package/figma-tokens.json +4018 -0
- package/icons/icons.svg +12 -2
- package/icons/lms/index.d.ts +12 -0
- package/icons/lms/index.js +83 -17
- package/icons/manifest.json +80 -0
- package/icons/membersync/index.js +9 -9
- package/icons/player/index.js +4 -4
- package/icons/reaction/index.js +4 -4
- package/icons/registry.d.ts +20 -0
- package/icons/registry.js +10 -0
- package/icons/system/index.d.ts +8 -0
- package/icons/system/index.js +65 -21
- package/package.json +5 -1
- package/skills/building-with-tui/SKILL.md +328 -0
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +145 -256
- package/styles/all.expanded.unlayered.css +145 -256
- package/styles/all.unlayered.css +1 -1
- package/styles/components/color-picker.scss +16 -3
- package/styles/components/combobox.scss +33 -58
- package/styles/components/date-picker.scss +17 -9
- package/styles/components/dropdown.scss +11 -6
- package/styles/components/gradient-picker.scss +4 -4
- package/styles/components/multi-combobox.scss +17 -37
- package/styles/components/multi-select.scss +14 -50
- package/styles/components/pager.scss +155 -17
- package/styles/components/radio.scss +37 -0
- package/styles/components/search-select.scss +14 -36
- package/styles/components/select.scss +22 -51
- package/styles/components/text-input.scss +79 -21
- package/styles/system/_constants.scss +7 -1
- package/tui-manifest.json +143 -6
- package/utils/compose-refs.d.ts +29 -3
- package/utils/compose-refs.js +51 -12
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: building-with-tui
|
|
3
|
+
description: Use when writing, reviewing or testing React UI that imports @tangible/ui (TUI) — components render unstyled or unthemed, a portalled Modal/Select/Popover loses its tokens or its theme, dark mode does not follow the host app, a prop or type will not resolve, a label or error is not announced, or you need to know which component (or token) to reach for.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Building with TUI
|
|
7
|
+
|
|
8
|
+
Consumer-side skill: how to build an app **with** `@tangible/ui`. (Building TUI itself is covered by
|
|
9
|
+
the repo's own CLAUDE.md and `.claude/agents/*`.)
|
|
10
|
+
|
|
11
|
+
The API is on disk and does not need guessing. What costs hours is the **wiring and the a11y
|
|
12
|
+
plumbing**, because both fail silently rather than erroring. That is most of what follows.
|
|
13
|
+
|
|
14
|
+
Verified against **0.2.11 + main** (Aug 22 2026). Version-specific claims are dated; re-check
|
|
15
|
+
anything that reads as surprising.
|
|
16
|
+
|
|
17
|
+
## The minimum that works
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import '@tangible/ui/styles'; // once, app-wide — Wiring §4 picks the right entry
|
|
21
|
+
import { Button } from '@tangible/ui';
|
|
22
|
+
|
|
23
|
+
<div className="tui-interface" data-theme="dark"> {/* omit data-theme for light */}
|
|
24
|
+
<Button label="Save" theme="primary" />
|
|
25
|
+
</div>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Both halves are load-bearing. Without `.tui-interface` there are no tokens; without the stylesheet
|
|
29
|
+
there is no CSS at all.
|
|
30
|
+
|
|
31
|
+
## Where the API lives
|
|
32
|
+
|
|
33
|
+
`node_modules/@tangible/ui/` — read in this order, stop when answered:
|
|
34
|
+
|
|
35
|
+
| Question | File |
|
|
36
|
+
|---|---|
|
|
37
|
+
| install, style entries, wrapper, dark mode, token overrides | `README.md` |
|
|
38
|
+
| **props, types, JSDoc — the authority** | `components/<Dir>/types.d.ts`, falling back to `components/<Dir>/<Dir>.d.ts` |
|
|
39
|
+
| is there a `.Content` / `.Option` / `.Trigger`? | the compound type in `components/<Dir>/<Dir>.d.ts` |
|
|
40
|
+
| what tokens does this component read? | `tui-manifest.json` → `components.<Name>.cssTokens` |
|
|
41
|
+
| which Storybook page is this? | `tui-manifest.json` → `components.<Name>.story.title` |
|
|
42
|
+
|
|
43
|
+
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 33 of 43 components; the other ten
|
|
45
|
+
declare them in the component file (Card, Chip, Chips, ColorPicker, Field, GradientPicker, Icon,
|
|
46
|
+
Modal, Notice, OverlapStack).
|
|
47
|
+
`<Dir>.d.ts` is still the better read for the **compound shape** — it spells out
|
|
48
|
+
`type SelectCompound = … & { Trigger; Content; Option; Group; Label }` in one place, which the
|
|
49
|
+
barrel's flat export list only implies.
|
|
50
|
+
|
|
51
|
+
**Do not use `tui-manifest.json` for props.** It is curated for narrative, not completeness, and
|
|
52
|
+
the filter drops load-bearing API:
|
|
53
|
+
|
|
54
|
+
- It keeps exactly five `on*` props — `onClick`, `onChange`, `onClose`, `onDismiss`,
|
|
55
|
+
`onValueChange` — and drops every other callback. `onCheckedChange`, `onOpenChange`,
|
|
56
|
+
`onInputChange`, `onSearch`, `onClear`, `onRemove`, `onPageIndexChange`, `onSelectionChange`
|
|
57
|
+
are all absent.
|
|
58
|
+
- Any prop without a JSDoc comment is dropped, required or not. The clearest tell: the manifest's
|
|
59
|
+
**`Checkbox` entry lists `rel` and `title` but not `checked`, `defaultChecked`, `indeterminate`
|
|
60
|
+
or `onCheckedChange`** — the entire state API is missing while inherited HTML noise survives.
|
|
61
|
+
- 36 components report `subcomponents: null`, and for 12 of those the compound API is real
|
|
62
|
+
(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 43 entries carry a `description`, and 4 carry `use`/`notFor`, so it is a thin guide to
|
|
65
|
+
*which* component too. The two `guides` entries (Tabs vs SegmentedControl, Chip vs Button) are
|
|
66
|
+
worth reading; the rest of that judgement is not in the file.
|
|
67
|
+
|
|
68
|
+
**Manifest silence is not absence.** What it *is* good for: `cssTokens` (40 of 43 components list
|
|
69
|
+
their full `--tui-<component>-*` API — the only shipped listing, since consumers have no SCSS) and
|
|
70
|
+
`story` (all 43, pointing into <https://storybook-tangible-ui.pages.dev>).
|
|
71
|
+
|
|
72
|
+
### Types that will not resolve from the barrel
|
|
73
|
+
|
|
74
|
+
`@tangible/ui` re-exports the main `*Props` types but systematically omits others. Import those from
|
|
75
|
+
`@tangible/ui/components/<Dir>` — all 43 component subpaths are exported.
|
|
76
|
+
|
|
77
|
+
- **Nearly every `*Labels` type** (the i18n prop): `ButtonLabels`, `FieldLabels`,
|
|
78
|
+
`ComboboxLabels`, `MultiSelectLabels`, `RatingLabels`, `DataTableLabels`, `AvatarLabels`,
|
|
79
|
+
`StepIndicatorLabels`, `CalendarLabels`, … (`PagerLabels` is the exception — exported since
|
|
80
|
+
0.2.12.)
|
|
81
|
+
- **Most union / variant aliases**: `AccordionVariant`, `ContentIndicatorSize`,
|
|
82
|
+
`ComboboxFilterMode`, `IconButton`'s `Shape`/`Variant`, `NoticeHandle`, `ProgressSegment`,
|
|
83
|
+
`OptionValue`, `SidebarFooterProps`, `TooltipTheme`, …
|
|
84
|
+
- **All of DatePicker** — the barrel exports zero DatePicker types: `DatePickerProps`,
|
|
85
|
+
`DateRangePickerProps`, `CalendarProps`, `DateRange`, `DateRangePreset`, `WeekStart`.
|
|
86
|
+
- **`SliderProps`**, which is missing entirely.
|
|
87
|
+
|
|
88
|
+
Also: `@tanstack/react-table` is a real dependency of TUI, not a peer, so it installs
|
|
89
|
+
automatically — but under pnpm it has no root symlink, so `ColumnDef` will not resolve from app
|
|
90
|
+
code. Use `DataTableProps<T>['columns']` instead.
|
|
91
|
+
|
|
92
|
+
## Naming conventions — so you don't guess
|
|
93
|
+
|
|
94
|
+
| Concern | Convention |
|
|
95
|
+
|---|---|
|
|
96
|
+
| value change | `onValueChange` (not `onChange`, except native HTML wrappers like Textarea) |
|
|
97
|
+
| boolean state | `onCheckedChange` (Checkbox, Switch) |
|
|
98
|
+
| floating panels | `open` / `defaultOpen` / `onOpenChange` |
|
|
99
|
+
| ARIA | kebab-case string props only — `'aria-label'`, never `ariaLabel` |
|
|
100
|
+
| size | `size?: 'sm' \| 'md' \| 'lg'` on form controls; Button/Icon/Chip use wider or narrower scales |
|
|
101
|
+
| `theme` | semantic colour — `primary`, `secondary`, `success`, `warning`, `danger`, `info`; the accepted subset varies (`ThemeIntent` on Button, `ThemeStatus` on Notice) |
|
|
102
|
+
| `variant` | visual treatment — `solid`, `outline`, `ghost`, `link` |
|
|
103
|
+
| `mode` | structural mode (Progress `line \| circle`, MoveHandle `full \| handle`) |
|
|
104
|
+
| classes | BEM-ish and stable: `tui-select__trigger`, `is-size-sm`, `is-disabled` |
|
|
105
|
+
|
|
106
|
+
Clearing a clearable control calls back with **`undefined`**, not `''`. Controlled-vs-uncontrolled
|
|
107
|
+
is locked at mount, so a `value` that becomes `undefined` does not silently flip the component to
|
|
108
|
+
uncontrolled — but your own state has to tolerate `undefined`.
|
|
109
|
+
|
|
110
|
+
Buttons take either `label` (simple text) or `children` (rich content).
|
|
111
|
+
|
|
112
|
+
## Wiring (each of these fails silently)
|
|
113
|
+
|
|
114
|
+
**1. `.tui-interface` is mandatory.** Every token is defined in one `:where(.tui-interface){…}`
|
|
115
|
+
block. Without that ancestor, components render with no design tokens at all.
|
|
116
|
+
|
|
117
|
+
**2. Portalled UI resolves its host from the trigger.** Modal, Select, Dropdown, Popover and
|
|
118
|
+
Tooltip portal via `getPortalRootFor(trigger)`, which walks **up from the trigger** to the nearest
|
|
119
|
+
`.tui-interface` and appends a portal root there. So a trigger inside your wrapper needs nothing.
|
|
120
|
+
The failure case is a trigger that has no `.tui-interface` ancestor: TUI then creates its own
|
|
121
|
+
body-level wrapper and *snapshots* `data-theme` from `<html>`/`<body>` once, at creation. It never
|
|
122
|
+
re-reads it, so a host that toggles theme after mount gets stale portalled content. Wrapping your
|
|
123
|
+
JSX does **not** fix a Modal rendered outside the tree — the dialog is not in that subtree.
|
|
124
|
+
|
|
125
|
+
Only **Modal** takes a `container` prop. If you need to place it yourself, create a body-level
|
|
126
|
+
`.tui-interface` div, keep `data-theme` live on it, and pass it as `container` — attaching in a
|
|
127
|
+
`useLayoutEffect`, because Modal resolves its container in a layout effect and focusing a detached
|
|
128
|
+
node silently does nothing. For the rest of the family, the fix is to put the *trigger* inside a
|
|
129
|
+
`.tui-interface`. `getPortalRootFor` is importable from `@tangible/ui/utils/portal` if you need to
|
|
130
|
+
resolve the same root yourself.
|
|
131
|
+
|
|
132
|
+
**3. Dark mode is `data-theme`, not a class.** TUI's palette is gated on `[data-theme="dark"]`
|
|
133
|
+
(`"auto"` follows `prefers-color-scheme`; absent means light and inherits the host's colour). A host
|
|
134
|
+
that toggles a `.dark` class (Tailwind's strategy) drives nothing in TUI. Translate it: observe what
|
|
135
|
+
is actually applied to the document — a `MutationObserver` on `<html>`'s `class` catches boot,
|
|
136
|
+
explicit toggles and OS changes alike — and mirror it onto your wrapper. Resolve to explicit
|
|
137
|
+
`light`/`dark` rather than TUI's `auto`, or an explicit light choice on a dark OS will be wrong.
|
|
138
|
+
|
|
139
|
+
**4. Pick the stylesheet by host.**
|
|
140
|
+
|
|
141
|
+
- Host with **its own CSS layers** (Tailwind v4, or any `@layer` author): `@tangible/ui/styles/unlayered`.
|
|
142
|
+
TUI declares `@layer resets, defaults, components, utilities` — `components` and `utilities`
|
|
143
|
+
collide with Tailwind's own names, layers merge across stylesheets, so bundle order would decide
|
|
144
|
+
cascade order for *both*. If TUI won that race, the host's preflight would sort after its own
|
|
145
|
+
utilities and start overriding them app-wide.
|
|
146
|
+
- **WordPress / unlayered theme CSS**: `@tangible/ui/styles/unlayered` too — layered CSS loses to
|
|
147
|
+
unlayered theme styles.
|
|
148
|
+
- Otherwise the default `@tangible/ui/styles`.
|
|
149
|
+
|
|
150
|
+
Consequence of unlayered: inside `.tui-interface`, TUI beats host utility classes. Style TUI
|
|
151
|
+
elements with `--tui-*` tokens and TUI utilities only — a host utility class there silently loses.
|
|
152
|
+
|
|
153
|
+
**5. Import the stylesheet once, app-wide** (entry or global CSS), not per component: `all.css` is
|
|
154
|
+
~270 kB raw / ~30 kB gzipped and lands in whichever chunk first reaches a component. Two ways down
|
|
155
|
+
if that matters: `@tangible/ui/styles/core` (~44 kB — tokens, resets, utilities, icon, no
|
|
156
|
+
components), or, if your build compiles Sass, the documented subset entry:
|
|
157
|
+
|
|
158
|
+
```scss
|
|
159
|
+
@use "@tangible/ui/styles/index" with (
|
|
160
|
+
$components: (button, checkbox, radio, notice, modal),
|
|
161
|
+
$layers: false
|
|
162
|
+
);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Labels and errors: `Field` composition
|
|
166
|
+
|
|
167
|
+
`Field` wires `id` / `aria-labelledby` / `aria-describedby` / `aria-invalid` / `aria-required`
|
|
168
|
+
onto its control by cloning it. Get the composition wrong and the control loses its accessible name
|
|
169
|
+
or its error — visually identical either way.
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
<Field error={!!err} required>
|
|
173
|
+
<Field.Label>Course</Field.Label> {/* MUST precede Field.Control */}
|
|
174
|
+
<Field.Control><Select …>…</Select></Field.Control>
|
|
175
|
+
<Field.HelperText>Pick one</Field.HelperText>
|
|
176
|
+
<Field.Error>{err}</Field.Error>
|
|
177
|
+
</Field>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Three rules, all of them silent when broken:
|
|
181
|
+
|
|
182
|
+
- **`Field.Label` before `Field.Control` in JSX.** `aria-labelledby` is injected only when a label
|
|
183
|
+
has already rendered — a phantom `aria-labelledby` would resolve to the empty string and strip
|
|
184
|
+
*all* other name sources (AccName 1.2 step 2B), so TUI withholds it rather than risk that. A dev
|
|
185
|
+
warning fires on the wrong order; production is just unlabelled.
|
|
186
|
+
- **Self-labelling controls omit `Field.Label` entirely.** Checkbox and Switch with their own
|
|
187
|
+
`label` prop already have a name; adding `Field.Label` makes AT concatenate both.
|
|
188
|
+
- **Group controls need `Field.Label as="span"`.** RadioGroup and SegmentedControl render
|
|
189
|
+
`role="radiogroup"` on a `<div>`, which is not a labelable element, so the default
|
|
190
|
+
`<label for>` dangles. The span keeps the id, so the `aria-labelledby` wiring is untouched.
|
|
191
|
+
|
|
192
|
+
Not every control accepts every injected attribute. `aria-required` is role-gated: the triggers that
|
|
193
|
+
are plain `<button aria-haspopup="dialog">` (SearchSelect, DatePicker, DateRangePicker) resolve to
|
|
194
|
+
`role="button"`, which does not allow it — axe flags `aria-allowed-attr`. TUI deliberately does not
|
|
195
|
+
declare it there; the requirement still reaches AT through `Field.Label`'s visually-hidden "required"
|
|
196
|
+
text. If axe reports `aria-allowed-attr` on a TUI trigger, it is TUI's to fix, not yours
|
|
197
|
+
(ColorField currently passes it through — verified Aug 22 2026, not yet filed).
|
|
198
|
+
|
|
199
|
+
## Customising
|
|
200
|
+
|
|
201
|
+
Tokens, not class overrides. Four layers, and you only touch two:
|
|
202
|
+
|
|
203
|
+
```css
|
|
204
|
+
/* Primitives — the theme contract. Set on .tui-interface or any ancestor. */
|
|
205
|
+
.tui-interface { --tui-radius-md: 2px; --tui-focus-ring-color: hotpink; }
|
|
206
|
+
|
|
207
|
+
/* Component API — never defined by TUI, only read. Set anywhere that wins. */
|
|
208
|
+
.compact-form { --tui-select-trigger-radius: 2px; --tui-accordion-padding: 8px; }
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`--_*` is component-private and `$_*` compiles away; neither is yours to set. Names come from
|
|
212
|
+
`tui-manifest.json` → `cssTokens`.
|
|
213
|
+
|
|
214
|
+
Useful primitives:
|
|
215
|
+
|
|
216
|
+
- Surfaces / text: `--tui-color-bg`, `-bg-surface`, `-bg-elevated`, `-bg-muted`, `-bg-inverted`,
|
|
217
|
+
`--tui-color-fg`, `-fg-secondary`, `-fg-muted`, `-fg-on-accent`, `--tui-color-border`,
|
|
218
|
+
`--tui-color-divider`, `--tui-color-fill{,-subtle,-strong}`, `--tui-color-focus-ring`.
|
|
219
|
+
- Themes: `--tui-theme-{primary,secondary,success,warning,danger,info}-{subtlest,subtle,soft,base,strong,stronger,strongest}`.
|
|
220
|
+
The ladder is **contrast-based** — "stronger" always means more contrast against the current
|
|
221
|
+
background, so a single choice reads correctly in both light and dark mode.
|
|
222
|
+
- Control heights, shared by every form control *and* Button / IconButton / SegmentedControl /
|
|
223
|
+
Pager: `--tui-control-height-{sm,md,lg}` (32 / 40 / 48px, plus an `xs` at 24px that only
|
|
224
|
+
Button / IconButton / SegmentedControl offer — there is no `xs` form-control tier). Add
|
|
225
|
+
`--tui-control-font-size-{sm,md,lg}` to decouple type size from the height tier. One override
|
|
226
|
+
normalises a whole host context at once.
|
|
227
|
+
|
|
228
|
+
`className` is for layout integration (margin, grid placement), not appearance. Beyond the token
|
|
229
|
+
API the sanctioned escape hatch is to **swizzle** — copy the component source and own the fork.
|
|
230
|
+
|
|
231
|
+
## Component names, and what isn't there
|
|
232
|
+
|
|
233
|
+
43 components. If you are hunting for a name: **Alert → `Notice`**, **Menu → `Dropdown`**,
|
|
234
|
+
**Table → `DataTable`**, **Pagination → `Pager`**, **Drawer → `Sidebar`** (drawer mode),
|
|
235
|
+
**Badge → `Chip`** or `ContentIndicator`, **Spinner → `Progress`** or `Button loading`.
|
|
236
|
+
No Toast/Snackbar, no Breadcrumb, no Skeleton, and no time picker — `DatePicker` and
|
|
237
|
+
`DateRangePicker` are dates only.
|
|
238
|
+
|
|
239
|
+
Two clusters are easy to pick wrong:
|
|
240
|
+
|
|
241
|
+
- **Chip family** — `Chip` is one chip. `ChipGroup` is a *selectable* set with radio/checkbox
|
|
242
|
+
semantics (`value` / `onValueChange` / `multiple`). `Chips` is a *display* list rendered from a
|
|
243
|
+
`ChipOption[]` array, with link support and no selection.
|
|
244
|
+
- **Select family** — `Select` (single, not typeable), `Combobox` (single, the input *is* the
|
|
245
|
+
trigger, you own the filtering via `inputValue`/`onInputChange`), `SearchSelect` (single, a button
|
|
246
|
+
trigger with the search field *inside* the panel), `MultiSelect` (multi, button trigger, count or
|
|
247
|
+
chips in the trigger), `MultiCombobox` (multi, free-typing token field). All five share one
|
|
248
|
+
listbox engine, so navigation and ARIA behave identically; the trigger is the choice.
|
|
249
|
+
|
|
250
|
+
Icons are a registry, six sets, 237 entries (Aug 22 2026): `system` (99), `lms` (44), `reaction`
|
|
251
|
+
(36), `player` (24), `membersync` (22), `cred` (12). `@tangible/ui/icons/manifest` is the
|
|
252
|
+
machine-readable list.
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
<Icon name="system/check" /> {/* decorative — hidden from AT automatically */}
|
|
256
|
+
<Icon name="system/lock" label="Locked" /> {/* informative — label makes it announced */}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
There are no device icons (monitor / tablet / phone) in any set.
|
|
260
|
+
|
|
261
|
+
## Testing hooks
|
|
262
|
+
|
|
263
|
+
`data-testid` pass-through is uneven, and the split is not the one you would guess. These spread
|
|
264
|
+
rest props onto their primary element: **Button, Card, Checkbox, Chip, ColorPicker, ColorField,
|
|
265
|
+
`Field`'s slots, GradientPicker, IconButton, Modal, Notice, SearchInput, SearchSelect, Switch,
|
|
266
|
+
Textarea, TextInput**, and **DataTable** (onto the `<table>`). Everything else drops them silently,
|
|
267
|
+
including several that look like they would take them — Dropdown, Popover, Tooltip, Select,
|
|
268
|
+
MultiSelect, Combobox, MultiCombobox, Tabs, Sidebar, Toolbar, Pager, Radio, Rating, Progress,
|
|
269
|
+
Avatar, Icon, Slider, MoveHandle, StepList, SegmentedControl, DatePicker.
|
|
270
|
+
|
|
271
|
+
Typecheck will not save you here: TypeScript exempts **hyphenated** JSX attributes from excess
|
|
272
|
+
property checking, so `<Select data-testid="x" />` compiles clean against a prop type that has no
|
|
273
|
+
such prop and then never reaches the DOM. (Same mechanism makes `aria-hidden` on `<Icon>` a silent
|
|
274
|
+
no-op — `Icon` neither declares nor spreads it. Icons are decorative by default; that is what the
|
|
275
|
+
missing `label` already means.) A misspelled *non*-hyphenated prop does error, and `IconName` is a
|
|
276
|
+
literal union, so `<Icon name="system/typo" />` fails the build.
|
|
277
|
+
|
|
278
|
+
The check, since that list will drift: grep the component's built file in
|
|
279
|
+
`node_modules/@tangible/ui/components/<Dir>/` for `...rest`. If it isn't there, target the stable
|
|
280
|
+
class (`tui-select__trigger`) or the ARIA role instead.
|
|
281
|
+
|
|
282
|
+
DataTable rows are the exception worth knowing: per-row props go through `getRowProps(row)` —
|
|
283
|
+
`data-testid`, refs, `tabIndex`, handlers — and it composes with controlled pagination
|
|
284
|
+
(`pageIndex` / `onPageIndexChange`, 0-based).
|
|
285
|
+
|
|
286
|
+
One live trap there: **memoize `data`, or pass `autoResetPageIndex={false}`.** A derived array gets
|
|
287
|
+
a new identity every render, TanStack queues a page-0 reset on every `data` identity change, and
|
|
288
|
+
with a controlled `pageIndex` that races your parent back to page 0 permanently.
|
|
289
|
+
|
|
290
|
+
## Known issues
|
|
291
|
+
|
|
292
|
+
Each is tracked in the repo, so **follow the link for current state rather than trusting this
|
|
293
|
+
list** — an issue closes on its own, a bullet here does not. This section used to enumerate bugs
|
|
294
|
+
inline and went stale within a week; one of its entries turned out never to reproduce at all.
|
|
295
|
+
Re-verify before you work around anything.
|
|
296
|
+
|
|
297
|
+
- **`DateRangePicker` cannot express an open-ended range** — Apply is inert unless *both* endpoints
|
|
298
|
+
are set, so "starts now, no end date" is unreachable.
|
|
299
|
+
([#86](https://github.com/TangibleInc/tangible-ui/issues/86))
|
|
300
|
+
- **`tui-manifest.json` is lossy** — see "Where the API lives" above for the shape of it.
|
|
301
|
+
([#87](https://github.com/TangibleInc/tangible-ui/issues/87))
|
|
302
|
+
- **Two `.tui-interface` wrappers can end up sharing one portal root** — `reconcileFallback()`
|
|
303
|
+
adopts a stranded root into the *first* interface in document order. Most likely to fire in
|
|
304
|
+
exactly the apps that hit the portal wiring above, since a portal created before any interface is
|
|
305
|
+
in the DOM is what strands a root in the first place.
|
|
306
|
+
([#88](https://github.com/TangibleInc/tangible-ui/issues/88))
|
|
307
|
+
|
|
308
|
+
## Verify
|
|
309
|
+
|
|
310
|
+
`tsc --noEmit` catches guessed props immediately — TUI ships types, and most unions are literal.
|
|
311
|
+
It cannot see any of the wiring above.
|
|
312
|
+
|
|
313
|
+
What typecheck misses, in the order it bites:
|
|
314
|
+
|
|
315
|
+
1. Open a portalled component (Modal or Select) **in dark mode**. That single check exercises the
|
|
316
|
+
portal host, the theme bridge and the token scope at once — it is where all three break.
|
|
317
|
+
2. Tab to each control and confirm the accessible name and the error text are announced (the
|
|
318
|
+
`Field` rules above). A browser a11y inspector or axe is enough; both failures are invisible.
|
|
319
|
+
3. Narrow the layout. `Card`, `Notice` and `Pager` respond to their **container**, not the
|
|
320
|
+
viewport, so shrinking the window proves nothing if they sit in a fixed-width parent — resize
|
|
321
|
+
the parent instead.
|
|
322
|
+
|
|
323
|
+
## Reference consumers
|
|
324
|
+
|
|
325
|
+
`tangible-autism-certify` (graded A — the reference), `tangible-cron-manager-pro`,
|
|
326
|
+
`tangible-datastream`, `tangible-searchsync` — all WordPress plugins on roller with `react: 'wp'`
|
|
327
|
+
(React 18). `tangible-app` is the first React 19 consumer, so React 19 incompatibilities surface
|
|
328
|
+
there first. Read one before inventing a pattern.
|