From 0.1.x
@codeui/solid v0.3.0
Move an existing CodeUI app to Solid 2 and the new component package.
This guide covers the Solid peer update, Kobalte behavior changes, compiled CSS, package imports, and the theme to variant rename. If your app already uses styled parts from a component subpath, move those imports to the new /parts entry points.
Work through the sections in order.
Upgrade Solid and switch packages
pnpm add @codeui/solid solid-js@^2 @solidjs/web@^2Upgrade the app to Solid 2 by following the Solid 2 migration guide. Replace the previous component package with @codeui/solid, then update the package name in your imports. Keep the component subpath and add /parts where you import styled parts.
For Vite, replace vite-plugin-solid with @solidjs/vite-plugin and set jsxImportSource to @solidjs/web. See the Vite setup.
Load the compiled CSS
Solid components import their compiled CSS and theme automatically. Remove manual kit stylesheet imports from your app entry unless you also use CSS-only markup. @codeui/styles remains available as a separate package for CSS-only consumers.
The library publishes plain CSS with its generated Inkstone theme. Remove a vanilla-extract plugin that was configured only for the kit. Keep it if the app authors its own .css.ts files. See Installation.
Check the Kobalte behavior changes
The kit now uses Kobalte 2.0.0. If your app also imports Kobalte directly, upgrade that dependency to the same release. These behavior changes also apply when upgrading from a kit version built on Kobalte 0.13.
| Change | Where you see it | What to do |
|---|---|---|
Escape in a list with disallowEmptySelection is no longer swallowed | Listbox, Select inside a Dialog or Popover | Escape now reaches the overlay and can close it. Test the Escape key in nested overlays. |
Select calls onChange only when the value changes | Select | Code that relied on onChange when the user picks the current option no longer runs. |
Labels get their for attribute during SSR | TextField, TextArea, NumberField, Select, Checkbox, RadioList | Server HTML changes. Update SSR snapshots. |
aria-hidden outside a modal is applied later, and kept during a modal handoff | Dialog that opens a DropdownMenu or Popover | Removes a focus warning. No change needed. |
| Hidden inputs no longer scroll the page when focused | Checkbox, RadioList, Select | No change needed. |
| The tabs indicator does not animate on first render | Tabs, SegmentedControl | Check the indicator position on first paint. |
| Interact outside works across shadow roots | Every dismissable overlay | No change needed. |
Kobalte's changelog lists every entry.
Two kit fixes also change behavior:
Tooltipopens when keyboard focus reaches its trigger, and Escape closes it without moving focus.SegmentedControlreleases Escape to the layer around it, such as a dialog.
Move CSS resets below the cui layer
Every kit rule now sits in the cui cascade layer. Unlayered app CSS always wins over a layered rule, whatever its specificity. That is useful for overrides. It also means an unlayered reset, such as button { background: none }, now strips kit buttons.
Put the reset in a layer declared before cui:
@layer reset, cui;
@layer reset {
button {
background: none;
border: 0;
}
}Search your app for !important added to beat kit styles in 0.1.x. An unlayered class wins without it now. Cascade layers explains the order.
Move to the token contract
import { Stack, Text, tokens } from "@codeui/solid";
// `tokens` holds var(--cui-…) strings. `themeVars` and `themeTokens` still
// work and point at the same variables, but new code reads `tokens`.
export default function Tokens() {
return (
<Stack
gap="1"
style={{
background: tokens.surface.panel,
padding: tokens.space["4"],
"border-radius": tokens.radius.card,
}}
>
<Text weight="semibold">hello-world.ts</Text>
<Text tone="muted">{tokens.surface.panel}</Text>
</Stack>
);
}Every color, radius, space, font, shadow, and duration is now a --cui-* custom property. The tokens export holds a var(--cui-…) string for each one.
themeVarsandthemeTokenskeep working. Each name points at the closest--cui-*role. Both are deprecated. Readtokensin new code.- Font sizes follow the new scale.
xsis 12px,lgis 18px, andxlis 20px. Check layouts that used those sizes. - Every component changes appearance. Brand, danger, and status colors meet WCAG AA text contrast. The brand color is
#0076cfin both themes, for every filled and selected control. Motion is shorter, with one ease-out curve. - Override a token with plain CSS on
:root, on[data-cui-theme], or on any element. Theming shows each case. - Style files evaluated in Node, such as vanilla-extract
.css.tsfiles, importtokensfrom@codeui/solid/tokens. That entry loads no component. See Token exports.
Set the theme attribute
data-cui-theme="dark" or data-cui-theme="light" picks the mode. In 0.1.x, an element outside both attributes got no color values. Now the kit follows prefers-color-scheme there. Set the attribute on <html> to keep one mode whatever the system setting.
Use the widened signatures
These ready component signatures add options to the 0.1.x signatures.
import { Badge, Button, Dialog, DialogPanelContent, Stack } from "@codeui/solid";
import { createSignal } from "solid-js";
// In 0.1.x, `title` took a string and there was no `description`.
// Both take JSX now.
export default function DialogTitle() {
const [open, setOpen] = createSignal(false);
return (
<>
<Button variant="secondary" onClick={() => setOpen(true)}>
Export settings
</Button>
<Dialog
open={open()}
onOpenChange={setOpen}
size="sm"
closeLabel="Close export settings"
title={
<Stack as="span" direction="row" gap="2" align="center">
Export settings <Badge tone="info">Beta</Badge>
</Stack>
}
description="Applies to every PNG and SVG export of this project."
>
<DialogPanelContent>Pick a format and a scale in the export panel.</DialogPanelContent>
</Dialog>
</>
);
}| Component | 0.1.x | Now |
|---|---|---|
Dialog | title?: string | title and description take JSX. New closeLabel, mount, classes, and aria-label. New content focus callbacks, such as onOpenAutoFocus and onCloseAutoFocus. |
PopoverContent | title?: string. Children wrapped in a <p>. | title and description take JSX. New mount and classes. Children render without the <p> wrapper. |
Popover | gutter ignored | gutter is honored. The default stays 6. |
Select | slotClasses | New classes, keyed by part name. slotClasses still works and is deprecated. |
TextField, TextArea, NumberField | slotClasses. Some input attributes dropped. | Input attributes are forwarded. description takes JSX. New classes. slotClasses still works and is deprecated. |
RadioList, RadioListItem | Item props dropped | Item props are forwarded and classes is kept. |
Listbox, VirtualizedListbox | No class hooks | New classes. |
Without a trigger, Dialog now returns focus to the element that opened it. If your app moved focus by hand on close, remove that code and test it.
A PopoverContent whose children relied on the <p> wrapper for spacing or text style now renders them as written. Wrap them in a Text or a p yourself.
Move from slotClasses to classes
import { Select } from "@codeui/solid";
// In 0.1.x: slotClasses={{ input: "font-picker-trigger", errorLabel: "font-picker-error" }}
// `slotClasses` still works and is deprecated. Move to `classes`, keyed by part name.
export default function SelectClasses() {
return (
<Select
aria-label="Font"
label="Font"
options={["JetBrains Mono", "Fira Code", "Source Code Pro"]}
defaultValue="JetBrains Mono"
classes={{
trigger: "font-picker-trigger",
errorMessage: "font-picker-error",
content: "font-picker-list",
}}
/>
);
}slotClasses key | classes key |
|---|---|
root | root |
input | trigger |
label | label |
errorLabel | errorMessage |
itemValue | value |
TextField, TextArea, and NumberField take the same move. Their classes keys are root, input, label, description, and errorMessage. Rename errorLabel to errorMessage and keep the other keys.
SegmentedControl also has classes. Its keys are the slotClasses keys, root, list, and indicator, plus item. Checkbox and Tooltip still take slotClasses only.
classes also reaches parts slotClasses never could, such as content for the portalled list and item for each option. Each component page lists its classes keys under Anatomy.
Update component imports
Ready components can still be imported from @codeui/solid. Each component family also has a direct entry point.
import { Combobox, createComboboxOptions } from "@codeui/solid/combobox";
import { Select, createSelectOptions } from "@codeui/solid/select";If you used a component subpath for styled parts, append /parts. Move named and type imports from that entry along with namespace imports.
import * as C from "@codeui/solid/combobox";
import type { RootProps } from "@codeui/solid/combobox";
import { Root as DialogRoot } from "@codeui/solid/dialog";import * as C from "@codeui/solid/combobox/parts";
import type { RootProps } from "@codeui/solid/combobox/parts";
import { Root as DialogRoot } from "@codeui/solid/dialog/parts";Apply the same change to existing parts imports for accordion, alert, badge, command-menu, kbd, option-card, popover, progress, settings, sheet, skeleton, slider, spinner, stack, switch, text, and toast.
New parts entry points include Select, Tabs, DropdownMenu, the field and selection controls, Tooltip, Pagination, and SegmentedControl. Add the /parts import when you build a custom primitive from them. For token values in build-time stylesheets, keep using @codeui/solid/tokens. See Ready or parts for the import conventions.
Rename theme to variant
The word theme now means light or dark only. The appearance prop that picks a color or a field style is variant.
| Component | 0.1.x | Now |
|---|---|---|
Button, IconButton | theme="secondary" | variant="secondary" |
Button, IconButton | theme="secondary" variant="ghost" | variant="secondary" ghost |
Checkbox, RadioList | theme="filled" | variant="filled" |
TextField, TextArea, NumberField, Select | theme="inline" | variant="inline" |
Listbox | theme="primary" | variant="primary" |
Tabs | theme="inline" | variant="inline" |
Tooltip | theme="secondary" | variant="secondary" |
SegmentedControl | theme="primary" | accent |
createBaseFieldProps | { theme: "filled" } | { variant: "filled" } |
Attributes follow the props. data-theme becomes data-variant, and Tabs drops data-tabs-theme for data-variant. A ghost button sets data-ghost, and an accent SegmentedControl sets data-accent. SegmentedControl's data-autoWidth becomes data-auto-width.
Toast and Toaster keep their theme option, and data-cui-theme is unchanged. Both pick light or dark.
Update selectors that target kit markup
A compound component name in a data-cui marker is now one lowercase word. If your CSS or tests select these 0.1.x markers, update them.
| 0.1.x | Now |
|---|---|
text-field | textfield |
number-field | numberfield |
icon-button | iconbutton |
radio-group-field | radiolist |
dropdown-menu-content, dropdown-menu-item | dropdownmenu-content, dropdownmenu-item |
segmentedControl, segmentedControlList, segmentedControlItem, segmentedControlIndicator | segmentedcontrol, segmentedcontrol-list, segmentedcontrol-item, segmentedcontrol-indicator |
The other 0.1.x markers keep their names. Class names in 0.1.x were generated, so do not select them. The new classes follow cui-<component>-<part>, as described in CSS markup. Kit /parts subpaths, such as @codeui/solid/text-field/parts, keep their hyphens.
New components
These ready components are new since 0.1.x. Each one replaces code an app had to write before.
- Layout and text: Stack, Text.
- Controls: Switch, Slider, Combobox, OptionCard.
- Display: Kbd, Badge, Spinner, Skeleton, Progress.
- Feedback and overlays: Alert, Toast, Sheet, Accordion, CommandMenu.
Bug fixes you may have worked around
Remove a workaround for one of these:
NumberFieldmasked input only when the caller passed aref. It masks without one now.- The
createSelectOptionstypes were too loose, and generated option keys could collide. PaginationPropswas not exported. Import it from@codeui/solid.- A custom
gutteron a dropdown submenu was ignored.