--- title: Radio Group description: A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time. base: base component: true links: doc: https://base-ui.com/react/components/radio-group api: https://base-ui.com/react/components/radio-group#api-reference --- ## Installation Command Manual ```bash npx shadcn@latest add radio-group ``` Install the following dependencies: ```bash npm install @base-ui/react ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx showLineNumbers import { Label } from "@/components/ui/label" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" ``` ```tsx showLineNumbers
``` ## Examples ### Description Radio group items with a description using the `Field` component. ### Choice Card Use `FieldLabel` to wrap the entire `Field` for a clickable card-style selection. ### Fieldset Use `FieldSet` and `FieldLegend` to group radio items with a label and description. ### Disabled Use the `disabled` prop on `RadioGroup` to disable all items. ### Invalid Use `aria-invalid` on `RadioGroupItem` and `data-invalid` on `Field` to show validation errors. ## RTL To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl). ## API Reference See the [Base UI Radio Group](https://base-ui.com/react/components/radio-group#api-reference) documentation.