shadcn.io is not affiliated with official shadcn/ui
Field examples · Toggles
Radio Buttons Field for React
A fieldset of three radio buttons for choosing a notification method.
One choice among a few visible options. A FieldSet with a label-style FieldLegend and a FieldDescription holds a Radio Group of Email, SMS and Push Notification, with Email selected by default.
Preview
Installation
FAQ
How does the group keep a single method selected?
Email, SMS, and Push Notification share one RadioGroup, so choosing one clears the others. defaultValue is email, which starts the group on Email.
What is the Notification Method line?
FieldDescription under the caption reads Choose how you want to be notified.
The caption is a FieldLegend with variant set to label, the quieter legend.
Where does the text for each method go?
Each choice is a Field with orientation set to horizontal, holding RadioGroupItem and a FieldLabel. font-normal on the label keeps the choice at normal weight.
What values do the three options use?
The value on each item is email, sms, or push. defaultValue on RadioGroup uses those same strings.
Related
- Radio with Descriptions FieldA subscription plan fieldset of radio
- Multiple Checkboxes FieldA fieldset of four checkboxes for the
- Simple Checkbox FieldA terms and conditions checkbox with its
- Choice Cards FieldRadio choice cards, each a bordered row
- Simple Input with Label FieldAn email input with its label above it
- Fieldset with LegendAn address fieldset with a legend, a