The example below loads live from Storybook; open it in Storybook to use the controls.
Default
Section titled “Default”RadioGroup renders a <fieldset>; label becomes its legend. Each item is a Radio with its value in value.
Group label
Choose one option.
import { Radio, RadioGroup } from '@bigbang/ui';
export default function Default() { return ( <RadioGroup label="Group label" description="Choose one option." defaultValue="one"> <Radio value="one" label="First option" /> <Radio value="two" label="Second option" /> <Radio value="three" label="Third option" /> </RadioGroup> );}Items with descriptions
Section titled “Items with descriptions”The Radio description sits under the label and is linked to the item with aria-describedby.
Group label
Option description goes here.
Option description goes here.
import { Radio, RadioGroup } from '@bigbang/ui';
export default function WithDescriptions() { return ( <RadioGroup label="Group label" defaultValue="one"> <Radio value="one" label="First option" description="Option description goes here." /> <Radio value="two" label="Second option" description="Option description goes here." /> </RadioGroup> );}Controlled and horizontal
Section titled “Controlled and horizontal”With value and onValueChange you hold the choice. orientation="horizontal" lays short options in a row.
Group label
oneimport { Radio, RadioGroup } from '@bigbang/ui';import { useState } from 'react';
export default function Controlled() { const [value, setValue] = useState('one'); return ( <div className="flex flex-col gap-md"> <RadioGroup label="Group label" value={value} onValueChange={setValue} orientation="horizontal"> <Radio value="one" label="First option" /> <Radio value="two" label="Second option" /> <Radio value="three" label="Third option" /> </RadioGroup> <code className="type-body-sm text-fg-subtle">{value}</code> </div> );}States
Section titled “States”disabled on a Radio turns off that item only; disabled on the RadioGroup turns off the whole group.
Group label
Group label
import { Radio, RadioGroup } from '@bigbang/ui';
export default function States() { return ( <div className="flex flex-col gap-xl"> <RadioGroup label="Group label" defaultValue="one"> <Radio value="one" label="First option" /> <Radio value="two" label="Second option" disabled /> </RadioGroup> <RadioGroup label="Group label" defaultValue="one" disabled> <Radio value="one" label="First option" /> <Radio value="two" label="Second option" /> </RadioGroup> </div> );}Invalid
Section titled “Invalid”With error set, the group gets aria-invalid and every circle shows the danger border.
Group label required
Choose an option to continue.
import { Provider, Radio, RadioGroup } from '@bigbang/ui';
export default function Invalid() { return ( <Provider locale="en-GB"> <RadioGroup label="Group label" required error="Choose an option to continue."> <Radio value="one" label="First option" /> <Radio value="two" label="Second option" /> </RadioGroup> </Provider> );}Light and dark mode
Section titled “Light and dark mode”A selected circle takes the color-action-primary-default fill.
Group label required
Choose an option to continue.
Group label required
Choose an option to continue.
import { Provider, Radio, RadioGroup } from '@bigbang/ui';
export default function Invalid() { return ( <Provider locale="en-GB"> <RadioGroup label="Group label" required error="Choose an option to continue."> <Radio value="one" label="First option" /> <Radio value="two" label="Second option" /> </RadioGroup> </Provider> );}