One state and slot model across the library: native DOM props plus these names.
Selections: value (controlled, null = none) or defaultValue, reported by onValueChange(value) only when it changes.
Popups and disclosures: open or defaultOpen, reported by onOpenChange(open); Escape and outside press close.
Checkboxes and switches: checked (controlled) or defaultChecked, reported by onCheckedChange(checked).
Toggle buttons: pressed or defaultPressed, reported by onPressedChange(pressed) (aria-pressed).
Closable surfaces call onClose(); closeLabel names the close button (localized default).
href renders a real link through PixxlProvider linkComponent; asChild puts the styling on your element; renderLink(props, item) for per-item routers.
Field state on the control: label, invalid, disabled, readOnly, required; FormField wires ids and messages.
Content slots take any React node: title, description, actions, footer, leading, trailing.
Look only, rendered as data-* attributes: size, tone, variant, density, padding, elevation, orientation, placement.
Activating an item (menu, command, already-selected day) calls onAction(id); it is not a state change.
What each part of the vocabulary means. Deprecated names keep working until 0.4.
| Topic | Rule |
|---|---|
| State | Every stateful prop is controlled (value) or uncontrolled (defaultValue), with onValueChange. Booleans use their own word: open/defaultOpen/onOpenChange, checked/defaultChecked/onCheckedChange, pressed/defaultPressed/onPressedChange. Secondary state is prefixed: inputValue, sort/defaultSort/onSortChange, selectedRows, expandedValue. |
| Empty and unchanged | null is the controlled "nothing selected"; undefined means uncontrolled (switching logs a development warning). Change callbacks fire only when the value changes; re-choosing the current item is an onAction. |
| Commands | Activations report onAction(id): menus, menubar, context menu, action bar, command palette, list boxes in selectionMode="none", and the choice of a day or tree item (also when it is already selected). |
| Links | PixxlProvider linkComponent (e.g. next/link) renders every navigating link. renderLink(props, item) overrides one component: spread props. Items with href are links, items without are buttons. asChild renders your element with the component’s props merged in. |
| Elements | className, style, ref and other attributes go to the component’s main element; inner parts take *Props (backdropProps, inputProps, listProps) or classNames. Form controls keep ref, id and native attributes on the native input and put className/style on the outermost element. |
| Visuals | size: xs, sm, md, lg (icons: sm, md, lg or px). tone: neutral, primary, danger, success, warning, info. variant: solid, secondary, soft, outline, ghost. gap: none, xs, sm, md, lg. placement: start/end follow the writing direction, left/right are physical. orientation: horizontal or vertical. |
| Fields | label is visible text that also names the control; aria-label names it without visible text (item objects use ariaLabel). Booleans: disabled, invalid, readOnly, required — a FormField sets invalid, required and the ids for you. |
| Types | Every component exports <Name>Props. Rendered slots (title, description, content) are ReactNode. Generic components infer their types: DataTable rows, TableTree items, and Value ids on Tabs, RadioGroup, Select and Combobox. |
// Controlled: you own the state.
<Tabs items={items} onValueChange={setTab} value={tab} />
<Dialog onOpenChange={setOpen} open={open} title="Settings" />
// Uncontrolled: the component owns it, you are told about changes.
<Tabs defaultValue="overview" items={items} onValueChange={track} />
<Dialog defaultOpen={false} title="Settings" trigger={<Button>Open</Button>} />