Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Radio Group with Descriptions for Solid

Default, Comfortable and Compact, each with a muted line under the label. Comfortable starts selected.

UI library: Ark UI

Three radios: Default, Comfortable and Compact. Comfortable starts selected. Each has a muted line under the label about spacing.

Add the line when people need to see what a choice does before they pick it. A Select hides those lines until it opens. In Solid, Ark UI does not write the descriptions.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Radio Group anatomy: root, label, item control, indicator, item, item text

Usage

<RadioGroup class="w-fit" defaultValue="comfortable">
    {options.map(option => <Field class="gap-1">
        <RadioGroupItem value={option.value}>{option.label}</RadioGroupItem>
        <FieldDescription class="ps-6">
          {option.description}
        </FieldDescription>
      </Field>)}
  </RadioGroup>

FAQ

Which option starts selected?

defaultValue is comfortable, the second option. The item values are default, comfortable, and compact, from a list at the top of the file.

How does the description line up under the label?

Each option is a Field with the item and a FieldDescription. The description has ps-6, the width of the radio and its gap, so it starts under the text.

How is the description styled?

FieldDescription sets text-muted-foreground and text-sm. It is not wired to the item with aria-describedby, so a screen reader reads it as nearby text.

Does clicking the description select the option?

No. Only the name is the label, so clicking the name checks the item and the sentence under it does nothing. The text is the child of RadioGroupItem, which renders it as the item's label.

Can one option skip the description?

Yes. Each option renders its own FieldDescription. Leave it out on an option that needs only a name.

Can I move between these options from the keyboard?

Yes. Tab moves focus to the checked item, or to the first item when none is checked. The arrow keys move to another item and check it, and Space checks the item that has focus.

API Reference

Radio Group

Sets defaultValue="comfortable" and value={option.value}. The rest is on the Radio Group page.

Field

No extra props in this demo. The rest is on the Field page.