RadioGroup

Data input

A set of radio buttons with bind:value: <RadioGroup.Root> holds one RadioGroup.Item per option. Tab enters the group, arrow keys move and select. Put each item in a Field orientation="horizontal" with a Field.Label, and the group in a Field.Set with a Field.Legend that names it.

import { RadioGroup } from '@limerdev/zest';
RadioGroup for AI tools (llms.txt)
Use for
Choosing exactly one of a few options (up to about six) that should all be visible.
Don't
Many options, or options that don't fit on screen: use Select. Independent on/off choices: use Checkbox. A group without a Field.Legend (or aria-label).

Examples

Basic

One Field per option; the Field.Legend names the group. Arrow keys move and select.

Billing

With descriptions

Field.Content puts a description under each option's label.

Pricing

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

RadioGroup.Root

Prop Type Default Description
autocomplete FullAutoFill | null "off" The autocomplete attribute to forward to the hidden input element. Browsers can otherwise autofill the hidden input with values that don't match any of the radio items.
disabled boolean false Whether the radio group is disabled.
loop boolean true Whether to loop around the radio items when navigating with the keyboard.
name string undefined The name to apply to the radio group's input element for form submission. If not provided, a hidden input will not be rendered and the radio group will not be part of a form.
onValueChange OnChangeFn<string> โ€“ The callback to call when the selected radio item changes.
orientation "horizontal" | "vertical" "vertical" The orientation of the radio group. Used to determine how keyboard navigation should work.
readonly boolean false Whether the radio group is readonly. When readonly, users can focus and navigate through items but cannot change the value.
required boolean โ€“ Whether the radio group is required for form submission. If true, ensure you provide a name prop so the hidden input is rendered.
value bindable string '' The value of the selected radio item.

RadioGroup.Item

Prop Type Default Description
disabled null | false | true false Whether the radio item is disabled.
value required string โ€“ The value of the radio item.