Docs
Radio Group

Radio Group

Radio Group component is a set of checkable buttons, commonly known as radio buttons, where no more than one button can be checked at a time. It provides a simple and intuitive way to allow users to make a single selection from a group of options. The Radio Group is commonly used in forms and surveys where users need to choose one option from a list. This component ensures exclusive selection within the group, enhancing the user experience in scenarios where mutually exclusive choices are required.

Installation

yarn add @camped-ui/radio-group

Usage

import { Label } from "@camped-ui/label";
import { RadioGroup, RadioGroupItem } from "@camped-ui/radio-group";
<RadioGroup defaultValue="option-one">
  <div className="flex items-center space-x-2">
    <RadioGroupItem value="option-one" id="option-one" />
    <Label htmlFor="option-one">Option One</Label>
  </div>
  <div className="flex items-center space-x-2">
    <RadioGroupItem value="option-two" id="option-two" />
    <Label htmlFor="option-two">Option Two</Label>
  </div>
</RadioGroup>

Examples

Form