API reference for agents
@codeui/solid v0.3.0
Imports, signatures, and limits of @codeui/solid in one page, for coding agents.
This page is for coding agents that generate UI with @codeui/solid. It lists the import paths, the rules generated code must follow, and every component with its main props. Each component name links to its full page.
Read this site as Markdown
| URL | Content |
|---|---|
/llms.txt | An index of every kit page, grouped as in the sidebar, with a one-line description and a link to its Markdown. It starts with the install line and the import rules. |
/llms-full.txt | Every kit page in one file. The Inkstone design pages are left out. |
/docs/<page>.md | One page as Markdown, such as /docs/components/select.md. Demos are replaced by their source code, and props tables by Markdown tables. |
/docs/<page>.txt | The same text as the .md route, served as plain text. |
Start with /llms.txt. Fetch the .md of each component you use before you write code with it.
The kit package also ships its design specification as node_modules/@codeui/solid/DESIGN.md. Read it before you build a new screen.
Import map
| Import from | What it holds | Use it for |
|---|---|---|
@codeui/solid | Every ready component, the option helpers, field helpers, icons, SvgIcon, mergeClasses, and the token objects | Almost everything |
@codeui/solid/<name> | The ready component and its public types and helpers | Import a single component |
@codeui/solid/<name>/parts | The styled parts of one component, its part name map, and its style functions | A layout the ready component cannot give |
@codeui/solid/tokens | tokens, themeVars, themeTokens, layoutVars, breakpoints, responsiveStyle. No component. | vanilla-extract .css.ts files, which run in Node |
See Ready or parts for supported component entry points.
Import parts as a namespace:
import * as D from "@codeui/solid/dialog/parts";The app needs Solid 2, @solidjs/web, and @solidjs/vite-plugin. See Installation.
Rules for generated code
import { Button, createToaster, Select, Stack, Switch, Text, Toaster } from "@codeui/solid";
import { createSignal } from "solid-js";
import "./export-panel.css";
const formats = ["PNG", "SVG", "JPEG"];
export default function ExportPanel() {
const notifications = createToaster();
const [format, setFormat] = createSignal("PNG");
const [lineNumbers, setLineNumbers] = createSignal(true);
return (
<Stack as="section" gap="4" class="export-panel" aria-labelledby="export-title">
<Text as="h3" id="export-title" size="md" weight="semibold">
Export snippet
</Text>
<Select
aria-label="Format"
label="Format"
options={formats}
value={format()}
onChange={value => value && setFormat(value)}
/>
<Switch label="Show line numbers" checked={lineNumbers()} onChange={setLineNumbers} />
<Button
variant="primary"
onClick={() =>
notifications.show({ tone: "success", description: `hello-world.${format().toLowerCase()} exported` })
}
>
Export
</Button>
<Toaster toaster={notifications} closeLabel="Dismiss" />
</Stack>
);
}/* App CSS reads only --cui-* tokens, and stays unlayered so it wins over the kit. */
.export-panel {
background: var(--cui-surface-panel);
border-radius: var(--cui-radius-card);
padding: var(--cui-space-4);
max-width: 360px;
}Follow every rule. A reviewer rejects code that breaks one.
- Use a ready component first. Compose parts only when the ready component cannot give the layout. Ready or parts explains the choice.
- Read values from tokens. Write colors, radii, spacing, font sizes, shadows, and durations as
var(--cui-…)in CSS, or astokens.…in TypeScript. Never write a hex color, a pixel radius, or a pixel gap for UI chrome. Artwork the user creates is the only exception. Tokens lists every name. - Lay out with
Stack. Setgapto a spacing key, such as"2"or"4". Do not write margins between siblings. - Set text with
Text. Set the element withasand the size withsize. A heading level never comes from the size. - Style an inner part with
classesordata-cui. Passclasses={{ trigger: "…" }}on the ready component, or select[data-cui="select-trigger"]in app CSS. Copy part names from the Anatomy table of the component page. Never guess them from export names. - Write app CSS without a layer. Kit rules sit in
@layer cui, so unlayered app CSS wins without!important. Put a CSS reset in a layer declared beforecui. See Cascade layers. - Theme with
data-cui-theme. Set"dark"or"light"on<html>. Remove the attribute to follow the system. The kit has no theme provider and nosystemvalue. - Name every control. Give each field a
label, or anaria-labelwhen no visible label fits. Give eachIconButtonanaria-label. Give eachSpinneralabel. - Keep the keyboard working. Do not put a click handler on a
div. UseButton,Link, or a radio or checkbox component. Do not stop Escape from reaching an overlay. - Use the controlled pattern. See Controlled state.
Controlled state
Every stateful component follows Kobalte's pattern. Pass the uncontrolled default, or the value and its change handler together.
| State | Uncontrolled | Controlled |
|---|---|---|
| Value | defaultValue | value and onChange |
| Checked | defaultChecked | checked and onChange |
| Open | defaultOpen | open and onOpenChange |
SelectcallsonChangewithnullwhen the selection clears. Guard it:onChange={value => value && setFont(value)}.NumberFieldusesnullfor an empty field.SlidercallsonChangewhile the thumb moves andonChangeEndonce on release.PaginationtakespageandonChange, starting at 1.CommandMenuhas no uncontrolled mode. PassopenandonOpenChange.
Fields
TextField, TextArea, NumberField, Select, Combobox, Checkbox, RadioList, Switch, Slider, and OptionCardGroup take label, description, and errorMessage. The kit links the label and the messages to the input.
- On the text fields and
Select,errorMessageshows only whilevalidationState="invalid". The kit runs no validation of its own. Selectrequiresaria-labelin its type, even when it has alabel.- To build a custom field, use the helpers in Field helpers.
- To build options from objects, use
createSelectOptions,createComboboxOptions,createOptionCardItems, orcreateAccordionItems. See Options and collections.
Toasts and SSR
Create the toast controller inside a component, as ExportPanel does above, or in the app root. A controller in a module is shared by every request on a server. Render one Toaster for each controller, inside the app's providers. Show notifications shows the setup.
On the server, show and promise do nothing. Toasts render only on the client.
Portalled content renders only on the client. That covers the bodies of Dialog, Sheet, Popover, DropdownMenu, Tooltip, Select lists, Combobox lists, and CommandMenu. Do not put content a crawler must read inside one.
Components
Import each component family below from its own entry point or from @codeui/solid. Append /parts to the component path in the parts column to import its styled parts.
| Component | Parts | Main props |
|---|---|---|
| Accordion | accordion | items, value, defaultValue, onChange, collapsible |
| Alert | alert | tone, title, description, icon, fluid |
| Badge | badge | tone, size, variant, icon, textValue |
| Button | none | variant, size, ghost, pill, block, loading, leftIcon |
| Checkbox | checkbox | label, checked, defaultChecked, onChange, indeterminate, size |
| Combobox | combobox | label, options, value, onChange, inputValue, renderOption, emptyContent |
| CommandMenu | command-menu | open, onOpenChange, items, onSelect, onHighlightChange, placeholder |
| Dialog | dialog | open, onOpenChange, title, description, size, closeLabel. Body in DialogPanelContent, actions in DialogPanelFooter. |
| DropdownMenu | dropdown-menu | DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem with onSelect, and DropdownSubMenu |
| IconButton | none | aria-label, variant, size, ghost, pill |
| Kbd | kbd | size, variant |
| Link | none | href, variant |
| Listbox | listbox | options, value, onChange, size, bordered |
| NumberField | number-field | label, value, onChange, min, max, step, precision, prefix, postfix |
| OptionCard | option-card | OptionCardGroup with label, items, value, onChange, variant |
| Pagination | pagination | page, onChange, size, rounded |
| Popover | popover | Popover with open, placement, gutter. PopoverTrigger. PopoverContent with title, description, mount. |
| Progress | progress | label, value, indeterminate, showValue, size |
| RadioList | radio-list | label, value, onChange, and RadioListItem with value, label |
| SegmentedControl | segmented-control | value, onChange, size, and SegmentedControlItem with value |
| Select | select | aria-label, label, options, value, onChange, placeholder, multiple, classes |
| Sheet | sheet | open, onOpenChange, side, title, footer, draggable |
| Skeleton | skeleton | width, height, radius |
| Slider | slider | label, value, onChange, onChangeEnd, minValue, maxValue, step, showValue |
| Spinner | spinner | label, size |
| Stack | stack | direction, gap, align, justify, wrap, as |
| Switch | switch | label, checked, onChange, description, size |
| Tabs | tabs | Tabs with value, onChange. TabsList, TabsHeader with value, TabsContent with value. |
| Text | text | as, size, weight, tone |
| TextArea | text-area | label, value, onChange, placeholder, errorMessage |
| TextField | text-field | label, value, onChange, placeholder, type, errorMessage |
| Toast | toast | createToaster({ duration }), then show({ tone, title, description, action }). Toaster with toaster, position, closeLabel. |
| Tooltip | tooltip | content, placement. The trigger is the child. |
| VirtualizedListbox | none | options, virtualizerOptions, size |
Most ready components take class for the root and classes for inner parts, keyed by part name. Checkbox and Tooltip take slotClasses instead. Button, IconButton, Link, Pagination, Tabs, and the DropdownMenu exports have no classes prop.
What does not exist
Do not generate code that uses these. Each one fails to compile or to resolve.
@codeui/solid/theme.css. Solid components import their CSS and theme automatically. CSS-only consumers import@codeui/styles/theme.cssand component CSS files, or@codeui/styles/all.css.- A theme provider, or
data-cui-theme="system". Box,HStack,VStack, or sprinkles props such aspaddingormarginTop. UseStackand a class.asChild. Kobalte and the kit useasfor polymorphism.- A re-export of Kobalte's
toaster. Import it from@kobalte/core/toastwhen you compose toast parts. toast.removeortoast.custom. Usedismiss, or compose the toast parts.- A
Meter,ContextMenu,HoverCard,DatePicker, orColorPickercomponent. - Subpaths for components outside the list in Import map.