@cssints/headless

Headless APG widgets on Solid 2 (solid-js + @solidjs/web 2.0.0-rc.13): state plus attribute objects, no elements, no styling. Each primitive is conformance-checked against its Quint spec (packages/apg-specs/specs/apg/<pattern>.qnt) and the ported scenarios (packages/apg-specs/scenarios/apg/<pattern>.*.json).

const disclosure = createDisclosure({ defaultValue: false });
<button {...disclosure.triggerProps}>Details</button>
<div {...disclosure.panelProps}>…</div>

Where the platform has the element, render it and let it own the behaviour: details, dialog, meter, native inputs, focusgroup. The mapping — the code, what the platform takes over, and the gaps that keep the primitive — is docs/hosts.md.

Decision: signals + differential test, not the machine at runtime

createDisclosure is plain Solid signals. The generated Quint model is not loaded at runtime; it is the oracle in tests:

Why: the machine adds Effect + a model evaluator to every consumer's bundle and forces a signal bridge, while the differential walk catches the same drift (mutation-checked: dropping the change callback of a controlled request fails 11 tests).

Template for the next pattern

  1. specs/apg/<pattern>.qnt + generate:all specs/apg/<pattern>.qnt + spec-only test (see packages/apg-specs/test/apg/disclosure.test.ts).
  2. packages/apg-specs/src/apg/<pattern>.bridge.ts: a SpecBridge (scenario vocabulary <-> spec events/state), a <pattern>Config normalizer that throws Unsupported for config you do not model, <pattern>Steps (random-walk alphabet), <pattern>Probe.
  3. src/<pattern>.ts primitive; test/<pattern>.fixture.tsx renders parts with data-part="<name>" and returns a Mounted; test/<pattern>.browser.test.tsx runs scenarios + differentialWalk (copy disclosure.browser.test.tsx).
  4. Every scenario expectation the primitive deliberately misses goes into DIVERGENCES with a reason; the test requires it to still fail.

Conventions: visible lists the hideable content parts only; boolean attributes read "true" when present; key/type on a target focuses it first, and a key whose target is the widget's owner (menu, grid) is pressed on the part the primitive says is focused; data-* attributes are library styling hooks (Unsupported); aria-controls-style references read back as part targets.

Walking the DOM: a fixture reports focus, it does not move it

The walk's focus observation is Mounted.focus() — the part the primitive itself considers focused (trigger, menuitem:2, null for outside). document.activeElement is not the observation: a page that mirrors the primitive's state into DOM focus (which is what a host does, see docs/hosts.md) has the mirror's focus event delivered by the browser when it gets round to it, not when focus() returns.

Why that matters, measured (bean cssints-6fau): the menu fixture mirrored focusLevel/focusIndex in a createEffect. The primitive's item props take onFocus as the platform's word on where focus is (setFocusItem), so the mirror fed back into the primitive. In a page that is not the focused one — a background test page, a window that just lost focus — the browser delivers that focus event one task (or several) later, and by then the primitive has moved on: the event rewinds it to the item the fixture focused a step or two ago. Instrumented over 4 800 walk steps, 795 of 795 adopted focus events were stale (the focused item was not the primitive's item). That is what a walk reports as a divergence the model never produced. It cannot be waited out (a longer settle widens the window), retried (the rewind repeats), or guarded (a suppression flag set around focus() is cleared before the browser dispatches).

So the contract is:

Who moves what

A walk's inputs are one step at a time, and each step must be the only input. Three things enforce that:

Measured (bean cssints-6fau): before this, the checkable fixture adopted 795 stale focus events in 4 800 walk steps (the DOM focus was almost never where the primitive was, and every adopted event pulled the primitive to it). After, the walks take no focus input at all, and packages/headless's suite went from about one failing run in three to five consecutive green runs, including two runs under doubled load.

Part names

Every props object a primitive returns carries data-part: the name that part goes by in the primitive's own vocabulary. It is additive — no behaviour, no new option, no ARIA — and it exists because the props are the only stable styling contract a consumer has, so a skin can write [data-part="trigger"] once instead of asking every host for a class name.

The value is typed string, not a literal, so the host may replace it, and a fixture that must address one instance renames it after the spread: <div {...canvas.nodeProps(id)} data-part={node${id}}>. Where a part is not an element of its own (TabRenameProps is the rename controller: onDblClick, begin, commit, cancel), there is no marker.

primitive parts
accordion heading trigger panel
alert alert close
alertdialog trigger dialog backdrop cancel confirm save input
breadcrumb nav breadcrumb item link
button button
canvas viewport layer node live
carousel carousel rotation prev next slide tablist tab
checkbox checkbox
checkbox-group group checkbox (the parent and each child)
combobox input trigger popup
command-palette input list option empty status dialog backdrop title
confirm trigger dialog backdrop title description cancel confirm
date-picker status trigger popover title previous next grid weekday cell
diagram node edge status
dialog-modal trigger dialog (polyfill and native) backdrop dismiss
disclosure trigger panel
drawer trigger backdrop content handle
dropzone input zone browse status
feed feed article before-feed after-feed
field control label hint error
filterable-menu trigger input menu group group-label item item (a submenu trigger is a row) submenu empty status clear dialog backdrop title
grid grid row cell widget header
knob knob value
link link
listbox listbox option
listbox-rearrangeable list option
menu trigger menu menuitem
menubar menubar menuitem menu submenu
meter meter
pagination nav list item link previous next status
panzoom viewport image value
player surface play seek mute fullscreen
popover trigger content
radio radiogroup radio
resizable-panels group pane separator
scrollprogress bar
scrollspy nav list item link
slider thumb track
slider-multithumb thumb track
spinbutton input increment decrement
status status
switch switch
table table row-group caption header-cell header row cell select-all checkbox
tabs tablist tab tabpanel close input
textbox input (also textarea, createTextArea)
timeline timeline row ruler list bar label
toast region toast
toolbar toolbar item
tooltip trigger tooltip
treegrid grid row cell expander
treeview tree item
view-transition view-transition (both persist and name)
virtual scroll item spacer
windowsplitter primary secondary separator

test/parts.test.ts fails a primitive whose props type omits the marker, whose inline props type omits it, or that names a part "".

Divergence policy

When a ported scenario and the primitive disagree, decide it this way:

  1. The APG pattern text wins — the normative "Keyboard Interaction" and "WAI-ARIA Roles, States, and Properties" sections.
  2. The APG examples decide only where the text is silent.
  3. Where both are silent, the majority of ariakit / Base UI / react-aria wins.

A scenario whose expectation we deliberately do not meet stays a negative test: it goes in the primitive's DIVERGENCES map with its reason, and the test requires it to still fail, so the gap cannot silently close. skipped is different — an Unsupported config or step the bridge cannot express at all, not a divergence. See packages/apg-specs/scenarios/apg/README.md.

Controlled vs uncontrolled

State is one machine with a request vs commit split . An event a user would see as a change is a request carrying the intent; the host either accepts it (uncontrolled — the common case, auto-commit) or the controlled value prop is the only thing that changes state.

Two invariants: a rejected request leaves state untouched, and in controlled mode no event commits. Uncontrolled is the degenerate case where every request is accepted, so one spec covers both.

Primitive API (the React/Solid convention): value + onValueChange (a request the host may ignore) for controlled, defaultValue for uncontrolled.

A list that arrives later is still one widget. The options that are lists — createListbox's items, createTable's rows, createRadioGroup's values, createTimeline's rows — also take a getter (() => list()), and it is read at attribute-read time. So an async fetch, a filter or a trace that lands after mount changes the list without rebuilding the primitive, and the active option, the selection and the roving tab stop survive. A host that rebuilt the widget inside a memo lost exactly that (the feedback from adopting 0.20.0, bean cssints-65eb).

Implemented for disclosure (reference: specs/apg/disclosure.qnt, src/disclosure.ts) and player (the four preferences volume / muted / rate / fullscreen; transport stays adapter-driven). The shared core is src/controllable.ts (createControllable): value + initial + onChange in, [current, request] out.

Template for every other pattern. A pattern adds, in this order:

  1. Spec, config flag. var controlled: bool (+ var accepting: bool, a controlled host that writes every intent back) and var valueProp (the controlled value, meaningful while controlled), set by configuration events (init is literal-only): control (adopts the current value) and acceptRequests.
  2. Spec, request path. Each user-intent event keeps its name and becomes a request: it records the intent (requested), bumps a requests counter when the intent differs from the current value, sets outcome ("accepted" uncontrolled or accepting host, "rejected" controlled and holding) and base (the value on arrival), and commits only through landed(holds, current, want). Add setValue (nondet) / hostToggle: the host writing the value, the only commit while controlled, resetting outcome to "none".
  3. Spec, invariants. ControlledFollowsProp (controlled => value == valueProp: no event commits), RejectedRequestUntouched (outcome == "rejected" => value == base), AcceptedRequestCommits (outcome == "accepted" => value == requested), each with a hand-built bad state in the spec test.
  4. Bridge. <pattern>Config maps controlled (and a pinned value, expanded, meaning a host that rejects) to { controlled, accepts }; setup emits control / acceptRequests / setValue; events reads the requests counter and the requested payload; add the host steps to <pattern>Steps and the probe.
  5. Primitive. value + onValueChange (a request the host may ignore) for controlled, defaultValue for uncontrolled, built on createControllable; programmatic methods are requests; value is T | undefined (exactOptionalPropertyTypes). The fixture is the host: a signal passed as value, written back only when accepts.
  6. Tests. Walk each of: uncontrolled, controlled accepting, controlled holding. Replay the controlled scenarios; an expectation we deliberately miss goes to DIVERGENCES.

Generator limits met and worked around (no parameterized actions, no let): a request action spells landed(...) out per assignment; every action assigns every var.

A script's vocabulary: snapshot() and act()

A demo, a test or an agent should not have to synthesise a keydown to move a widget. Two primitives carry it so far: createRadioGroup and createListbox. snapshot() is the observable state as JSON — the checked and focused radios (or the selection and the active option), the disabled ones, the count, the flavor or selection mode — and act() takes the intents the keyboard and the pointer already speak: next / previous / first / last (on the radio, focus moves and checks what it lands on: the pattern's selection-follows-focus), focus, and check on a radio, activate (Space), type (type-ahead) and click on a list. An intent goes through the primitive's own paths, so the request/commit split, the callbacks and the ARIA are the same as a key's.

The one difference is the moves: a radio group moves by state (the host's effect puts DOM focus where the state says), so act never touches the DOM; a listbox's whole model is "focus is the move", so its act({ type: "next" }) focuses the next enabled option's element and the state follows the focusin, exactly as the platform's arrow does — the host must have rendered the option.

The snapshot is JSON and nothing else: every field is what an ARIA attribute already says, so it cannot drift from what a screen reader hears. Read it after a flush — Solid 2 applies a write on the microtask — which is what a browser test does and what an MCP tool would do between two messages.

Preferences

A primitive that has a seam honours an optional prefs entry (a Partial<Prefs>, src/prefs.ts). The host resolves its preferences and injects the values; @cssints/headless depends on solid-js only and never imports a preferences store — Prefs is a structural type, and an absent pref keeps today's behaviour.

Everything else ignores prefs: accordion, alert, alertdialog, breadcrumb, button, carousel, checkbox, checkbox-group, combobox, command-palette, confirm, dialog-modal, disclosure, feed, field, grid, link, listbox, meter, panzoom, player, popover, radio, resizable-panels, slider, slider-multithumb, spinbutton, switch, table, tabs, timeline, toolbar, treegrid, treeview, windowsplitter — they expose no timing / motion / live-region / camera seam. listbox / treeview / timeline typeahead timeouts are host-driven via their reset methods, so they take no delay here either.

motionDurationMs is not consumed: canvas tweens are tick-driven, not millisecond-driven, and the look layer owns durations. It stays in Prefs only so a host's preference record fits the type.

Feedback

The physical side of a gesture is output, not state. Nothing about a detent being felt changes what a widget is, so it is not a primitive, not a spec and not a provider/context: @cssints/headless takes options in and returns props out, and a <Haptics> provider would be exactly the ambient state every primitive here was written to avoid. The primitives with physical semantics — knob, slider, slider-multithumb, spinbutton, switch, checkbox (and checkbox-group, once for its children) — take one option, the same name and shape on every one of them:

export type FeedbackIntent = "detent" | "latch" | "release" | "limit";

export interface Feedback {
  /** The vibration channel; the host maps an intent to `navigator.vibrate(...)`, or to nothing. */
  readonly haptic?: (intent: FeedbackIntent) => void;
  /** The sound channel: the same intents, for a click sample or a beep. */
  readonly sound?: (intent: FeedbackIntent) => void;
}

feedback?: Feedback — both channels optional, both called with the same intent, and nothing is called when the host passes neither. It is read lazily, so a host that flips its "haptics off" preference does not rebuild the widget.

Named intents, never milliseconds, never the platform. The string union is the whole contract. navigator.vibrate is missing entirely on iOS Safari and inert in a background tab, so a primitive that promised a haptic would lie on half the targets; the host decides what "detent" is (navigator.vibrate(8), a click sample, nothing), and its off switch belongs next to announce in its preferences, not in a primitive. The pattern and the sample are the skin's or the app's.

intent when it fires
detent a user interaction crossed a step: a drag landed on a new value, a wheel notch (knob), an arrow / PageUp / PageDown key, a stepper button
latch a two-state control turned on — switch, checkbox, a box in a checkbox-group (a mixed box checks, so it latches; the group's controller latches only when every box ends up on)
release that control turned off
limit a user interaction hit a bound (min, max, the neighbouring thumb) and could move no further

No intent on focus, on a programmatic change (setValue, setChecked, setValues, setChildren, stepBy), or when the host writes value. A press that jumps several steps is one detent: the tick marks where the thumb landed, not every step it crossed.

One limit per interaction, not one per frame. A held arrow key, a wheel still spinning and a pointer pressed against the end all arrive many times a second, and a tick each is a buzz. The primitive emits the first limit and stops until something moves the value or a new interaction starts — a fresh key press or pointer press against the same bound ticks again.

A vetoed request still ticks once. The intent is issued with the request the user made. The primitive cannot see a controlled host's veto without a frame of delay, and a late tick is worse than a missing one, so a host that refuses changes gates feedback itself (the same gate as "haptics off").

checkbox-group: pass feedback to the group, not to each box. The group reports for its children — a kit Checkbox inside a group asks the group to click — so one activation is one intent instead of two.

Canvas

createCanvas is a headless viewport: the host renders the DOM, the primitive owns the camera, the gesture machine, the focus contract and the state. Its behaviour is packages/apg-specs/specs/canvas/{camera,pointer}.qnt, and the DOM is checked against it by the differential walk.

The handle. nodes sets the initial geometry; everything after that is pushed in, because a node's position, size and paint order belong to the host:

Membership, sizes and z-order are not modelled in pointer.qnt (its node set is fixed at three): the spec owns the camera, the gesture machine and the selection, the host owns the geometry. Bad input to any of these throws before anything changes.

Coordinates. screenToWorld(point) and worldToScreen(point) convert between viewport px and whole world units against the live camera — a running tween's current frame, not its target — so a host may call them at any time. That is what the pointer pipeline does not cover: drawing a remote cursor where a collaborator's point is, anchoring an overlay to a world position, or hit-testing a drop target the pointer never reached.

Culling is the host's job. isCulled(id) means a node is off screen and not selected / focused / editing. The host drops that node's body and keeps its shell — role, accessible name, tab stop — so culling never costs a tab stop. The shell's content-visibility: auto is a free extra, not the mechanism: its skip distance grows with zoom, so it skips almost nothing at 16x.

Snapping is snapCandidates({ axis, value, id, width, height }) => readonly number[], whole world units, defaulting to the 50-unit grid. value is the dragged node's origin, so right-edge alignment is target - width. The 8 screen px threshold and "nearest candidate, ties to the larger" are the primitive's; the candidate policy is the host's.

The landing preview is the host's to draw. While a pointer drag runs, state().landing is the origin the release would commit — { id, x, y } in whole world units, already snapped and clamped into the world bound — or null when no drag runs. With snapping off it follows the pointer off the grid. The primitive renders no elements, so a host marks the slot with a ghost of its own; the release commits exactly there. state().drop then describes the correction for TWEEN_TICKS frames (from the origin the drag rendered, to the committed one, which position(id) already reads) when a host wants to animate it. In the ordinary drag from and to are equal — the live drag already renders the snapped slot — so the drop starts no frames; a clamp into the world bound is the case that differs. Reduced motion never starts one. Keyboard moves are untouched: one grid step and an announcement. The landing and the drop are derived from pointer.qnt (landingX / landingY, LandingIsTheSnappedOrigin); the animation is presentation and stays out of the spec, like the camera's easing.

Editing is split. The host renders its editor inside the node (tabindex="-1", user-select: text) and focuses it when state().editing is that node. The primitive owns the rest: it ignores a composing keydown, ends editing when focus leaves the node (so native Tab continues in spatial order), sets user-select: none on the layer, and puts focus back on the node on Escape / F2.

Nested canvases are two instances the host composes: a #canvas node holds a second createCanvas, and the inner viewport stops propagation of its own pointer, wheel and key events. The innermost canvas under the pointer owns the event, so a press or zoom inside it never starts an outer gesture or moves the outer camera. A nested canvas is a single tab stop in its parent.

Pan and zoom

createPanZoom is one image fitted to a viewport: the scale, the offset and the prop objects for the viewport, the image and a live value. There is no APG pattern for pan-zoom, so there is no Quint spec and no ported scenarios: the contract is this module's own and test/panzoom.browser.test.tsx is its oracle. The case it replaces (kocharin-art-3's Zoomable: ~110 lines of pointer maths) had no keyboard path and no ARIA at all.

The accessible contract is three parts, and the pointer is a bonus: a viewport that takes focus (role=group, tabindex=0, aria-roledescription="zoomable image", aria-describedby the value), keyboard operations that stand in for every gesture (+ / = / - zoom by step, arrows pan by 24 px, Shift ×4, 0 resets), and a polite live region (role=status, aria-live=polite, the current "150%"). valueProps deliberately carries no hidden: a hidden live region is not announced, so the host hides it visually.

Not createCanvas. The canvas is a camera over an infinite world with nodes, culling, snap and a z-order; a picture is one image in a box. There is no world, no node set and no reason to carry the camera machine.

const panzoom = createPanZoom({ min: 1, max: 4, step: 0.25 });

<div {...panzoom.viewportProps} class="viewport">
  <img {...panzoom.imageProps} src={src} alt={alt} />
  <span {...panzoom.valueProps} class="visually-hidden">
    {panzoom.value()}
  </span>
</div>;

Gestures. A drag pans, a second pointer pinches about its midpoint, a double click resets. Pinch is two pointers and the distance between them, not a platform gesture, so it works where PointerEvent does. Wheel is zoom only with ctrl / meta — the browser's own pinch arrives as ctrl+wheel — and a bare wheel is never preventDefaulted, so the page keeps scrolling; a swallowed wheel is the one thing that is never acceptable on a trackpad.

A host can pan without a pointer. panBy(dx, dy) moves the offset by a relative step through the same bounded move a drag takes, and reports it with onPanChange; the kit's Panzoom runs the glide after a flick on it (the machine is the skin's, the momentum is not this primitive's).

bounds: "clamp" (the default) bounds the offset by half the viewport's scaled overflow, so the image is expected to fill the viewport at min (width: 100%; height: 100% / object-fit: cover). A letterboxed image smaller than its viewport cannot be held gap-free: give it a viewport of its own or bounds: "free".

Left to the host: the box (the viewport's size and overflow: hidden, touch-action: none if a touch drag should pan), the look (a transition on the transform, transform-origin: 50% 50% — the default this maths assumes), and the image itself. Not modelled: rotation, and a keyboard pan at scale min (the clamp means there is nothing to pan, so the arrows are inert). Inertia is the host's too: panBy is the seam a glide after a flick drives, so the momentum's curve and its motion preference stay with the skin.

const panzoom = createPanZoom({
  scale, // controlled: the host owns the scale
  onScaleChange: setScale,
  onPanChange: (offset) => save({ x: offset.x, y: offset.y }),
});

Controlled is scale + onScaleChange; the offset has no controlled prop, so a host that ignores a scale request also gets the offset resolved for the scale it refused.

View transitions

createViewTransition is a runner around document.startViewTransition (Baseline October 2025): it runs an update exactly once, starts a transition around it when the platform can, and treats a skipped transition as a successful run. There is no APG pattern, so there are no APG scenarios; the primitive's behaviour is packages/apg-specs/specs/patterns/view-transition.qnt, and the DOM is checked against it by the differential walk.

const viewTransition = createViewTransition();

await viewTransition.run(() => setSelection(next));

<img {...viewTransition.persist({ class: "card" })} />;

persist() is the default case: the same element persists across the update. It returns { style } with view-transition-name: match-element, so the browser assigns the unique name itself and the host keeps no bookkeeping. Use it for the element that moves, resizes, or is re-rendered in place — the case a host reaches for first.

name(id) is the morph pair: one element leaves, another arrives. It returns a deterministic prefixed name (vt-<id>, the prefix is the prefix option) plus the optional view-transition-class hook, and leaves the pair's rule to the host. The platform rule the primitive cannot enforce: only one element may be rendered with that name at a time. MDN states it plainly — "If two rendered elements have the same view-transition-name at the same time, the ViewTransition.ready Promise will reject and the transition will be skipped." The whole transition is skipped, silently, not just the pair; that is why persist() needs no names and a per-item name() needs the host to render one of the pair.

Reduced motion is the inert path. With prefs.motion === "reduce" — and, identically, in a browser without the API — run awaits the update and starts nothing, and supported() reads the live API (false during SSR). The pref is read on every run, so a host may pass a getter. A transition the platform skips resolves run instead of rejecting it: the update already ran, so a skip is not a failure.

Latest wins. A second run while one is active starts a new transition; the platform skips the running one. There is no queue and the primitive calls no skipTransition() — that is the platform's own policy. state() reports { supported, active }; neither it nor the style objects touch the DOM.

Left to the host: the transition's look (durations, easing, the ::view-transition-* pseudo-elements), cross-document transitions (pageswap / pagereveal plus @view-transition { navigation: auto }, CSS only), view-transition-class styling and types. Not modelled: name allocation across rendered elements — the spec covers one transition at a time, the host owns uniqueness.

Knob

createKnob is a virtual knob after GarageBand's (How Apple Designs a Virtual Knob): one focusable control you spin around its centre or slide vertically / horizontally, with one gesture locked per drag. There is no APG pattern and no ARIA role for a dial, so it is a role=slider with aria-valuenow / aria-valuetext, and test/knob.browser.test.tsx (real Chromium) is its oracle — there is no Quint spec.

const knob = createKnob({ labels: { knob: "Volume" }, format: (value) => `${value}%` });
const turn = () => knob.percentOf(knob.value());

<div {...knob.knobProps} class="knob">
  <span class="indicator" style={{ transform: `rotate(${turn() * 360}deg)` }} />
</div>
<span {...knob.valueProps} class="visually-hidden">
  {knob.value()}
</span>;

percentOf is the fraction of a full turn the skin rotates by; the look is the host's. valueProps must be rendered (hide it visually, never with hidden): it is the live announcement.

A dial is never the only control. The keyboard contract stands in for every gesture — arrows step, PageUp/PageDown by ten steps, Home/End to the bounds — but a numeric field (createSpinbutton) still belongs next to it: a slider role is operable but does not make a range easy to discover or type.

Gestures (gesture, default "both"). A pointerdown records the centre, the start angle and the side. On the first movement past 6 px the drag picks a mode once and keeps it for the rest of the drag: movement that stays on one axis (the other under 35% of it) is a slide, anything else is a turn around the centre. The reference's direction rule holds: down on the right half turns clockwise (up in value), down on the left half counter-clockwise, and a horizontal slide uses the same left/right side. A spin's value per degree shrinks as the pointer moves away from the centre — the same angle is a longer arc, so farther is finer. gesture: "spin" / "slide" disables the other. The wheel steps once per event and preventDefaults, so hovering the dial stops the page from scrolling.

wrap makes the dial continuous: past max comes back at min, so a full turn is a full cycle instead of the clamped end of the range. setValue / stepBy are requests like a key, so a controlled value still owns the result.

Resizable panels

createResizablePanels is a group of N panes and N-1 separators: react-resizable-panels' layout on the APG window splitter's keyboard. Its behaviour is packages/apg-specs/specs/patterns/resizable-panels.qnt — not an APG pattern, so it lives under patterns/ — and the DOM is checked against it by the differential walk. The spec is the three-pane instance (10/80 bounds, 10% steps, pane 0 collapsible at 0); the primitive takes N panes and any bounds.

The contract. Sizes are percentages of the group and always sum to 100. Each pane has min / max; a collapsible pane sits at collapsedSize (0) while collapsed. A move — an arrow, Home/End, a drag — changes only the two panes around the separator, clamped by both bounds. Collapsing hands the pane's space to the nearest pane that can take it and cascades outward; restoring takes it back in the same order, so a restore always returns the remembered size.

The separator is the widget: role=separator, tabindex=0, aria-orientation, aria-valuenow = the size of the pane it resizes, aria-valuemin / -max that pane's bounds, aria-controls it. Arrows move by step (10%), Home/End jump the pair to its bounds, Enter collapses and restores. A separator next to a collapsed pane is inert (only Enter restores).

The drag is snapshot + delta: pointerdown remembers the layout, every move re-solves from it, so dragging back past a clamp recovers exactly. It uses pointer capture and ends on pointerup / pointercancel; a host write of sizes ends it too. Keyboard input is a no-op while a drag runs.

snap is a learned magnet. Every release leaves a mark at the width it was dropped at; a mark's weight halves every five drags, the marks are counted on a half-percent grid, and the divider sticks to the tallest hill once about three recent drags stand under it. The point is sticky — a hill that stays inside its zone (10 px, off the group) leaves the point alone, so it cannot drift a pixel per drag. Inside the zone the edge lands on the point while the pointer keeps moving; hold Alt for the exact width, which keeps the widths beside the point reachable, and keyDown never snaps: the keys are exact by contract. snapPoint(index) is the learned width, for a skin that marks it. The marks are the whole state: onSnapMark(index, marks) hands a release's list to the host and snapMarks takes it back, so the habit survives a reload — the hills are rebuilt from the marks, and age is a count of drags, not of days, so a week away moves nothing. storageKey carries the layout; the marks are the host's.

const panels = createResizablePanels({
  panes: [{ label: "Sidebar", collapsible: true }, { label: "Content" }, { label: "Inspector" }],
  defaultSizes: [20, 40, 40],
  storageKey: "app-layout",
  onSizesChange: (sizes) => save(sizes), // ignored while uncontrolled
});

<div {...panels.groupProps} style={{ display: "flex" }}>
  {[0, 1, 2].map((index) => (
    <>
      <div {...panels.paneProps(index)} style={{ flex: `${panels.sizes()[index]}%` }}>
        …
      </div>
      {index < 2 && <div {...panels.separatorProps(index)} />}
    </>
  ))}
</div>;

Controlled is sizes + onSizesChange (the request), like every other primitive. A pane's defaultSize is kept and the panes that name none share what is left equally; defaultSizes states the whole start instead, and storageKey persists the layout in localStorage — host storage, so the key belongs to the host's namespace. A group nests: the inner group's separators measure their own parent, so a sidebar beside a stack of editor and terminal is two instances, and the outer drag never re-solves the inner percentages.

Left to the host: pane bounds in pixels (percent only), and F6 (with three panes a Tab is enough). Not modelled: react-resizable-panels' collapse-on-drag threshold (a pane collapses on Enter or a host write, never by dragging through MIN) and restoring a pane that was mounted already collapsed (it returns to its own min).

Form field

createField is the ARIA contract of a form field: a label, a control, a hint and an error. There is no APG pattern for it, so there is no Quint spec and no ported scenarios: the contract is WAI-ARIA (aria-describedby, aria-invalid, aria-required) and HTML (label[for], required), and where those are silent the majority of Base UI Field, react-aria TextField and ariakit FormControl. test/field.browser.test.tsx is its oracle (plain assertions on the attribute objects; no DOM is needed, the file name is only what vite.config.ts includes).

const field = createField({
  required: true,
  hint: "At least 8 characters",
  get invalid() {
    return touched() && password().length < 8;
  },
  get error() {
    return "Too short";
  },
});

<label {...field.labelProps}>Password</label>
<input type="password" {...field.controlProps} />
<p {...field.hintProps}>{field.hint()}</p>
<p {...field.errorProps}>{field.error()}</p>;

Text input and textarea

createTextInput and createTextArea are createField plus the props a host forgets. There is no APG pattern for text editing — an <input> already is the pattern — so there is no Quint spec: test/textbox.browser.test.tsx asserts the attribute objects and the element behaviour.

const email = createTextInput({ type: "email", autoComplete: "email", inputMode: "email", required: true });
<label {...email.labelProps}>Email</label>
<input {...email.controlProps} />

Drop zone

createDropZone is a file drop target on a hidden native <input type="file">: the picker, the accept filter and multiple are the platform's, and the primitive adds a drag target, the validation and a status line. There is no APG pattern for a drop zone; the drag state and the last delivery still change over time, so they have a machine (specs/patterns/dropzone.qnt: the depth, disabled, the batch, and the invariant that a drop or a leave clears the highlight). test/dropzone.browser.test.tsx is the DOM oracle (the picker, the DataTransfer details, the attributes), test/dropzone-spec.browser.test.tsx replays the spec's scenarios and the differential walk in Chromium, and the per-file decision (accept, maxSize, maxFiles) is a property test there. The same primitive replaces the bare file inputs of cms-admin's image field and kocharin's dashboard upload.

const upload = createDropZone({
  accept: "image/*",
  multiple: true,
  maxSize: 5 * 1024 * 1024,
  maxFiles: 10,
  labels: { labelledby: "upload-heading", browse: "Choose images" },
  formatMessage: ({ total, rejected }) => t("upload.batch", { total, rejected: rejected.length }),
  onFiles: (files) => void add(files),
  onReject: ({ file, reason }) => toast(`${file.name}: ${t(`upload.reason.${reason}`)}`),
});

<div {...upload.zoneProps}>
  <p>Drop images here{upload.dragging() ? " (release to add)" : ""}</p>
  <input {...upload.inputProps} />
  <button {...upload.browseProps}>{upload.message() ?? "Choose images"}</button>
  <p {...upload.statusProps}>{upload.message()}</p>
</div>;

Pagination

createPagination is a navigation landmark over a page list. No APG pattern exists; the requirements are TetraLogical's (accessible-components-library v1.0.0), and test/pagination.browser.test.tsx is the oracle.

const pages = createPagination({ page: 3, pageCount: 12, hrefFor: (page) => `/issues?page=${page}` });
<nav {...pages.navProps}>
  <ul {...pages.listProps}>{/* items() with gaps, linkProps(page) */}</ul>
</nav>
<p {...pages.statusProps}>{pages.status()}</p>;

Table

createTable is sortable column headers and row selection on a native <table>: a <caption>, <thead>, <tbody>, <th scope="col"> and <td> carry the semantics, so the primitive adds no role and no aria-rowindex, only what the elements cannot say themselves (aria-sort on the sorted column, aria-selected on a row, the mixed select-all state, and the totals a windowed table hides). It is a grid with a header row but without the grid's navigation: the cells keep their own focus, and createGrid stays the widget for roving cell focus. There is no spec of its own — it composes the two state models the package already has, grid-sort.qnt and grid-selection.qnt — so test/table.browser.test.tsx is its oracle.

const table = createTable({
  columns: [
    { key: "title", abbr: "Title" },
    { key: "status", sortable: false },
    { key: "count", numeric: true },
  ],
  rows, // the host's ids, in the host's order, or `() => rows()` for a list that arrives later
  selection: "multiple",
  defaultSort: { key: "title", direction: "ascending" },
  labels: { table: "Open issues", selectRow: (id) => `Select ${nameOf(id)}` },
  onSortChange: (sort) => setSort(sort), // the host re-sorts its data and passes `rows` again
});

<table {...table.tableProps}>
  <caption {...table.captionProps}>Open issues</caption>
  <thead>
    <tr>
      {table.selectAllProps && (
        <th>
          <span {...table.selectAllProps} />
        </th>
      )}
      {columns.map((column) => {
        const sortButton = table.headerButtonProps(column.key); // undefined when not sortable
        return (
          <th {...table.headerCellProps(column.key)}>
            {sortButton ? <button {...sortButton}>{column.key}</button> : column.key}
          </th>
        );
      })}
    </tr>
  </thead>
  <tbody>
    {rows.map((id) => (
      <tr {...table.rowProps(id)}>
        {table.selectAllProps && (
          <td>
            <span {...table.rowCheckboxProps(id)} />
          </td>
        )}
        {columns.map((column) => (
          <td {...table.cellProps(id, column.key)}>{cellOf(id, column.key)}</td>
        ))}
      </tr>
    ))}
  </tbody>
</table>;

Modifiers

createModifiers is MuTable's mechanic (Sun et al., UIST '26) as a rail: a transformation is data, not a command. Each one stays on the stack as a unit over the columns it spans — Color, Size, Axis, whatever the host declares — so the current view can be explained, revisited and extended instead of being a one-way command whose result is all that remains. One encoding has one owner (the topmost unit that covers the column and declares it), which is what makes the order mean something: Group then Count is not Count then Group. A unit that is joined (parts.length > 1) is the reusable sequence, and retargeting it moves every step of it.

const modifiers = createModifiers({
  targets: [
    { key: "audience", label: "Audience" },
    { key: "critics", label: "Critics" },
  ],
  actions: [
    { kind: "color", label: "Color", encodings: ["color"] },
    { kind: "axis", label: "Axis", encodings: ["y", "order"] },
  ],
  defaultModifiers: [
    { id: "m1", targets: ["audience"], parts: [{ kind: "color", slots: [0] }] },
  ],
  onActivate: (id) => setMenu(id), // the host's menu: span, lock, reorder, join, split, remove
});

<div {...modifiers.toolbarProps}>
  <For each={modifiers.modifiers()}>
    {(unit) => <button {...modifiers.itemProps(unit.id)}>{shortLabel(unit)}</button>}
  </For>
</div>
<p {...modifiers.status.statusProps}>{modifiers.status.message()}</p>;

Timeline

createTimeline has two modes over one axis. Without rows it renders the package's demo tree of five fixed spans (collapsing, a zoom window, the differential walk against specs/apg/timeline.qnt); with rows it takes real span data and lays it out as a trace waterfall.

const timeline = createTimeline({
  rows: spans, // { id, label, start, end, depth?, status? }, in the host's display order
  axis: { unit: "ms" },
  selected: selected(), // controlled; omit it and the primitive keeps the value
  onSelect: (id) => setSelected(id),
});

<ul {...timeline.listProps}>
  {spans.map((span) => (
    <li {...timeline.rowProps(span.id)}>
      <span {...timeline.labelProps(span.id)}>{span.label}</span>
      <div class="track">
        <div {...timeline.barProps(span.id)} />
      </div>
    </li>
  ))}
</ul>
<div {...{ role: timeline.rulerProps.role }}>
  {timeline.rulerProps.ticks.map((tick) => (
    <span style={{ left: `${tick.left}%` }}>{tick.label}</span>
  ))}
</div>;

Tabs

createTabs is the APG tablist: roving tabindex, wrapping arrows, Home/End, automatic or manual activation, disabled tabs, and a selection that is a request (value + onValueChange) or uncontrolled (defaultSelected). The plain widget is checked against specs/apg/tabs.qnt by the scenario bridge and the differential walk in test/tabs.browser.test.tsx; its roles, names, focus order and direction are held by test/tabs-requirements.browser.test.tsx.

dir (default ltr) swaps ArrowLeft / ArrowRight on a horizontal tablist, the way radio.ts does; a vertical tablist keeps Up / Down. tabs.qnt models ltr only, so the ported direction scenarios stay skipped in the differential walk: the primitive's arrow swap is proven by the browser test, not by the model.

Its accessibility requirements — one row per requirement, each naming the Quint invariant, browser test or manual AT row that holds it, and the gaps still open — are docs/requirements/tabs.md, written on the model in docs/requirements/README.md: a behaviour goes to the spec and its walk, a DOM attribute or a layout value to a browser test, and what a screen reader says to the assistive-technology table.

The docs playground's file tabs add and close files and rename them, so createTabs also takes closable and renamable — both off by default, so the plain widget is unchanged. The primitive never takes the list: it asks (onClose, onRename), the host removes or renames. label(index) is the tab's name: it names the close and rename buttons and seeds the rename draft, and it is read lazily.

const tabs = createTabs({
  get items() {
    return files().length;
  }, // the host's list; it shrinks after a close
  get closable() {
    return true;
  },
  get renamable() {
    return true;
  },
  label: (index) => files()[index], // "Close index.ts", the rename draft
  onClose: (index) => setFiles((all) => all.filter((_, at) => at !== index)),
  onRename: (index, label) =>
    setFiles((all) => all.map((name, at) => (at === index ? label : name))),
});

<div {...tabs.tablistProps}>
  {files().map((name, index) => (
    <div {...tabs.tabProps(index)} onDblClick={tabs.renameProps(index).onDblClick}>
      {tabs.renameProps(index).editing() ? (
        <input
          {...tabs.renameProps(index).inputProps}
          ref={(element) => queueMicrotask(() => element.focus())}
        />
      ) : (
        name
      )}
    </div>
  ))}
  {/* ... the close button of each tab, and the panels */}
</div>;

Confirm

createConfirm is a promise-based confirmation over createDialogModal({ role: "alertdialog" }). Like the field it is not checked against a spec (the dialog is; test/confirm.browser.test.tsx covers the promise around it, in Chromium).

const confirm = createConfirm();

const remove = async () => {
  if (await confirm.confirm({ title: "Delete post?", description: "This cannot be undone.", confirmLabel: "Delete", destructive: true })) {
    await deletePost();
  }
};

<button {...confirm.triggerProps} onClick={remove}>Delete</button>
<div {...confirm.backdropProps} />
<div {...confirm.dialogProps}>
  <h2 {...confirm.titleProps}>{confirm.request()?.title}</h2>
  <p {...confirm.descriptionProps}>{confirm.request()?.description}</p>
  <button {...confirm.cancelProps}>{confirm.request()?.cancelLabel}</button>
  <button {...confirm.confirmProps}>{confirm.request()?.confirmLabel}</button>
</div>;

Toast and status

Two live regions for the two sizes of feedback: createStatus is one role=status message whose text the host replaces ("Link copied", "Saved"); createToast is a queue of toasts, each with its own live region, a timeout, a ceiling and a countdown that pauses. Neither touches the DOM: like every primitive here they return state and attribute objects. There is no APG pattern for either (APG's Alert, createAlert, is imperative and assertive), so there is no Quint spec and test/toast.browser.test.tsx is the oracle. The behaviour is copied from Base UI's Toast and React Aria's Toast (a landmark, F6 into it, at least 5 s, timers paused on hover or focus, the announced text handed in rather than read from the DOM).

const toast = createToast();
const status = createStatus();

const copy = async () => {
  await navigator.clipboard.writeText(url);
  status.show("Link copied");
};

const upload = async () => {
  try {
    await send(file);
    toast.show({ title: "Uploaded", description: file.name, tone: "success" });
  } catch {
    toast.show({
      title: "Upload failed",
      description: "Try again from the file row",
      tone: "error",
    });
  }
};

<p {...status.statusProps}>{status.message()}</p>;

<div {...toast.regionProps} tabindex={-1}>
  <For each={toast.toasts()}>
    {(item) => (
      <div {...toast.toastProps(item.id)}>
        <p>{item.title}</p>
        <p>{item.description}</p>
        <button type="button" onClick={() => toast.dismiss(item.id)}>
          Dismiss
        </button>
      </div>
    )}
  </For>
</div>;

Popover

createPopover is the non-modal overlay: an anchored surface a trigger opens, dismissed by a click on the trigger, an outside pointerdown or Escape, with focus moving into it and back to the trigger. There is no APG pattern for a popover (APG has Dialog, which is modal), so there is no Quint spec and test/popover.browser.test.tsx is the oracle. It is copied from Base UI's Popover (the trigger click toggle, Enter / Space / ArrowDown, light dismiss on an outside pointerdown that does not steal focus) and React Aria's usePopover (focus in on open, back on close, role="dialog" without aria-modal, a placement that flips at the viewport edge).

const popover = createPopover({ placement: "bottom-start" });
let trigger!: HTMLButtonElement;
let content!: HTMLDivElement;

onMount(() => {
  const teardown = popover.attach(trigger, content);
  onCleanup(teardown);
});

<button {...popover.triggerProps} ref={(element) => (trigger = element)}>Filters</button>
<div {...popover.contentProps} style={popover.contentStyle()} ref={(element) => (content = element)}>
  …
</div>;

Drawer

createDrawer is the drawer / sheet shell: an edge-anchored panel over the Dialog (Modal) semantics, with the same focus, Escape, scroll-lock and backdrop behaviour as createConfirm. No APG pattern exists for a drawer or a bottom sheet, and docs/bottom-sheet.md settled that the library composes rather than adding a sheet primitive: the semantics are Dialog (Modal), the position, the slide and the snap points are the host's native CSS, and this is the panel both were missing. test/drawer.browser.test.tsx is the oracle.

const drawer = createDrawer({ side: "right", labelledby: "nav-title" });

<button {...drawer.triggerProps}>Menu</button>;
<div {...drawer.backdropProps} />;
<div {...drawer.contentProps}>
  <h2 id="nav-title">Site</h2>
  <nav>{/* links */}</nav>
</div>;

Diagram

createDiagramFocus is the readable twin of a canvas: the same nodes and edges, positioned by the host, as one roving tab stop plus a keyboard cursor over the outgoing edges, with a polite live region saying where the user is. The APG has no pattern for a diagram (a graph is not one of the 44 patterns), so there is no Quint spec and no ported scenarios: test/diagram.browser.test.tsx is its oracle. What it borrows is the grid's roving tabindex (exactly one node in the tab order, so Tab leaves the composite), WAI-ARIA's aria-roledescription="node" on each role="button", and the role="status" / aria-live="polite" region of createStatus for the announcement.

const nodes = [
  { id: "payment", label: "Payment", x: 0, y: 0, width: 160, height: 80 },
  { id: "pending", label: "Pending", x: 260, y: 0, width: 160, height: 80 },
  { id: "failed", label: "Failed", x: 260, y: 140, width: 160, height: 80 },
];
const edges = [
  { id: "submit", from: "payment", to: "pending", label: "submit" },
  { id: "fail", from: "payment", to: "failed" },
];
const diagram = createDiagramFocus({
  nodes,
  edges,
  onActivate: (id) => select(id),
  onEdgeActivate: (id) => fire(id),
  // the graph is the host's: `c` and Enter, or a drag, only say which pair was asked for
  onConnect: (from, to) => setEdges((all) => [...all, { id: nextId(), from, to }]),
});

<div role="group" aria-label="Checkout state chart">
  <div style={{ position: "relative" }}>
    <For each={nodes}>
      {(node) => (
        <button
          {...diagram.nodeProps(node.id)}
          style={{ position: "absolute", left: node.x, top: node.y }}
        >
          {node.label}
        </button>
      )}
    </For>
    <For each={edges}>
      {(edge) => (
        <button {...diagram.edgeProps(edge.id)} style={{ position: "absolute" }}>
          {edge.label}
        </button>
      )}
    </For>
  </div>
  <p {...diagram.statusProps}>{diagram.status()}</p>
</div>;

Hotkeys

createHotkeys is a platform utility, not a widget: one registry for the chords every app hand-rolls (the docs app's / and Cmd/Ctrl+K, the CMS's Cmd/Ctrl+S). No APG pattern exists for a keyboard registry, so there is no role, no element, no styling and no Quint spec; test/hotkeys.browser.test.tsx is the oracle.

const hotkeys = createHotkeys();

onSettled(() => {
  hotkeys.bind({
    keys: "mod+k",
    onTrigger: () => searchEl.focus(),
  });
  hotkeys.bind({
    keys: "/",
    when: () => !dialog().open,
    onTrigger: () => searchEl.focus(),
  });
  hotkeys.bind({
    keys: "mod+s",
    scope: editorEl,
    onTrigger: () => save(),
  });
  return () => hotkeys.dispose();
});

Collisions with the browser's own chords: preventDefault reaches the page's default action, not the browser's. Cmd/Ctrl+S (Save Page), Cmd/Ctrl+K (the browser's search, in Chrome and Firefox), Cmd/Ctrl+P and / (Firefox's quick find) can be cancelled by a page, and a host that binds one is choosing to take it from the browser; Cmd/Ctrl+T, Cmd/Ctrl+W, Cmd/Ctrl+N, Cmd/Ctrl+L and F11 are reserved and cannot be intercepted, so a chord built on them never fires. keys takes any of them the same and says nothing.

Scroll progress

createScrollProgress is the scroll position of a container as a fraction, for a reading-progress bar or a value a canvas renders by hand. No APG pattern exists for a progress bar driven by scrolling, so there is no Quint spec and no ported scenarios: the contract is WAI-ARIA (role="progressbar", aria-valuemin/max/now) and HTML, and test/scrollprogress.browser.test.tsx is its oracle.

const reading = createScrollProgress({ root: () => pane });
onSettled(() => reading.attach()); // returns the teardown

<div class="track">
  <div {...reading.barProps} style={`scale: ${reading.progress()} 1`} />
</div>;

Scrollspy

createScrollspy is a table of contents whose current entry is the last heading to reach the top of the scrollport. No APG pattern exists for a scrollspy (the APG has no table-of-contents pattern), so there is no Quint spec and no ported scenarios: the contract is WAI-ARIA — aria-current="location" on the current link, exactly one link at a time, role="list" / role="listitem" for the list, and a named navigation landmark — plus HTML (#id targets). test/scrollspy.browser.test.tsx is its oracle.

const toc = createScrollspy({
  entries, // { id, label } in document order: the ids are the headings'
  offset: 96, // a sticky header's height
  onChange: (id) => track(id),
});

onSettled(() => toc.attach()); // returns the teardown

<nav {...toc.navProps}>
  <ul {...toc.listProps}>
    <For each={entries}>
      {(entry) => (
        <li {...toc.itemProps(entry.id)}>
          <a {...toc.linkProps(entry.id)}>{entry.label}</a>
        </li>
      )}
    </For>
  </ul>
</nav>;

Virtualiser

createVirtualizer renders a window of a long list instead of the list: the visible rows plus an overscan, with two spacer boxes standing in for the rows above and below, so the content height, the scroll's clamp and its thumb stay the whole list's. It ports the rules the native renderer already had (native/solid/src/virtual.ts): the arithmetic of a fixed row, the measured mode that declares everything until every height is in and then virtualises, the gap-compensated spacers (above = first·(item + gap) − gap), no spacer at an end, and OVERSCAN two. The DOM adds the scrollport (attach), the ResizeObserver that reads the heights (the native renderer reads a row's box from ui.bounds after layout), and the ARIA pair. There is no APG pattern for virtualisation and no Quint machine — the state is pixels — so test/virtual.browser.test.tsx is the oracle.

const list = createVirtualizer({
  count: () => rows().length, // 10 000: the whole list, not the window
  itemSize: 40, // fixed rows; omit it (or pass an estimate per index) to measure
  gap: 4,
});

const range = createMemo(() => {
  const at = list.window();
  return Array.from({ length: at.last - at.first + 1 }, (_, step) => at.first + step);
});

<div class="port" {...list.scrollProps} ref={(element) => list.attach(element)}>
  <div class="column">
    <Show when={list.window().above > 0}>
      <div {...list.spacerProps("start")} />
    </Show>
    <For each={range()}>
      {(index) => (
        <div role="listitem" {...list.itemProps(index)}>
          {rows()[index]?.title}
        </div>
      )}
    </For>
    <Show when={list.window().below > 0}>
      <div {...list.spacerProps("end")} />
    </Show>
  </div>
</div>;
.port {
  height: 600px;
  overflow: auto;
}
.column {
  display: flex;
  flex-direction: column;
  row-gap: 4px; /* the option's gap */
}
bun run test -- virtual # the 10,000-row list, the measured pass, the count change

Command palette

The first composition on the primitives — no new widget, no new spec: createCommandPalette is createDialogModal (a modal dialog) + createTextInput (the field) + createStatus (the count), wired into the shape docs/research/compositions-2026-10.md settles.

const palette = createCommandPalette({
  commands, // ReadonlyArray<{ id, label, group?, keywords?, run(): void | Promise<void> }>
  hotkey: "mod+k", // what attach() binds; this is the default
  labels: { title: t("palette"), placeholder: t("search"), empty: t("empty") },
});

onSettled(() => palette.attach()); // one document hotkey; returns the teardown

const groups = () => [...new Set(palette.results().map((result) => result.group ?? ""))];

<button
  aria-haspopup="dialog"
  aria-expanded={palette.open()}
  onClick={() => palette.openPalette()}
>
  Commands
</button>
<div {...palette.backdropProps} />
<div {...palette.dialogProps}>
  <h2 {...palette.titleProps}>{palette.labels.title}</h2>
  <input {...palette.inputProps} />
  <div {...palette.listProps}>
    <For each={groups()}>
      {(group) => (
        <section>
          <h3>{group}</h3>
          <For each={palette.results().filter((result) => result.group === group)}>
            {(result) => <div {...palette.optionProps(result.id)}>{result.label}</div>}
          </For>
        </section>
      )}
    </For>
  </div>
  <p {...palette.emptyProps}>{palette.labels.empty}</p>
  <div {...palette.statusProps}>{palette.status()}</div>
</div>;

Filterable menu

The second composition, again no new widget and no new spec: createFilterableMenu is createDialogModal (the popup, announced as a dialog) + createTextInput (the field) + createStatus (the count), with one filtered role=menu beside the field. It follows Base UI's Building a filterable menu that works for everyone, which docs/research/compositions-2026-10.md settles for us.

const menu = createFilterableMenu({
  items: actions, // ReadonlyArray<{ id, label, group?, submenu?, run }> or a getter
  labels: { placeholder: t("filter"), empty: t("noneFound"), clear: t("clear") },
});

const groups = () => [...new Set(menu.results().map((row) => row.group ?? ""))];

<button {...menu.triggerProps}>Actions</button>
<Show when={menu.open()}>
  <div {...menu.backdropProps} />
  <div {...menu.dialogProps}>
    <h2 {...menu.titleProps}>{t("actions")}</h2>
    <input {...menu.inputProps} />
    <button {...menu.clearProps}>×</button>
    <div {...menu.menuProps}>
      <For each={groups()}>
        {(group) => (
          <div {...menu.groupProps(group)}>
            <h3 {...menu.groupLabelProps(group)}>{group}</h3>
            <For each={menu.results().filter((row) => (row.group ?? "") === group)}>
              {(row) => (
                <div
                  {...(row.hasSubmenu
                    ? menu.submenuTriggerProps(row.id)
                    : menu.itemProps(row.id))}
                >
                  {row.label}
                </div>
              )}
            </For>
          </div>
        )}
      </For>
    </div>
    <p {...menu.emptyProps}>{menu.emptyProps.text}</p>
    <div {...menu.statusProps}>{menu.status()}</div>
  </div>
</Show>;

Date picker

The second composition — no new primitive and no new spec: createDatePicker is createPopover (a non-modal trigger and popup) around a createGrid month (6 rows of 7 days), with createStatus for the selected day. The research (docs/research/compositions-2026-10.md, "Date picker") settles the shape; test/date-picker.browser.test.tsx is the oracle.

const picker = createDatePicker({
  value: iso, // controlled ISO YYYY-MM-DD; or defaultValue
  onValueChange: (next) => save(next), // a request: a controlled host may ignore it
  min: "2026-01-01", // inclusive, ISO
  max: "2026-12-31",
  today: "2026-10-15", // injectable; the local date by default, so a test never reads the clock
  firstDayOfWeek: 1, // Monday; 0 = Sunday
  labels: { trigger: "Choose date", month: (year, month) => formatMonth(year, month) },
});

onSettled(() => picker.attach(triggerEl, popoverEl)); // the popover wiring + focus; returns the teardown

<button {...picker.triggerProps}>{formatDate(picker.value())}</button>
<div {...picker.popoverProps}>
  <button {...picker.previousProps}>‹</button>
  <h2 {...picker.headerProps}>{picker.headerProps.text}</h2>
  <button {...picker.nextProps}>›</button>
  <div {...picker.gridProps}>
    <div role="row">
      <For each={[0, 1, 2, 3, 4, 5, 6]}>{(index) => <div {...picker.weekdayProps(index)} />}</For>
    </div>
    <For each={picker.monthDays()}>
      {(week) => (
        <div role="row">
          <For each={week}>{(day) => <div {...picker.cellProps(day)}>{day.slice(8)}</div>}</For>
        </div>
      )}
    </For>
  </div>
</div>
<div {...picker.statusProps}>{picker.status()}</div>;

Commands

cd packages/headless
bun run test       # vp test run: vitest browser mode, real Chromium (playwright; needs the browser installed: bunx playwright install chromium)
bun run typecheck  # effect-tsrs
bun run build      # vp pack: dist/ (ESM and declarations; solid-js is a peer)

The browser runs at 1280x1024 (vite.config.ts): Vitest 5 defaults to a 414x896 viewport, and the canvas tests drag across a 1024 px viewport and measure how far content-visibility: auto looks ahead. The menu, treeview and listbox differential walks are slow, and can time out on a loaded machine; run them alone (bun run test test/menu.browser.test.tsx) before calling a failure real.

The specs, bridges and scenarios the tests replay are @cssints/apg-specs (a workspace dev dependency, published as its own package).

Status

Published with the Changesets fixed group (one version with the other packages, RELEASING.md). Its manifest follows the other packages (development condition on src, dist for consumers, publishConfig.directory).

Solid 2 reminders: setters apply on the microtask flush (the DOM driver waits a frame after each step); pass props objects/getters, never destructure options.

Research