Skip to Content
CodeUI

Choose ready components or parts

@codeui/solid v0.3.0

Choose how much composition and styling you own.

Ready components

ready-or-parts/ready.tsx
import { Switch } from "@codeui/solid";
export default function Ready() { return <Switch label="Show line numbers" defaultChecked />; }

Use a ready component for standard controls. Every component family has a direct entry point alongside the root, such as import { Switch } from "@codeui/solid/switch". The ready Switch composes the input, control, thumb, and label for you. You own the label and state. The kit owns the arrangement.

Styled parts

ready-or-parts/parts.tsx
import * as S from "@codeui/solid/switch/parts";
export default function Parts() {
	return <S.Root defaultChecked size="md"><S.Input /><S.Label>Show line numbers</S.Label><S.Control size="md"><S.Thumb size="md" /></S.Control></S.Root>;
}

Use parts when the ready component cannot express your layout. Each part keeps its Kobalte behavior and kit styling. You own the composition, including the hidden input and accessible label. Keep all required parts inside the root.

Append /parts to the component path to import its styled parts.

import * as S from "@codeui/solid/switch/parts";

These component entry points have a /parts subpath.

accordion, alert, badge, checkbox, combobox, command-menu, dialog, dropdown-menu, kbd, listbox, number-field, option-card, pagination, popover, progress, radio-list, segmented-control, select, settings, sheet, skeleton, slider, spinner, stack, switch, tabs, text, text-area, text-field, toast, tooltip.

Kobalte engine

ready-or-parts/engine.tsx
import { Switch } from "@kobalte/core/switch";
export default function Engine() {
	return <Switch><Switch.Input /><Switch.Control><Switch.Thumb /></Switch.Control><Switch.Label>Show line numbers</Switch.Label></Switch>;
}

Use Kobalte directly when your app needs a different visual system. This example intentionally has no kit styles on the switch. Install @kobalte/core as a direct dependency of your app before using this import. You own both composition and CSS. Kobalte still manages state, keyboard input, and ARIA.

Choose a layer

NeedLayer
Standard CodeImage controlReady component
Different order or content inside a controlStyled parts
Different visual systemKobalte engine
Only change spacing or a part classKeep the ready component and use classes.

All three switch examples toggle with Space and participate in Tab navigation. Their labels name the switch inputs. Switch markup renders on the server. Browser event handlers become active after hydration.

Build a reusable component shows how to assemble an app-level primitive and reuse it with different content.

On this page