Skip to content
HomeCobalt

Radio group

Picks one of two to six choices that are each shown with their words, and sends the pick with the form when it is saved.

Examples

Three cancellation policies as rows under one legend, each with the refund it gives.
Cancellation policy
In a cardHow often alerts arrive, saved with the card's button.
Filing alerts
When we tell you about new filings from advisers you watch.

Variants

Room type
InlineTwo to four short choices in a row that wraps, for words of one or two each.

States

Payout schedule
Payout currency, set by your organisation
DisabledOne choice disabled with the reason in its detail line, and a whole group disabled with the reason in its legend.
Who is staying
Choose who is staying, so the host knows whose name to expect.
InvalidNo choice yet on a required group, as after a submit: the marks in red and the Field's error tied to the group until one is chosen.

Usage

Use it when

  • A form choice of one out of two to six, where each choice needs its words in view, such as a cancellation policy or how often alerts arrive.
  • A choice with a line of detail that helps pick, such as what each plan costs.

Use something else when

  • Two to four options that change the view at once, with nothing to save. Use SegmentedControl instead.
  • More than six options, or options you find by typing. Use Select or Combobox instead.
  • One choice that is on or off. Use Checkbox instead, or Switch when it acts at once.
  • Several choices may be picked. Use a column of Checkbox rows instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/radio-group.json
import { RadioGroup, RadioGroupItem, Radio } from "@/components/cobalt/ui/radio-group"