/terracotta:terracottafrom terracotta
Build accessible UI with Terracotta, the headless component library for SolidJS. Covers component catalogue, subpath imports, controlled/uncontrolled state, render props, `as` prop, prop passthrough, `tc-*` styling attributes, transitions, and keyboard/focus behavior.
Ships in terracotta. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A headless UI library for SolidJS. Each component ships behaviour, keyboard handling and ARIA wiring, and no styles. You own the markup and the CSS; the library owns the accessibility.
This skill describes Terracotta 2.x, which requires Solid 2
(solid-js and @solidjs/web, both ^2.0.0-rc.13, as peer dependencies).
For Terracotta 1.x on Solid 1, see 1.x differences.
There is no root entry. Every component group publishes its own subpath, and
importing from 'terracotta' will not resolve:
import { Disclosure, DisclosureButton, DisclosurePanel } from 'terracotta/disclosure';
import { useDisclosureState } from 'terracotta/states';
A snippet that draws on more than one group needs one import per subpath.
On Solid 2 the JSX namespace and the JSX runtime live in @solidjs/web, not in
solid-js. Import the type from there, and set jsxImportSource to
@solidjs/web; solid-js publishes no ./jsx-runtime entry, so the Solid 1
habit fails to resolve.
import type { JSX } from '@solidjs/web';
import { createSignal, For } from 'solid-js';
Each component's shape, under the subpath it is imported from. Anything a block does not show is named after it.
// terracotta/accordion
<Accordion> {/* owns the selection, handles arrow keys */}
<AccordionItem> {/* one section, carries the value */}
<AccordionHeader> {/* heading wrapper */}
<AccordionButton/>{/* selects this item */}
</AccordionHeader>
<AccordionPanel/> {/* shown while this item is selected */}
</AccordionItem>
</Accordion>
// terracotta/alert-dialog
<AlertDialog> {/* role="alertdialog" aria-modal */}
<AlertDialogOverlay/> {/* backdrop; closes on click */}
<AlertDialogPanel> {/* focus trap */}
<AlertDialogTitle/> {/* labels the dialog */}
<AlertDialogDescription/> {/* describes the dialog, and is announced */}
</AlertDialogPanel>
</AlertDialog>
// terracotta/alert
<Alert/> {/* role="alert": announced the moment it appears */}
// terracotta/breadcrumb
<Breadcrumb> {/* <nav>, named "Breadcrumb" */}
<BreadcrumbList> {/* <ol> */}
<BreadcrumbItem>{/* <li> */}
<BreadcrumbLink current/>{/* <a>, aria-current="page" when current */}
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
// terracotta/button
<Button/> {/* role="button", keyboard-activated, disabled-aware */}
// terracotta/checkbox
<Checkbox> {/* owns the check state */}
<CheckboxIndicator/> {/* role="checkbox", toggles on click */}
<CheckboxLabel/> {/* labels the indicator */}
<CheckboxDescription/>{/* describes the indicator */}
</Checkbox>
// terracotta/color-scheme
<ColorSchemeProvider>{/* renders no element, context only */}
{/* useColorScheme() / usePreferredColorScheme() work anywhere below */}
</ColorSchemeProvider>
// also exported: useColorScheme, useNativeColorScheme, usePreferredColorScheme
// terracotta/combobox
<Combobox matchBy>{/* owns both states */}
<ComboboxLabel/> {/* names the combobox */}
<ComboboxInput/> {/* role="combobox", drives the query */}
<ComboboxOptions>{/* role="listbox" */}
<ComboboxOption/>
</ComboboxOptions>
</Combobox>
// terracotta/command-bar
<CommandBar> {/* role="dialog", Cmd/Ctrl+K opens it */}
<CommandBarOverlay/> {/* backdrop; closes on click */}
<CommandBarPanel> {/* focus trap */}
<CommandBarTitle/> {/* labels the dialog */}
<CommandBarDescription/> {/* describes the dialog */}
{/* usually a <Command> here */}
</CommandBarPanel>
</CommandBar>
// terracotta/command
<Command matchBy>{/* owns the query and the selection */}
<CommandLabel/>{/* names the input and the list */}
<CommandInput/>{/* role="combobox", drives the query */}
<CommandOptions>{/* role="listbox", always visible */}
<CommandOption/>
</CommandOptions>
</Command>
// terracotta/context-menu
<ContextMenu> {/* owns the open state */}
<ContextMenuBoundary/>{/* right-clicking here opens the menu */}
<ContextMenuOverlay/> {/* optional backdrop; closes on click */}
<ContextMenuPanel/> {/* the menu content */}
</ContextMenu>
// terracotta/dialog
<Dialog> {/* role="dialog" aria-modal, owns open state */}
<DialogOverlay/> {/* backdrop; closes on click */}
<DialogPanel> {/* focus trap */}
<DialogTitle/> {/* labels the dialog */}
<DialogDescription/> {/* describes the dialog */}
</DialogPanel>
</Dialog>
// terracotta/disclosure
<Disclosure> {/* owns the open/closed state */}
<DisclosureButton/> {/* toggles it */}
<DisclosurePanel/> {/* shown while open */}
</Disclosure>
// terracotta/feed
<Feed size busy> {/* owns size/busy, focus in and out of the feed */}
<FeedLabel/> {/* names the feed */}
<FeedContent> {/* role="feed", handles PageUp/PageDown */}
<FeedArticle index> {/* one article, focusable */}
<FeedArticleLabel/> {/* names the article */}
<FeedArticleDescription/>
</FeedArticle>
</FeedContent>
</Feed>
// terracotta/grid
<Grid> {/* <table role="grid">, the tab stop */}
<GridHead> {/* <thead role="rowgroup"> */}
<GridRow> {/* <tr role="row"> */}
<GridColumnHeader/> {/* <th role="columnheader"> */}
</GridRow>
</GridHead>
<GridBody> {/* <tbody role="rowgroup"> */}
<GridRow>
<GridRowHeader/> {/* <th role="rowheader"> */}
<GridCell/> {/* <td role="gridcell"> */}
</GridRow>
</GridBody>
<GridFoot/> {/* optional; <tfoot role="rowgroup"> */}
</Grid>
// terracotta/listbox
<Listbox> {/* owns both states */}
<ListboxLabel/> {/* names the listbox */}
<ListboxButton/> {/* toggles the popup, shows the value */}
<ListboxOptions> {/* role="listbox", keyboard navigation */}
<ListboxOption/>
</ListboxOptions>
</Listbox>
// terracotta/menu
<Menu> {/* role="menu", arrow keys and type-ahead */}
<MenuItem/>{/* role="menuitem" */}
</Menu>
<Menubar> {/* role="menubar", one tab stop */}
<MenuItem/>
</Menubar>
// also exported: MenuChild
// terracotta/meter
<Meter> {/* role="meter", the value and range */}
<MeterLabel/>{/* optional; names the meter */}
</Meter>
// terracotta/popover
<Popover> {/* owns the open state */}
<PopoverButton/> {/* toggles it, anchors the panel */}
<PopoverOverlay/>{/* optional backdrop; closes on click */}
<PopoverPanel/> {/* the floating content */}
</Popover>
// terracotta/radio-group
<RadioGroup> {/* role="radiogroup", owns the value */}
<RadioGroupLabel/> {/* names the group */}
<RadioGroupDescription/> {/* describes the group */}
<RadioGroupOption> {/* role="radio" */}
<RadioGroupLabel/> {/* names this option */}
<RadioGroupDescription/>{/* describes this option */}
</RadioGroupOption>
</RadioGroup>
// terracotta/select
<Select> {/* role="listbox", owns the selection */}
<SelectOption/>{/* role="option" */}
</Select>
// terracotta/slider
<Slider> {/* owns the value, min, max and step */}
<SliderLabel/> {/* optional; names the thumb */}
<SliderTrack> {/* press and drag to set the value */}
<SliderThumb/>{/* role="slider", focusable */}
</SliderTrack>
</Slider>
// also exported: SliderStateChild, useSliderState
// terracotta/spinbutton
<Spinbutton> {/* owns the value, limits and step */}
<SpinbuttonLabel/> {/* optional; names the field */}
<SpinbuttonDecrement/> {/* optional; out of the tab sequence */}
<SpinbuttonInput/> {/* role="spinbutton", the only tab stop */}
<SpinbuttonIncrement/> {/* optional; out of the tab sequence */}
</Spinbutton>
// also exported: SpinbuttonStateChild, useSpinbuttonState
// terracotta/splitter
<Splitter> {/* owns the size of the primary pane */}
<SplitterPane/> {/* the primary pane */}
<SplitterSeparator/> {/* role="separator", focusable, draggable */}
<div/> {/* the other pane; no component needed */}
</Splitter>
// also exported: SplitterStateChild, useSplitterState
// terracotta/switch
<Switch/> {/* role="switch" aria-checked, owns the checked state */}
// terracotta/tabs
<TabGroup horizontal>{/* owns the selected value and the shared ids */}
<TabList> {/* role="tablist", handles arrow keys */}
<Tab/> {/* role="tab" */}
</TabList>
<TabPanel/> {/* role="tabpanel", matched to a Tab by value */}
</TabGroup>
// terracotta/toast
<Toaster> {/* role="status" aria-live="polite"; holds the queue */}
<Toast/> {/* one message; no live role of its own */}
</Toaster>
// also exported: ToasterStore, useToaster
// terracotta/toggle
<Toggle/> {/* role="button" aria-pressed, owns the pressed state */}
// terracotta/toolbar
<Toolbar> {/* role="toolbar", one tab stop, arrow-key navigation */}
{/* any focusable controls */}
</Toolbar>
// terracotta/tooltip
<Tooltip> {/* owns the open state and the delays */}
<TooltipTrigger/>{/* the described control */}
<TooltipPanel/> {/* role="tooltip" */}
</Tooltip>
// terracotta/transition
<Transition show> {/* provides `show` and transitions itself */}
<TransitionChild/>{/* optional: extra elements sharing the same show flag */}
</Transition>
// terracotta/tree
<Tree> {/* role="tree", owns selection and expansion */}
<TreeItem> {/* role="treeitem" */}
<TreeItemLabel/>{/* names the item */}
<TreeGroup> {/* role="group"; makes the item a parent */}
<TreeItem/>
</TreeGroup>
</TreeItem>
</Tree>
// also exported: useParentTreeItem
// terracotta/treegrid
<TreeGrid> {/* <table role="treegrid">, owns expansion */}
<TreeGridHead> {/* <thead role="rowgroup"> */}
<TreeGridHeaderRow> {/* a header row; does not take focus */}
<TreeGridColumnHeader/>
</TreeGridHeaderRow>
</TreeGridHead>
<TreeGridBody> {/* <tbody role="rowgroup"> */}
<TreeGridRow value level expandable>{/* role="row", takes focus */}
<TreeGridCell/> {/* role="gridcell" */}
</TreeGridRow>
</TreeGridBody>
</TreeGrid>
// also exported: TreeGridStateChild, useTreeGridState
Pick by pattern, not by name: Listbox is a dropdown (button plus popup),
Select is an always-visible listbox, Command is an always-visible filtered
listbox, and Combobox is a text input with a filtered popup.
Terracotta chooses between the two by looking at which prop you passed. The choice is made once, at creation — never switch a component between them at runtime.
| Uncontrolled | Controlled | Components |
|---|---|---|
defaultOpen | isOpen | Disclosure, Dialog, AlertDialog, Popover, ContextMenu, CommandBar, Listbox, Combobox |
defaultValue | value | Accordion, Select, Listbox, Combobox, Command, RadioGroup, TabGroup |
defaultChecked | checked | Checkbox |
defaultPressed | pressed | Toggle |
A controlled component never writes its own state: it calls onChange and
nothing moves until you update the value you passed in. If a click appears to do
nothing, check that onChange writes back to the signal.
Listbox and Combobox hold two states, so their callbacks are named for which
one moved: onSelectChange and onDisclosureChange.
children may be a function that receives the component's state:
<Disclosure defaultOpen={false}>
{({ isOpen }) => <DisclosureButton>{isOpen() ? 'Hide' : 'Show'}</DisclosureButton>}
</Disclosure>
The rule differs by position:
() => <span /> renders as-is; state => <span /> is
called with the state.State values are accessors — call them (isOpen(), not isOpen).
as picks the element or component each part renders. It accepts an
intrinsic tag or any Solid component, and the props type follows it, so
as="a" also accepts href. Behaviour comes from the component, not the tag:
a Button rendered as="div" still handles Enter and
Space.
Prop passthrough: anything the component does not consume itself reaches the
rendered element — class, classList, style, id, data-*, DOM event
handlers. Terracotta strips its own props first, so they never leak into the DOM.
ref is assigned from an effect rather than written directly, so a ref
callback runs in a reactive scope and may contain createEffect. Not every part
accepts one.
unmount controls hidden content:
| Value | Behaviour |
|---|---|
true (default) | Children are removed while hidden and rebuilt when shown. |
false | Children are always rendered; you hide them yourself. |
'offscreen' | Children are built once and reused, detached while hidden. |
'offscreen' keeps a subtree's state across toggles, but a detached subtree is
still mounted: its effects keep running and it has no layout, so
getBoundingClientRect() reads zeroes. Use it for subtrees expensive to
build, not expensive to run.
State reaches CSS through tc- attributes. Terracotta never touches class.
| Attribute | Values | Meaning |
|---|---|---|
tc-disabled | "" when disabled | Interaction blocked; focus navigation skips it. |
tc-expanded | "" when open | Disclosure-like state is open. |
tc-checked | "" checked, "mixed" indeterminate, absent unchecked | Checkbox / radio state. |
tc-selected | "" when selected | Option, tab or item is the selected value. |
tc-active | "" when active | Holds focus within its group. |
tc-pressed | "" when pressed | Toggle button state. |
tc-matches | "" when matching the query | Combobox / Command filtering. |
tc-has-selected / tc-has-active / tc-has-query | "" | A descendant is selected / active; the query is non-empty. |
tc-transition | enter-from, enter-to, entered, leave-from, leave-to | Current phase of a TransitionChild. |
Every part also stamps a marker named after itself (tc-dialog,
tc-listbox-option, …). Booleans are empty-string-when-on, absent-when-off, so
a bare attribute selector is the test:
.option[tc-active] {
background: #eff6ff;
}
.option[tc-selected] {
font-weight: 600;
}
[tc-checked='mixed'] {
/* indeterminate */
}
Transition applies enter and leave classes around a show prop and keeps
children mounted until the leave finishes. It only adds and removes classes —
the animation is yours to write. TransitionChild follows its parent instead of
its own show, so a group animates together.
<Transition
show={isOpen()}
enter="fade"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="fade"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<PopoverPanel unmount={false}>…</PopoverPanel>
</Transition>
Points that matter:
appear to run its enter on the
first render.show mid-flight reverses immediately.inert, so it leaves the tab order and the
accessibility tree while it animates out.transitionend,
so an element with nothing to animate advances on its own.aria-activedescendant. Style the
highlight from tc-active, never from :focus.Loading boundary or any async source —
has nothing to offer at that moment and is not asked again. Keep a focusable
element outside the boundary (a close button), or hoist the boundary above the
component.Every stateful component is a shell around a reactive store, and the stores are
exported from terracotta/states. Each ships three names: create…State to
make one, use…State to read the nearest from context, and …StateChild to
reach it from a render prop.
Disclosure (open/closed), Toggle (pressed), Check (tri-state), Input (a string), Select (selected plus active), SelectOption, Autocomplete (select plus a debounced query), AutocompleteOption.
import { useDisclosureState } from 'terracotta/states';
function CloseButton() {
const state = useDisclosureState();
return <button onClick={() => state.close()}>Close</button>;
}
Using a use…State() hook outside its component throws with a message naming
both components.
SSR-safe: DOM work happens in effects, which do not run on the server. Markup and ARIA render server-side; listeners, focus and measurement wire up on hydration.
ColorSchemeProvider is the exception worth planning for. It reads
localStorage and mutates documentElement from effects, so the first paint
uses your CSS default and the provider corrects it after hydration. Avoid the
flash with an inline script in <head> that reads the same theme-preference
key.
'terracotta'. There is no root entry; use the subpath.JSX from 'solid-js'. On Solid 2 it comes from '@solidjs/web'.isOpen instead of isOpen().isOpen but no onChange, then wondering why nothing opens.:focus. Use [tc-active].tc-checked to be "true"/"false". Booleans are empty-string or
absent; only tc-checked has a third value, "mixed".unmount={false} to keep a panel alive for a transition when
Transition already handles it, including the inert marking.Loading boundary around a panel's only focusable content and
expecting focus to land in it.Terracotta 1.x targets Solid 1 and does have a root entry, so
import { Dialog } from 'terracotta' is correct there. Solid 1 code also uses
Suspense and createResource where the notes above say Loading and an async
memo. Everything else in this skill — parts, as, tc-* attributes, controlled
and uncontrolled props, keyboard behaviour — applies to both.
The full documentation ships with this skill, under
references/. It is a copy of the repository's docs/,
generated rather than rewritten, so it says exactly what the maintained docs
say.
Read the page for the component you are working on before writing anything
non-trivial — each one carries its parts, every prop, the keyboard bindings, the
tc- attributes it writes, and worked markup with CSS:
references/components/<name>.md — one page per component, named after its
subpath (dialog, listbox, radio-group, …)references/states.md — the state primitives in fullreferences/guides/ — rendering, state, styling, keyboard and focus, SSRThis page is the part that is not in the docs: the shape of the API an agent needs before it starts, and the mistakes worth not making. The references are the authority on everything else.
references/README.md (opens in a new tab)references/components/accordion.md (opens in a new tab)references/components/alert-dialog.md (opens in a new tab)references/components/alert.md (opens in a new tab)references/components/breadcrumb.md (opens in a new tab)references/components/button.md (opens in a new tab)references/components/checkbox.md (opens in a new tab)references/components/color-scheme.md (opens in a new tab)references/components/combobox.md (opens in a new tab)references/components/command-bar.md (opens in a new tab)references/components/command.md (opens in a new tab)references/components/context-menu.md (opens in a new tab)references/components/dialog.md (opens in a new tab)references/components/disclosure.md (opens in a new tab)references/components/feed.md (opens in a new tab)references/components/grid.md (opens in a new tab)references/components/listbox.md (opens in a new tab)references/components/menu.md (opens in a new tab)references/components/meter.md (opens in a new tab)references/components/popover.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub lxsmnsyc/terracotta --plugin terracottaOther plugins' skills for the same job