For more examples, visit the Storybook.

Example
<StudsRadioGroup defaultValue="option-1"
>
    <div className="radio-group-container">
        <div className="radio-item-container">
            <StudsRadioGroupItem
            id="option-1"
            value="option-1"
            />
            <label htmlFor="option-1">
            Option 1
            </label>
        </div>
        <div className="radio-item-container">
            <StudsRadioGroupItem
            id="option-2"
            value="option-2"
            />
            <label htmlFor="option-2">
            Option 2
            </label>
        </div>
        <div className="radio-item-container">
            <StudsRadioGroupItem
            id="option-3"
            value="option-3"
            />
            <label htmlFor="option-3">
            Option 3
            </label>
        </div>
    </div>
</StudsRadioGroup>

<StudsRadioGroup> Props

disabled
boolean
default:"false"

If true, the radio group will be disabled.

required
boolean
default:"false"

If true, the radio group is required.

name
string

The name of the radio group.

value
string

The controlled value of the radio group.

defaultValue
string

The default value of the radio group.

onValueChange
function

Callback function that is called when the value changes.

orientation
"horizontal" | "vertical"
default:"horizontal"

The orientation of the radio group.

dir
"ltr" | "rtl"
default:"ltr"

The direction of the radio group.

loop
boolean
default:"true"

If true, the radio group will loop.

asChild
boolean
default:"false"

If true, the radio group will render as a child component.

<StudsRadioGroupItem> Props

value
string

The value of the radio group item.

disabled
boolean
default:"false"

If true, the radio group item will be disabled.

required
boolean
default:"false"

If true, the radio group item is required.

asChild
boolean
default:"false"

If true, the radio group item will render as a child component.