RadioList
@codeui/solid v0.3.0
A list of radio buttons for choosing one option.
When to use
Choose one named value from a visible list of export options.
When to choose another component
Use SegmentedControl for a compact row of short choices. Use OptionCard when previews or descriptions help compare options. RadioList retains native form radio semantics.
Live demo
import { RadioList, RadioListItem } from "@codeui/solid";
export default function Demo() {
return (
<RadioList
label="Export format"
defaultValue="png"
description="Choose the exported image format."
>
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
);
}Anatomy
Tap a part to outline it in the demo.
- 01RadioList
radiolistclasses.root - 02RadioList
radiolist-labelclasses.label - 03RadioList
radiolist-itemsclasses.items - 04RadioList
radiolist-descriptionclasses.description - 05RadioList
radiolist-error-messageclasses.errorMessage - 06RadioListItem
radiolist-itemclasses.item - 07RadioListItem
radiolist-item-controlclasses.itemControl - 08RadioListItem
radiolist-item-indicatorclasses.itemIndicator - 09RadioListItem
radiolist-item-labelclasses.itemLabel
| Export | Renders | classes key | data-cui | Role |
|---|---|---|---|---|
RadioList | div | root | radiolist | radiogroup |
RadioList | span | label | radiolist-label | none |
RadioList | div | items | radiolist-items | none |
RadioList | div | description | radiolist-description | none |
RadioList | div | errorMessage | radiolist-error-message | none |
RadioListItem | div | item | radiolist-item | none |
RadioListItem | div | itemControl | radiolist-item-control | none |
RadioListItem | div | itemIndicator | radiolist-item-indicator | none |
RadioListItem | label | itemLabel | radiolist-item-label | none |
Each item also renders a native radio input without a data-cui name. Item classes merge with group classes.
Variants
import { RadioList, RadioListItem } from "@codeui/solid";
export default function Demo() {
return (
<div style={{ display: "grid", gap: "var(--cui-space-4)" }}>
<RadioList label="Export format (xs)" size="xs" defaultValue="png">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
<RadioList label="Export format (sm)" size="sm" defaultValue="png">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
<RadioList label="Export format (md)" size="md" defaultValue="png">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
<RadioList label="Export format (lg)" size="lg" defaultValue="png">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
<RadioList label="Export format (xl)" size="xl" defaultValue="png">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
</div>
);
}import { RadioList, RadioListItem } from "@codeui/solid";
export default function Demo() {
return (
<RadioList label="Export format" orientation="horizontal">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
);
}import { RadioList, RadioListItem } from "@codeui/solid";
export default function Demo() {
return (
<RadioList label="Export format" orientation="vertical">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
);
}variant accepts filled and inline through BaseFieldProps. inline, the default, draws each circle as an outline on the surface. filled gives the circle the field fill (--cui-surface-input) and no outline. The root carries data-field-variant.
States
import { RadioList, RadioListItem } from "@codeui/solid";
import { createSignal } from "solid-js";
export default function Demo() {
const [value, setValue] = createSignal("png");
return (
<RadioList label="Export format" value={value()} onChange={setValue}>
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
);
}import { RadioList, RadioListItem } from "@codeui/solid";
export default function Demo() {
return (
<RadioList label="Export format" disabled defaultValue="png">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
);
}import { RadioList, RadioListItem } from "@codeui/solid";
export default function Demo() {
return (
<RadioList label="Export format" readOnly defaultValue="png">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
);
}import { RadioList, RadioListItem } from "@codeui/solid";
export default function Demo() {
return (
<RadioList label="Export format" required>
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
);
}import { RadioList, RadioListItem } from "@codeui/solid";
export default function Demo() {
return (
<div style={{ display: "grid", gap: "var(--cui-space-4)" }}>
<RadioList
size="xs"
label="Export options (xs)"
validationState="invalid"
errorMessage="Choose an export option."
>
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
</RadioList>
<RadioList
size="sm"
label="Export options (sm)"
validationState="invalid"
errorMessage="Choose an export option."
>
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
</RadioList>
<RadioList
size="md"
label="Export options (md)"
validationState="invalid"
errorMessage="Choose an export option."
>
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
</RadioList>
<RadioList
size="lg"
label="Export options (lg)"
validationState="invalid"
errorMessage="Choose an export option."
>
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
</RadioList>
<RadioList
size="xl"
label="Export options (xl)"
validationState="invalid"
errorMessage="Choose an export option."
>
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
</RadioList>
</div>
);
}Ready API
RadioList
Renders the complete field. RadioListProps is the public props type.
Prop
Type
Prop
Type
Inherited behavior follows the Kobalte radio-group contract.
RadioListItem
Renders one selectable option.
Prop
Type
Prop
Type
Styled parts API
Use @codeui/solid/radio-list/parts when the ready item cannot express the option layout. Put group Label, Description, and ErrorMessage inside Root. Place each Item in Items. Give each item a value, an ItemInput, an ItemControl containing its ItemIndicator, and an ItemLabel. Use ItemDescription for supporting text.
Accessibility
Keyboard
| Key | Action |
|---|---|
| Tab | Enter or leave the group. |
| Arrow keys | Move to and select an enabled radio. |
| Space | Select the focused radio. |
ARIA
The root has role="radiogroup". Item inputs are native radios with checked state. Labels name each item. Description and error components associate hint text with the field. validationState="invalid" exposes invalid state. Supply a visible label or an accessible name.
Focus
These controls do not open an overlay or move focus on mount. The native radio input is visually hidden, so keyboard focus draws the 2px focus ring around the circle on :focus-visible. Disabled controls cannot receive keyboard focus. Read-only controls remain focusable and do not change value.
SSR notes
The root, labels, controls, and form inputs render on the server. No part uses a portal. Keep initial values and component order stable between server and client so generated IDs hydrate consistently. Create signals per component instance.
Theming hooks
The component reads these foundation variables. Shared field labels and messages also use the field typography and validation tokens.
--cui-action-brand-base, --cui-action-brand-text, --cui-action-danger-base, --cui-border-width, --cui-font-line-height-normal, --cui-motion-duration-normal, --cui-motion-ease-out, --cui-radius-full, --cui-space-1, --cui-space-3, --cui-space-4, --cui-surface-input, --cui-text-hint.
Composition examples
import { RadioList, RadioListItem, Button } from "@codeui/solid";
import { createSignal, For } from "solid-js";
export default function Demo() {
const [result, setResult] = createSignal("");
return (
<form
onSubmit={event => {
event.preventDefault();
setResult(
new FormData(event.currentTarget).get("format")?.toString() ?? "omitted",
);
}}
>
<RadioList label="Export format" name="format" defaultValue="png">
<RadioListItem value="png" label="PNG" />
<RadioListItem value="svg" label="SVG" />
<RadioListItem value="jpeg" label="JPEG" disabled />
</RadioList>
<Button type="submit">Inspect form value</Button>
<output>{result()}</output>
</form>
);
}The form demo reads the submitted value with FormData. The selected enabled item submits its value under the group name. An empty selection or disabled group submits no entry.
Related
Use SegmentedControl for a compact row of short choices. Use OptionCard when previews or descriptions help compare options. RadioList retains native form radio semantics. See Control helpers for custom compositions.