Principles
The rules the library is built on.
Six rules. Everything in the library follows from them, and anything added later has to fit.
1. No runtime dependencies
There is no dependencies list, and no package to have one. React is assumed, because a component library cannot ship React and has no business owning your copy.
Everything a component library usually installs is written here instead:
| Usual dependency | What this library does | Cost |
| --- | --- | --- |
| clsx | internal/cx.ts | 8 lines |
| Focus trap library | internal/focus.ts | ~115 lines |
| Scroll lock library | useScrollLock | 30 lines |
| Controlled-state helper | useControllableState | 34 lines |
| Field/ARIA wiring | internal/Field.tsx | 87 lines |
This is not a purity contest. It is a bet that the parts of a UI library that are genuinely hard are accessibility semantics and keyboard behaviour, and those live in your platform — native <input>, <select>, <fieldset>, and the ARIA contract — not in a package.
2. Readable beats clever
Every file in src/internal should be comprehensible in one pass, without a comment explaining what the code is doing (comments explain why).
A helper earns its place by removing a real duplication. cx exists because
every component joins class names conditionally.
A helper exists because it might be useful later. Speculative abstraction is why so-called dependency-free libraries end up with a 400-line utils folder.
3. Native first
The controls are real HTML elements with the browser's behaviour intact:
Checkbox,Radio, andSwitchare<input>elements withappearance: none. The visual is replaced; the semantics, form participation, focus behaviour, and space-bar activation are not.Selectis a real<select>. Reimplementing a select to style a dropdown is how libraries lose type-ahead, mobile pickers, and<optgroup>.Tabsis buttons androle="tablist"with a roving tabindex — the one ARIA pattern that genuinely requires JavaScript, and it is ~40 lines.Dialogneeds a portal, a focus trap, and a scroll lock. That is the one component here with real machinery, and it is written to be read.
The payoff: you inherit the browser's accessibility work rather than reimplementing it with a <div> and a pile of handlers.
4. Boxy, and enforced
--fr-radius is 0, every component uses that token, and no component overrides it. Edges are 1px rules; the one shadow has no blur.
This is a design decision with a maintenance consequence: because geometry comes from one token, a component cannot quietly drift from the system. If a new component needs a second radius token, it does not belong in the library.
5. Colour follows function
Paper, ink, and exactly one accent. Emerald fills the primary action on a view, and every other use of it steps back: focus rings are ink on a primary button, and the active nav item is marked by weight and an accent rule.
Every meaning carried by colour is also carried by shape or text. See Color for the contrast table and the rule in full.
6. Accessible by construction, not by documentation
Accessibility is not a section at the bottom of a component page. It is the reason the component APIs look the way they do:
Inputrequires alabel. There is no prop that removes the accessible name; hiding it is a visual choice (hideLabel), not a semantic one.- Passing
errorsetsaria-invalid, links the message witharia-describedby, and renders it in arole="alert". Tabsimplements the full keyboard contract: arrows, Home, End, and a roving tabindex.Dialogtraps focus, restores it to the trigger, and closes on Escape.- Focus is visible and square on every interactive element: a 2px ring at 2px offset, in the accent, or in ink where the element is already filled with the accent.
What this library is not
Being explicit about scope is part of the design:
- Not a design system for your brand. Override tokens; expect to change colours and a font. Do not expect component variants for every case.
- Not a full ARIA widget suite. No combobox, no date picker, no data grid. Those need more machinery than a readable library can carry, and usually a real dependency.
- Not a package. There is no import specifier to add to a manifest, so there is no tree-shaking story and no per-component build matrix. You copy the components you use.
- Not backward-compatible with React 18.
refas a plain prop,useIdsemantics, and the portal behaviour this depends on are React 19 behaviours. There is noforwardRefin the source and no fallback for it.