ui · reference

read me first every example on this page is rendered by ui.css itself — the markup pane under each one is that example's own DOM, read back out.

foundation

Use

A semantic component stylesheet in the spirit of DaisyUI, but pure CSS on custom properties. ui.css is the whole library: no build step, no framework dependency, no network requests.

<html class="ui">
  <link rel="stylesheet" href="https://gigantic.dev/ui/ui.css" />

.ui is the opt-in base layer: page background, ink, font stack, box-sizing, focus ring. Omit it and only the components style themselves — safe for dropping the library into a page that already has opinions. Put it on <body> rather than <html> when anything reads body's background — see two rules that bite.

State is .is-* or an ARIA attribute, never both for the same fact. The classes are .is-active, .is-busy, .is-collapsed, .is-current, .is-down, .is-muted, .is-on, .is-paused and .is-warned; the attributes, where one exists, are [aria-pressed], [aria-current], [aria-disabled], [aria-invalid] and :disabled.

The component names are the documentation; everything else is discoverable by reading ui.css: layout and type sit in its base layer, every other family in its components layer under a /* ── name ── */ banner — related families share one (chip with the status dot; code, kbd and metric with the readout).

MIT © 2026 Joshua Geschwendt — full text in LICENSE. The vendored Phosphor glyphs carry their own MIT notice in icons/LICENSE; both travel with the files.

foundation

Tokens

Every colour, size and duration in the library is a custom property on :root. Nothing else is configuration — retinting the library means overriding tokens, never rules.

Palette

the roles, in the theme you are reading
--ui-bg
--ui-surface
--ui-sunken
--ui-border
--ui-border-strong
--ui-fg
--ui-fg-muted
--ui-fg-faint
--ui-accent
--ui-accent-soft
--ui-ok
--ui-warn
--ui-warn-ink
--ui-danger
--ui-info

The token contract

Light is the ground truth: every token has its definition on bare :root, and the dark blocks only reassign. A token defined only inside a dark block is undefined for a light viewer.

grouptokenslight → dark
surfaces --ui-bg --ui-surface --ui-surface-raised --ui-sunken --ui-border --ui-border-strong #ffffff → #08090a
ink --ui-fg --ui-fg-muted --ui-fg-faint --ui-fg-inverse #141c15 → #ece7db
accent --ui-accent -hover -active -fg -soft -soft-fg -ring sage #476349 → brass #cfa14d
status --ui-ok --ui-warn --ui-warn-ink --ui-danger --ui-info, each with a -soft five hues, and only five
type --ui-font-sans --ui-font-mono --ui-text-2xs…2xl --ui-weight-* --ui-leading-* --ui-tracking-* identical in both
metrics --ui-space-1…7 (4·8·12·16·24·32·48px), --ui-radius-sm|md|lg|full identical in both
depth --ui-shadow-sm|md|lg --ui-glow --ui-glow: none → a brass halo
motion --ui-fast (110ms) --ui-slow (240ms) --ui-ease identical in both

Per-component hooks

Set these inline or in a wrapper rule; they are the only knobs a component reads that the palette does not supply.

propertyread bydefault
--ui-container[data-container] max width100rem
--ui-grid-min[data-grid] column floor280px
--ui-icon-size.icon1.15em
--ui-meter-value.meter fill0%
--ui-orb-size.orb34px
--ui-panel-accent.panel head rail and nameunset: no rail, --ui-fg name

foundation

Token reference

Every --ui-* token the library declares on :root, one row each, light beside dark — the per-component hooks are in the hooks table above. The rows are parsed out of ui.css when this page loads — the same stylesheet the page is wearing — so the reference cannot drift from the tokens it documents.

Swatches are painted from the parsed literal, not through var(): the light column stays light while you read this in dark. A dark cell shown dim is a token the dark blocks never reassign — the light value is the dark value.

tokenlightdark
reading ui.css…

foundation

Theming

Light is white and green; dark is black and gold. Both are first-class, and a manual toggle wins over the system in both directions.

selectorwins over
:root— light is the ground truth; every token is defined here
@media (prefers-color-scheme: dark) :root:not([data-theme="light"])the system default
:root[data-theme="dark"]a light system

data-theme="light" needs no block of its own: it switches the dark media block off, and bare :root is light.

Three selectors in resolution order, :root, prefers-color-scheme: dark (unless data-theme="light") and :root[data-theme="dark"], then the Sage and Brass themes side by side as token swatches with their hex values.
The two themes token by token, and the order that picks one: :root is Sage, the system's dark is Brass, and data-theme overrides both. Source: Claude Design canvas ui figures, board Themes.

That is the whole contract. The toggle in this page's appbar is exactly it — three buttons writing (or removing) one attribute:

document.documentElement.dataset.theme = "dark";   // explicit
document.documentElement.removeAttribute("data-theme");  // back to the system

color-scheme is set alongside, so native form controls, scrollbars and Highlight follow.

Retheming

Override tokens, not rules. The accent is the seven --ui-accent* tokens; set each theme you retint. --ui-ok and --ui-ok-soft match light's sage by value, not by reference, and dark's --ui-glow is brass — restate them if they should follow the new accent. Declare the overrides in ui.tokens (components.ui.tokens under the Tailwind import), after ui.css: an unlayered :root, or a layer ordered after them, beats both theme blocks and paints the light values into dark.

@layer ui.tokens {
  :root { --ui-accent: #7c3aed; --ui-accent-soft: #f1eafe; /* …the other five */ }
  :root[data-theme="dark"] { /* the dark set */ }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { /* the same */ } }
}

Bring your own hues, in our shape

The library ships five semantic hues and that is the whole vocabulary, on purpose: once --ui-danger means "series 4", nothing on the page can mean danger any more. Declare your own tokens under your own prefix and feed them to the --ui-* hooks.

three panels, three hues that are not the library's
ears
--plot-ears
mouth
--plot-mouth
wire
--plot-wire

Two rules keep it honest: never redefine a --ui-* token to mean something non-semantic, and check your hues against --ui-bg in both themes — the library's contrast measurements say nothing about colours it has never seen.

Sage and brass

Two voices, one per theme. Sage carries light mode: grey-leaning and dried-herb, hue 124 at 28% saturation, nothing like emerald. #476349 is the accent and --ui-ok both; #eaefe9 is its tint. The light neutrals carry the same faint sage cast, a hair warmer and greyer than before, so the surfaces sit underneath the accent instead of arguing with it.

Brass carries dark mode, taken from the orrery atlas: #cfa14d. It is the accent and nothing else. Warn used to be brass too — gold was that theme's whole voice and a warning read as emphasis — but a warning that is indistinguishable from the accent cannot warn, so warn moved to orange: #f5893a in dark, #c86a17 in light. Hue 25–28 against brass's 39, at 90% saturation against brass's 58, and far enough from danger's red (hue 4 dark, 358 light) to stay its own signal. Dark --ui-ok is the sage lifted to #8fae94 and luminance-matched to brass (8.2 vs 8.4 on --ui-bg), so the green and the gold never fight for the eye.

Measured: sage on white 6.7:1, on its own tint 5.7:1, white-on-sage 6.7:1; brass on --ui-bg 8.4:1, #ddb56b (hover, and the ink for soft-tinted pills) 10.3:1, ink-on-brass 8.0:1. Every accent pairing clears AA.

Light-mode #c86a17 reads 3.8:1 on white (3.4:1 on its tint, 3.7:1 on --ui-surface, 3.4:1 on --ui-sunken) — sound for borders, dots and meter fills, under AA for small text. That is what --ui-warn-ink is for: #9c500f, the same orange darkened, at 5.9:1 on white and 5.3:1 on --ui-warn-soft (5.7:1 on --ui-surface, 5.3:1 on --ui-sunken). Every light-mode warn text colour — .pill-warn, .badge-warn, .chip-warn's value, .strip-warn, and .is-warned's row name — is drawn in the ink, while backgrounds, borders and fills keep --ui-warn. In dark mode the ink aliases straight back to warn: #f5893a is 8.1:1 on --ui-bg, 7.7:1 on --ui-surface, and 6.8:1 on its own tint, so one value carries fill and sentence both. A light-mode warn can carry a sentence, and the standing contrast exception stays closed.

Two rules that bite

On <html>, <body> stays transparent. CSS propagates the root element's background to the canvas, which paints the viewport correctly, but body's computed background stays rgba(0, 0, 0, 0) (html still reports --ui-bg; only where it paints moves). Anything reading body's background — a nested scroll container, a screenshot tool, an embedded widget — sees nothing. Put .ui on <body> instead, or set body { background: var(--ui-bg); } alongside it.

[hidden] is guarded in the base layer — :where([hidden]:not([hidden="until-found"])) { display: none !important; } — because components set display and a component class beats the UA's rule. Without the guard, el.hidden = true silently does nothing on a pill, a panel or a strip.

foundation

The reset

.ui carries a small modern reset — the Andy Bell / Josh Comeau line, adapted. It corrects the UA where the UA is wrong for a layout engine, and stops.

rulewhy
margin: 0 on blockquote, body (under .ui or carrying it), dd, dl, figure, h1–h6, p, preUA margins are vertical rhythm from a document engine; here spacing belongs to .stack, .row, [data-grid] and the components' own padding
list-style: none; padding-left: 0 on ol[role="list"], ul[role="list"]lists opt out by saying so
display: block; max-width: 100% on canvas, img, picture, svg, videoreplaced elements are boxes, not letters — no baseline gap, no overflow
font: inherit on button, input, select, textareacontrols opt out of inheritance for historical reasons only
cursor: pointer on button
overflow-wrap: break-word on h1–h6, pa URL or a device id must not widen the page
prefers-reduced-motion: reduce → near-zero animation and transition durations, scroll-behavior: autothe preference is a request to stop moving, not to stop three named animations. Near-zero rather than none, so transitionend still fires and code awaiting one does not hang

Every element rule is wrapped in :where(), so it carries specificity zero: components override it by living in a later layer, and a consumer overrides it with any selector at all. Two consequences worth knowing:

  • A component must own its own leading if it sizes off it. font: inherit hands a control the body's line-height, not the UA's normal — which is why .btn, .segmented > button, .input, .select and .textarea each declare a line-height. A new control that does not will be about four pixels taller than its neighbours.
  • A percentage max-width contributes nothing to a flex parent's max-content width. An inline sparkline <canvas> with a fixed pixel width inside a content-sized flex row needs max-width: none back, or the row sizes short.

Why not Preflight

Tailwind's Preflight is a global reset for a utility-first world where every element is expected to be dressed by classes. This library is semantic and opt-in, and three things follow:

  • Scoped, not global. Nothing here applies without .ui on an ancestor. Drop the class and the page gets the UA back whole — which is the same promise the rest of the base layer makes.
  • Semantic elements keep their meaning. Preflight unstyles <ul>, <ol>, <h1> and <button> down to nothing. A bare <ul> here keeps its indent and its bullets, a bare <button> still looks like a button, and headings keep their size — a semantic library whose bare markup lies is worse than no library. Removing list markers is a decision the markup makes with role="list".
  • No double reset. Loading ui.css next to Tailwind gives you Preflight and this, and the two disagree about <ul> and <button>. Imported into Tailwind's components layer, every ui layer sorts after Preflight's base, so the classed components keep their padding, margins and borders. Bare markup is another matter: the scoped reset leaves lists, heading sizes and <button> chrome to the UA rather than restating them, so Preflight still strips those, inside .ui too. If you own the Tailwind config, disabling Preflight leaves the scoped reset as the only one. See Tailwind.

foundation

Type

Class-based, not element-based: the heading level is the document's business, the size is the design's.

the whole scale

eyebrow

Heading one

Heading two

Heading three

A lead paragraph carries the sentence a section opens on.

Body copy is the default — no class needed inside .ui.

Muted copy steps back one notch.

Faint copy steps back two, and must not carry meaning alone.

mono 00:12.401 · seq 1041

A link inside a sentence.

classis
.h1 .h2 .h3the display scale, independent of h1…h6
.eyebrowsmall caps label above a heading
.leadthe opening sentence, one step up from body
.muted--ui-fg-muted — still AA
.faint--ui-fg-faint — decoration, never the only carrier
.monothe mono stack at body size
.linkan accented, underlined anchor

foundation

Layout

A handful of primitives, no grid system. Anything more specific than these belongs to the page, not the library.

row, stack, data-grid, spacer, rule
a row wraps a spacer pushed this

grid cell
grid cell
grid cell
classis
.rowwrapping flex row, centred cross-axis
.stackvertical flow with one gap
.spacerflex: 1 — pushes what follows to the end
.hra one-token rule

Layout primitives (attributes)

Three names — grid, container, table — are also names Tailwind claims as utilities. Rather than rename them or prefix the library, they are carried as data attributes: Tailwind never emits an attribute selector, so the collision is impossible by construction, the names survive, and specificity is unchanged (0,1,0 either way). The rule: a layout primitive Tailwind also claims is an attribute; a component is a class.

attributeis
[data-container]centred, max --ui-container, gutters
[data-grid]auto-fit columns with a --ui-grid-min floor
[data-table]the table skin — documented under Table
<main data-container>
  <div data-grid style="--ui-grid-min: 340px">…</div>
  <table data-table class="table-hover">…</table>
</main>

The --ui-container / --ui-grid-min hooks keep working. Every other component stays a class, including the table modifiers (.table-hover, .table-mono, .table-num, .table-wrap), which Tailwind does not claim.

controls

Button

One base class and a modifier for the job. Sizes are orthogonal to variants, and a latched button is .is-on — never a second variant class.

variants
outline
sizes, icon-only, disabled
group, latched — click one
classis
.btnthe base — always present
.btn-primaryfilled accent; one per view
.btn-dangerfilled danger, for a destructive commit
.btn-ghosttransparent until hover — for a row’s own actions
.btn-quietsunken fill, muted ink — the toolbar default
.btn-outline+ -accent -info
.btn-sm .btn-lgsizes; combine with any variant
.btn-iconsquare; needs an aria-label
.btn-groupjoins buttons into one control
.is-onlatched. Not aria-pressed as well — one fact, one carrier

controls

Inputs & selects

A field is a label, a control and an optional hint. Validity is aria-invalid, because the attribute already exists.

On iOS only, every control here is floored at 16px — Safari zooms the viewport in on a focused field under that and never zooms back out — so the compact sizes below stay compact everywhere the zoom cannot happen.

field, hint, invalid
Shown in the ledger and nowhere else.
Expected a number.
sizes and the mono/numeric inputs
select and textarea
classis
.fieldthe label / control / hint stack
.labelthe control's name
.hintthe sentence under it
.input+ -sm -lg -mono -num (tabular, right-aligned) -invalid
.select+ -sm; caret drawn, gutter reserved
.textareathe same skin, resizable
[aria-invalid]the danger ring — prefer it to .input-invalid

The iOS floor

Safari on iOS zooms the viewport in whenever it focuses a form control computing under 16px, and it does not zoom back out — one tap on a toolbar filter leaves the page magnified. The compact scale is entirely under that line: with .ui on the root the rem tokens resolve against --ui-text-md, so the controls measure 10.5px (-sm), 11.375px (.input, .select, .textarea) and 14px (.input-lg). So ui.css carries an iOS-only floor:

@supports (-webkit-touch-callout: none) {
  .input, .input-lg, .input-sm, .select, .select-sm, .textarea { font-size: 16px; }
}

-webkit-touch-callout is WebKit-on-iOS and nothing else, which is the point: the compact scale is untouched everywhere the zoom cannot happen. The two usual fixes are worse — maximum-scale=1 in the viewport meta buys it by taking pinch-zoom away from everyone, and a blanket 16px inflates every toolbar on desktop. The content-sized widths (.input-num's 8ch, .select-sm's auto) grow with the text on iOS instead of clipping it. A new control with its own font-size belongs in that block too.

controls

Toggle & segmented

A toggle wraps a real checkbox, so it is focusable, form-serialisable and keyboard-operable with no script at all.

toggle
segmented — exclusive choice, aria-pressed carries it

The appbar's theme control is a segmented group — its three buttons are the entire theming API.

status

Pill, badge, chip, dot

Four shapes for four jobs. A pill is a state, a badge is a count or a tag, a chip is a labelled value, a dot is a light.

pill — a state, with or without a dot
neutral accent connected 3 gaps wire down fixture active
badge — a count or a tag
12 new pass deg 4 v2
chip — a label and its value, the value in <b>
wpm 172 eot p50 412ms drift +38ms drops 2
dot — a light, pulsing while live
idle live degraded down replay
classmoodsuse for
.pill-accent -danger -info -ok -warna state; .is-active for the current one
.badge-accent -danger -info -ok -warna count or a short tag
.chip-danger -ok -warna labelled value; .chip-row groups them
.dot-danger -info -ok -warna light; .dot-pulse while live

Inside .ui, .dot-pulse stops under prefers-reduced-motion, so the dot must never be the only carrier of "live" — pair it with a word, as every example above does.

status

Notice

Boxed, rounded, wraps, lives inside a layout. A notice is content; the bar across the top of the window is a strip.

the four moods, each with its glyph
Replaying a fixture. Nothing you click reaches the live loop.
Contract satisfied — every sequence number accounted for.
3 gaps in the ears channel.
Wire closed after 1 attempt. The loop is not running.
classis
.noticeneutral box; an icon and a <span> inside
+ -danger -info -ok -warntint, border and rail

status

Strip

Chrome: full-bleed, one line, small mono. It belongs directly under .appbar as a sibling — outside [data-container], so it spans the viewport.

every mood (boxed here only so the page can show them together)
wirewaiting for the stream…
wireconnected · 8 channels
sourcereplaying fixture kitchen-evening.jsonl
modebridge · Claude has the floor
gaps3 missing sequence numbers on ears
wireclosed after 1 attempt — the loop is not running

A strip does not survive el.className = "strip-warn". Wholesale assignment drops .strip itself, and a mood modifier alone styles nothing, so the bar collapses to unstyled text. Toggle the mood class:

strip.classList.remove("strip-ok", "strip-warn");
strip.classList.add("strip-danger");
classis
.stripthe bar; display: flex
.strip-tagthe channel name at the left
.strip-msgthe sentence; truncates rather than wraps
+ -accent -danger -info -ok -warnthe mood

status

Meter

One track, one fill, one custom property. The value is CSS, not a width attribute, so a page can drive it from a rule as easily as from script.

the first one is live

The single child <span> is the fill and is required — the track cannot paint itself and animate at once. Set the value with el.style.setProperty("--ui-meter-value", pct + "%").

classis
.meterthe track; accent fill
+ -warn -dangerthe fill's mood

status

Metric & readout

A metric is one number a human reads at a glance. A readout is a log a human reads a line at a time — mono, pre-wrapped, with keys and timestamps tinted.

metric — value, label, and a delta that says which way is good
172 words / minute
−38ms first-audio
+2 dropped frames

-delta-up means better, not larger: latency falling by 38 ms is an up-delta. The direction is the judgement, which is the only thing a colour can usefully carry.

readout — a wire log
00:12.401 ears.partial  "set the kitchen light to"
00:12.688 eot.head      p=0.41 head=prosody
00:13.002 ears.final    "set the kitchen light to forty"
00:13.117 policy.speak  allow reason=turn-yielded
classis
.metricthe tile
.metric-valuethe number, tabular
.metric-labelwhat it counts
.metric-delta-up / -downbetter / worse, not larger / smaller
.readouta <pre>; keeps its own newlines
.readout-keythe event name
.readout-tthe timestamp

status

Orb

The microphone. One button, two states, and the muted state is legible without colour — a slash crosses it.

click it — open ⇄ muted
classis
.orbthe button; size from --ui-orb-size
.orb-ringthe halo that breathes while open
.orb-slashdrawn only under .is-muted
.is-mutedmuted; mirror it into aria-pressed and the label

surfaces

Card

A box with an optional head and foot. Content the page owns — as opposed to a panel, which frames a channel.

head, body, foot — and the hoverable variant

Voice roster

28
The body takes the padding; a .stack on it takes the rhythm.
28 advertised · 4 shown

hoverable

Lifts on hover. Use it only when the whole card is a target.

classis
.cardthe surface
.card-heada flex row; a .spacer pushes trailing controls
.card-bodythe padded content
.card-foota sunken row for hints and actions
.card-hoverablelifts on hover

surfaces

Panel

The instrument frame: a named head with a coloured rail, and a body. Its hue is --ui-panel-accent, which is where a page's own channel colours enter the library; unset, the rail is transparent and the name plain ink.

name, sub, trailing controls

ears

transcription 418
The body is a plain block; give it .stack when its children need rhythm.

.panel-name is styling, not structure. When the head is the document's heading, use a heading class instead and let the element carry the outline — the panel does not care which:

the head as a real heading, and the wide variant

Voices

click a row to audition 28
.panel-wide spans every column of an enclosing [data-grid].
classis
.panelthe frame; a flex column
.panel-headthe named bar, with the accent rail
.panel-namethe channel name, in the accent
.panel-subthe qualifier beside it
.panel-bodythe content
.panel-widegrid-column: 1 / -1 — works on a card too

surfaces

Appbar

The window's top edge: title, nav, and whatever status the page owes at all times. This page is wearing one.

title · nav · spacer · status
ra · the loop live 1041

The current page is both .is-active and aria-current="page" — that is the one place the library asks for both, because the class styles a pill the attribute cannot reach on its own.

collections

List & listrow

Sized for the inside of a panel. The left rail carries selection, so a current row never changes size, and actions stay hidden until the row is reachable.

click a row · hover for its actions
voices5

Use a <button> (or set role="option" with aria-selected) so the row is reachable by keyboard. Actions are revealed on hover, focus, focus-within and .is-current, which keeps a long list from reading as a wall of buttons.

classis
.listthe container
.listrowa row: name, meta, actions
.is-currentfills the row and promotes the meta from faint to muted ink — faint loses AA against a tint
.is-busypulses; stops under prefers-reduced-motion inside .ui
.is-warnedrail and name only — it deliberately does not fill, because two tints in one list read as one muddled emphasis and selection owns the tint. The split was forced when warn and accent were the same brass in dark; warn is orange now, and the split is kept because it was right on its own terms

collections

Table

A real <table>, styled. Column behaviour is per-cell: mono, numeric, or allowed to wrap.

hover rows, mono keys, numeric columns
voicelocalewpmwarmstate
af_hearten-US1720.4 sresident
am_michaelen-US1641.9 scold
bf_emmaen-GB1582.1 sevicted
bm_georgeen-GB151—missing
nameonis
[data-table]tablethe skin — an attribute, not a class; see layout primitives
.table-hovertablerow hover tint — only when a row is a target
.table-wrapwrapperscrolls the table sideways instead of the page
.table-monocellthe mono stack — ids, voices, hashes
.table-numcelltabular figures, right-aligned

collections

Transcript

Turns, and words with a confidence state. A streaming recogniser revises what it already said, so a word carries whether it is settled, still moving, or withdrawn.

two turns, three word states
owner · 00:12.4

set the kitchen light to forty fourteen

ra · 00:13.9

Kitchen light at forty percent.

classis
.transcriptthe scroll
.transcript-turn+ -self -agent
.transcript-whospeaker and time
.transcript-textthe words
.word-stablesettled — will not be revised
.word-tentativestill moving
.word-ghostretracted — struck, kept visible

details

Icon

A 28-glyph Phosphor subset, regular weight, vendored. Nothing is fetched at runtime.

sizes, and inheritance of currentColor

Inline the sprite once per document. An external <use href="file.svg#id"> does not resolve over file:// and costs a request over HTTP — which is one reason this repo ships a server.

<body>
  <!-- paste icons/sprite.svg here -->
  <svg class="icon" aria-hidden="true"><use href="#ph-microphone"></use></svg>

The subset

To add one, drop its file into icons/svg/ from @phosphor-icons/core@2.x/assets/regular/ and append a matching <symbol> to the sprite. MIT © 2023 Phosphor Icons — full text in icons/LICENSE.

details

Code, kbd, tip, empty

The small print of an interface.

inline code, keys, a tooltip, an empty state

Toggle with el.hidden = true, or press ⌘ ⇧ L.

?
ledroom ledger

nothing on the wire yet

classis
.codeinline code — a tinted mono run
.kbda key cap
.tipwith data-ui-tip="…"; a static hint on a static anchor
.emptythe sentence that stands in for content that has not arrived

alongside

Tailwind

ui.css declares @layer ui.tokens, ui.base, ui.components and puts every rule inside one of them. Under Tailwind v4, import tailwindcss first, then ui.css into its components layer, so class="btn px-6" works with no !important and no arbitrary specificity war:

@import "tailwindcss";
@import "./ui.css" layer(components);

Tailwind v4 declares @layer theme, base, components, utilities, and ui.* nests as components.ui.*: after Preflight in base, before utilities. So a .btn keeps its padding against Preflight's button reset, and a utility wins any residual tie — a p-0 next to a .card removes the padding, no !important needed. Imported bare before Tailwind, ui.* declares first and sorts below base, and Preflight strips every component.

Tailwind v3 leaves Preflight and the utilities unlayered, and unlayered rules beat every layer: there, disable Preflight (corePlugins: { preflight: false }).

The components use no Tailwind-reserved class prefix, so there is nothing to purge or safelist; the three layout names Tailwind does claim are attributes. Point Tailwind's theme at the same tokens if you want the utilities to share the palette:

@theme inline { --color-accent: var(--ui-accent); --color-fg: var(--ui-fg); }

alongside

The docs shell

docs.css sits beside ui.css: the layout shell every project docs page under gigantic.dev shares — container, prose measure, section rhythm, and the furniture those pages all carry.

The furniture: .docs-shell, .docs-lead, .docs-flavor, .docs-note, .docs-toc, .docs-section, .docs-foot, pre.snippet / pre.tree, .snippet-note, ul.claims, ol.steps, figure.figure with .figure-light / .figure-dark. Consumers link both from the CDN, then their own page.css for what is truly theirs:

<link rel="stylesheet" href="https://gigantic.dev/ui/ui.css" />
<link rel="stylesheet" href="https://gigantic.dev/ui/docs.css" />
<link rel="stylesheet" href="page.css" />

Its tokens join ui.tokens — --ui-measure (52rem, the one prose measure) and --ui-measure-wide (60rem, lists and steps) — and its rules sit in ui.docs, a layer after ui.components, so a page's unlayered rules override any of it. The breakpoints are constants stated once in its header comment, because a media query cannot read a custom property: 900px (the gigantic.dev rail docks and offsets the page by 224px; below it, a 48px strip) and 640px (phone).

Figures

A figure is a board from the project's Claude Design canvas (<project> figures), rendered to docs/figures/<name>.png at 2× with its source read back into docs/figures/project/. figure.figure frames it — ui-bg behind the image, a ui-border hairline, ui-radius-lg corners — and sets the caption in ui-fg-faint at the prose measure. Each board renders twice, <name>.png and <name>-dark.png — the dark one derived at export by swapping every gigantic colour token's light value for its dark one, never drawn twice — and the figure carries both: .figure-light shows by default, .figure-dark wherever ui.css resolves Brass (prefers-color-scheme: dark unless data-theme="light", or data-theme="dark"). The caption names its source:

<figure class="figure">
  <img class="figure-light" src="figures/<name>.png" alt="…" />
  <img class="figure-dark" src="figures/<name>-dark.png" alt="" aria-hidden="true" loading="lazy" />
  <figcaption>… Source: Claude Design canvas <a href="<canvas url>"><project> figures</a>, board <name>.</figcaption>
</figure>

Consumers link latest, so every change to ui.css or docs.css is additive or ships together with the consumer updates it needs — a renamed class or a removed token breaks every docs page at once.

alongside

Non-goals

These stay consumer-local. Each one is a chart, not a component: it needs a time base, a data range, or a pointer model that only the page owning the data can supply, and a version parameterised enough to be general is worse than twenty lines written against the actual numbers.

  • Time rulers — tick density is a function of the visible span.
  • Scrub timelines — playhead, seek and drag belong to a media element.
  • Event-lane rows — lane assignment is a layout of the data, not of the DOM.
  • Pointer-following tooltips — .tip is a static hint on a static anchor; a crosshair that tracks the cursor and reads the nearest datum is plotting code.
  • Fixed-height plot rows — the height is chosen against the value range.

Build them on top: .panel for the frame, .readout for the values, --ui-panel-accent and your own hue tokens for the colour.

the page itself

Layers

Every rule sits in a cascade layer, declared in one statement before any rule: ui.tokens, ui.base, ui.components, then ui.docs from docs.css. A page's own unlayered rules come after all of them and win.

Four cascade layers left to right, ui.tokens, ui.base, ui.components and ui.docs, ending at the page's own unlayered stylesheet; below ui.base, the .ui opt-in and the one unscoped [hidden] rule.
Weakest on the left. ui.base paints the page only under .ui; the one rule that needs no class is [hidden], whose !important runs the layer order backwards. Source: Claude Design canvas ui figures, board Layers.

the page itself

Two pages, and a server

This page is the reference: one section per component family, each with live examples, the markup that produced them, the class table and the token contract. The kitchen sink is every component at once, under load, with a little fake telemetry moving. The sink is for seeing whether the library holds together, the reference for looking one thing up.

Both make zero network requests beyond their own files, and both carry the same three-way theme toggle (sun / circle-half / moon) writing the same localStorage key — a theme chosen on one is the theme the other opens in.

./serve.py             # http://127.0.0.1:8080/docs/ (and /demo/)
./serve.py --port 4321

serve.py is Python's standard-library http.server and nothing else: no install, no dependency, no build. It threads its handler, speaks HTTP/1.1, sends Cache-Control: no-store so an edit to ui.css shows on reload, and redirects / to the docs.

The demo still opens straight off disk. This page does not, quite — its token reference fetches ui.css, which file:// refuses, so that table renders empty — and neither page can be wrapped off disk, which is the real reason the server exists.

the page itself

Wrapping (visor)

This page is served, not opened, so it can be developed through visor — a local reverse proxy that puts a rail beside the app and lets a comment thread be anchored to any element on it.

./serve.py # http://127.0.0.1:8080/docs/
visor 8080 # wrap it — the rail appears beside this page
visor -- python3 serve.py # or let visor own the port and spawn the server

visor asks the wrapped app for almost nothing: it forwards every request that is not its own /__visor/* route, and splices its script tags in before </head>. What it does need is a page whose elements can be named. Its threads grow a CSS selector one ancestor at a time, preferring id → data-testid → data-component → aria-label → stable classes → position, and skipping anything that looks like build output. A page of hashed class names gives it nothing but position, and a thread anchored to div:nth-child(7) > div:nth-child(2) is a thread that dies at the next edit.

So this page publishes a small semantic DOM contract, in the shape ra's workbench uses. Walk up from any click target:

attributeonresolves
data-page<body>docs — which of the two pages you are on
data-componentsection rootthe component family (button, panel, tokens, …); equal to the section's id
data-example<figure>the individual example, stable across edits
data-livethe rendered blockmarks the DOM that is the documented markup
data-code-forthe markup panethe data-example it was generated from
data-classa variants-table rowthe class or attribute selector that row documents
data-tokena swatch or hooks rowthe token it documents

Every section id is also its component name, so a selector visor derives — #button [data-example="button-group"] — reads as the sentence a reviewer would have typed anyway, and survives everything except renaming the component.

window.__uiDocs.resolve(element) is the reference reader: it performs exactly that walk and returns { component, section, example, class?, token?, markup? }. A wrapper may reimplement it — but if the two disagree, the attributes are right.

Three things the server does on visor's behalf, none of them optional: it speaks HTTP/1.1 with keep-alive (an iframe reloading a page's whole subresource set over connection-per-request is visibly slow); it threads its handler, so the three stylesheets and the two scripts are not serialised behind each other; and it sends no Content-Security-Policy at all — a blocking CSP fails silently under visor, with no console error and no network request, just chrome that never appears.

Spawn names the interpreter because visor resolves the command through $PATH only, so ./serve.py is not found. visor writes .visor/ into the directory it runs from; it is gitignored here.

the page itself

Gate spans

Every run of mise run check is one OpenTelemetry trace through floodgate span: a check span with each step nested under it (stele.check, stele.emit, install and test), so floodgate's page shows which steps cost the time and CPU.

check only wraps check:steps in its root span; the steps live there. A step is wrapped in mise run span -- <name> [--attr k=v]… -- <cmd…> (.mise/tasks/span): it execs floodgate span when floodgate is on PATH, else the command after the second --, so a machine without floodgate, CI included, gates as before. To add a step, put it in the check:steps task's run list wrapped the same way; a step left bare is time no span explains. The pre-push hook runs mise run check.

the page itself

Open

What is not settled yet: the hazards of working here, then the work next in line.

Hazards

  • Everything here is public. GitHub Pages serves the repository root (index.html redirects to docs/), so every file in it is published (unverified 2026-10-13: the Pages API was unreachable from the shift sandbox).
  • Component order is cascade order. Inside ui.components a later section wins a same-specificity tie with an earlier one; never reorder sections to match a table.
  • The suite binds loopback sockets. mise run test installs its dev dependencies (happy-dom, tailwindcss), then starts serve.py; a sandbox that denies loopback binds fails that test at cannot bind, not the code.

Next

  1. One glyph source. The sprite lives in four copies (icons/sprite.svg, icons/svg/, inlined in demo/ and docs/), kept equal by the suite but edited by hand. A stdlib icons/sprite.py that writes the sprite and splices it into both pages would make the svg files the only source.
  2. Browser coverage. test/scripts.test.ts runs theme.js, docs.js and the demo script over each page in happy-dom, which has no layout: scrollspy's callback is fed by hand and nothing is painted. A headless agent-browser probe over serve.py would cover real intersection and the cascade traps as rendered.
  3. visor spawn. visor -- ./serve.py fails: visor resolves the child through System.find_executable, which searches $PATH only. The runbooks here name python3 serve.py; visor treating a path-qualified command as a path would fix it for every repo.
  4. Stale claims, each awaiting its owner's word on the fix. visor's stable attributes are data-testid, data-component and aria-label, and an id ends the walk, so it never reads data-example; its fallback is :nth-of-type, not :nth-child. visor 8080 serves the rail on visor's own port (9000 attach, 3000 spawn), not 8080. Sage's "28% saturation" is HSV; in HSL, the unit brass and warn are quoted in, it is 16%. "Omit .ui and only the components style themselves" overlooks the type and layout classes in ui.base, which are unscoped.
  5. Redraw Themes ③. The board still draws :root[data-theme] as one selector for both values; ui.css has only :root[data-theme="dark"], and "light" switches ② off. Redraw it on the canvas, then mise run figures (owner-only: the render needs agent-browser).