Skip to content

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

Free

Basic Radio Group for Vue

Three stacked options, Option 1, Option 2 and Option 3. Option 1 starts selected, and only one can be on.

UI library: Ark UI

Option 1, Option 2 and Option 3 stack in a column, each with a radio and a label. Option 1 starts selected.

Use a vertical group for a single choice in a form or on a settings page. For any number of choices, use a Checkbox. On Vue, Ark UI does not submit the choice.

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="option-1">
  <RadioGroupItem value="option-1">Option 1</RadioGroupItem>
  <RadioGroupItem value="option-2">Option 2</RadioGroupItem>
  <RadioGroupItem value="option-3">Option 3</RadioGroupItem>
</RadioGroup>

FAQ

How does Option 1 start selected?

RadioGroup sets defaultValue to option-1, which matches the first item's value. Leave defaultValue off when nothing should start checked.

How do I control the selected value?

This demo uses defaultValue, so the group stores the choice. Bind v-model, or listen to @value-change, which receives details.value.

Why does clicking Option 2 check the radio?

The text is the item's label, so clicking it checks that item. The text is the child of RadioGroupItem, which renders it as the item's label.

How do I change the space between options?

RadioGroup lays the options out in a grid with a gap from the style. Pass a gap-* class on RadioGroup when you want more or less space.

How do I submit the choice with a form?

This demo does not set name. Add name on RadioGroup and the checked item's value submits under that name, not the visible label. An unchecked group submits nothing.

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="option-1", value="option-1", value="option-2" and value="option-3". The rest is on the Radio Group page.