Search documentation

Search the documentation and open a page.

A set of checkable buttons where only one option can be selected at a time.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/radio-group

Composition

RadioGroup ├── RadioGroupLabel (optional) └── RadioGroupItem ├── RadioGroupItemControl │ └── RadioGroupIndicator ├── RadioGroupItemText └── RadioGroupItemHiddenInput

Examples

Default

Loading...

Grid

Loading...

Invalid

Loading...

List

Loading...

API Reference

RadioGroup

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
idsElementIds | undefined—Overrides generated identifiers for individual parts.
valuestring | null | undefined—Current value when the component is controlled.
defaultValuestring | null | undefined—Initial value when the component is uncontrolled.
namestring | undefined—Name used when submitting the value with a form.
formstring | undefined—Associates the control with a form by ID.
disabledboolean | undefinedfalseDisables interaction with the component.
invalidboolean | undefined—Marks the associated form control as invalid.
requiredboolean | undefinedfalseMarks the associated form control as required.
readOnlyboolean | undefinedfalsePrevents changes while preserving focus and navigation.
onValueChange((details: ValueChangeDetails) => void) | undefined—Runs when value changes.
orientation"horizontal" | "vertical" | undefined"horizontal"Sets the component orientation and keyboard navigation axis.

Context, Hooks, and Types

ExportAPI
RadioGroupContextRender-prop component that exposes component state and actions.
RadioGroupRootProviderProvides an externally created API to the component tree.
useRadioGroupCreates or accesses the component API.
useRadioGroupContextReturns the nearest component API.
RadioGroupValueChangeDetailsType for the details object passed to the matching change callback.