Radio

Pick exactly one, each in its own slot.

Install and use

The first command adds the component and the Mine theme, the second adds this example. Render <Mine> once near your root for the skin, sounds and narrator.

"use client"

import { Field, FieldLabel } from "@/components/ui/field"
import { Radio, RadioGroup, RadioIndicator } from "@/components/ui/radio"

const speeds = [
  { value: "standard", label: "Standard" },
  { value: "express", label: "Express" },
  { value: "overnight", label: "Overnight" },
]

function Example() {
  return (
    <Field>
      <FieldLabel>Shipping speed</FieldLabel>
      <RadioGroup defaultValue="standard">
        {speeds.map((speed) => (
          <label data-slot="label" key={speed.value}>
            <Radio value={speed.value}>
              <RadioIndicator />
            </Radio>
            {speed.label}
          </label>
        ))}
      </RadioGroup>
    </Field>
  )
}

export { Example }