RadioGroup
A group of radio buttons built on Radix UI RadioGroup. Supports vertical/horizontal orientation, descriptions, and error state.
Import
import { RadioGroup } from 'fxui-core';Usage
<RadioGroup
label="Plan"
defaultValue="free"
options={[
{ value: 'free', label: 'Free' },
{ value: 'pro', label: 'Pro' },
{ value: 'enterprise', label: 'Enterprise' },
]}
/>With Descriptions
<RadioGroup
label="Notifications"
defaultValue="mentions"
options={[
{ value: 'all', label: 'All', description: 'Receive every notification.' },
{ value: 'mentions', label: 'Mentions only', description: 'Only when you are mentioned.' },
{ value: 'none', label: 'None', description: 'No notifications.' },
]}
/>Horizontal
<RadioGroup
label="Size"
orientation="horizontal"
defaultValue="md"
options={[
{ value: 'sm', label: 'Small' },
{ value: 'md', label: 'Medium' },
{ value: 'lg', label: 'Large' },
]}
/>Error & Hint
<RadioGroup label="Role" options={options} error="You must select a role." />
<RadioGroup label="Role" options={options} hint="You can change this later." />Disabled Option
<RadioGroup
options={[
{ value: 'viewer', label: 'Viewer' },
{ value: 'admin', label: 'Admin', disabled: true },
]}
/>Controlled
const [value, setValue] = React.useState('free');
<RadioGroup
value={value}
onValueChange={setValue}
options={planOptions}
/>API Reference
RadioGroup
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| options | RadioOption[] | — | Array of radio options |
| label | string | — | Group label |
| error | string | — | Error message |
| hint | string | — | Helper text |
| orientation | 'vertical' \| 'horizontal' | 'vertical' | Layout direction |
| value | string | — | Controlled value |
| defaultValue | string | — | Uncontrolled initial value |
| onValueChange | (value: string) => void | — | Called on selection |
RadioOption
| Field | Type | Description |
|-------|------|-------------|
| value | string | Option value |
| label | string | Display label |
| description | string | Optional supporting text |
| disabled | boolean | Disables this option |