Browse docs
Browse docs
Radio button group for single-choice selection. Renders options vertically by default, supports horizontal row layout, and integrates with DashForm automatically.
Registration, validation, error handling, reactive visibility, and RBAC orchestration are handled internally by the component.
The component is designed for form-driven workflows involving mutually exclusive selections rather than standalone state orchestration.
The name prop is required to connect the field to the form schema and the internal form engine.
const options = [
{ value: 'yes', label: 'Yes' },
{ value: 'no', label: 'No' },
];
<RadioGroup
name="answer"
label="Do you agree?"
options={options}
rules={{ required: 'Please select an option' }}
/>A radio group bound to the form by name. The form stores the selected
option's value.
<RadioGroup
name="answer"
label="Do you agree?"
options={[
{ value: 'yes', label: 'Yes' },
{ value: 'no', label: 'No' },
{ value: 'maybe', label: 'Maybe' },
]}
/>row lays the options out horizontally — good for short, scannable choices.
<RadioGroup
name="size"
label="Size"
row
options={[
{ value: 'xs', label: 'XS' },
{ value: 's', label: 'S' },
{ value: 'm', label: 'M' },
{ value: 'l', label: 'L' },
{ value: 'xl', label: 'XL' },
]}
/>Error state with helper text.
Please select an option
<RadioGroup
name="answer"
label="Do you agree?"
error
helperText="Please select an option"
options={[
{ value: 'yes', label: 'Yes' },
{ value: 'no', label: 'No' },
]}
/>| Prop | Type | Default | Description |
|---|---|---|---|
name | string | — | Field name. Required. |
options | { value: string, label: string, disabled?: boolean, access?:AccessRequirement }[] | — | Radio options array. Required. |
label | string | — | Group label displayed above the radios. |
row | boolean | false | Renders options horizontally in a row. |
defaultValue | string | — | Initially selected value (uncontrolled). |
error | boolean | false | Error visual state. |
helperText | string | — | Hint or error text below the group. |
access | AccessRequirement | — | RBAC access requirement. Controls visibility, disabled, and readonly state based on role permissions. |
rules | RegisterOptions | — | React Hook Form validation rules. |
visibleWhen | VisibleWhenCondition | — | Conditional visibility expression. |
options[n].disabled.value string.RadioGroup supports progressive adoption — use it as a standalone controlled input, integrate with React Hook Form, or conditionally show it based on other form state.
RadioGroup works as a standard React controlled component with familiar patterns. No proprietary lock-in required.
<RadioGroup
value={accountType}
onChange={(e) => setAccountType(e.target.value)}
name="accountType"
options={[
{ value: 'personal', label: 'Personal' },
{ value: 'business', label: 'Business' }
]}
/>Integration-Friendly
Designed to integrate with React Hook Form workflows through DashForm. Compatible with existing form-library patterns.
<DashForm>
<RadioGroup
name="shippingMethod"
label="Shipping Method"
options={shippingOptions}
rules={{ required: 'Please select a method' }}
/>
</DashForm>RadioGroup can participate in engine-driven visibility rules through visibleWhen. Use it when single-choice depends on other form state.
<RadioGroup
name="businessType"
label="Business Type"
options={businessTypes}
visibleWhen={(engine) =>
engine.getNode('accountType')?.value === 'business'
}
/>Declarative role-based access control via the access prop. The component calls useAccessState(access) internally and maps the resolved permission to one of three field states — no if statements or manual checks needed in the parent.
The access prop accepts an AccessRequirement object:
| Field | Type | Description |
|---|---|---|
resource | string | The resource being protected (e.g. 'employee', 'invoice'). |
action | string | The action being checked (e.g. 'read', 'update', 'delete'). |
onUnauthorized | 'hide' | 'disable' | 'readonly' | What to render when the user lacks permission. Defaults to 'hide'. |
RBAC access control requirement for a specific option.
Group-level access has precedence over option-level access.
Combines with explicit disabled prop via OR logic.
| Event | Type | Description |
|---|---|---|
onUnauthorized | hide | Entire group returns null. |
onUnauthorized | disable | Group is visible but not selected. |
onUnauthorized | readonly | Group is disabled (radio options do not support true readonly semantic; disabled is used as fallback) |
Controls option visibility and selectability basesd on user permissions:
| Event | Type | Description |
|---|---|---|
onUnauthorized | hide | Option is hidden (unless it is the currentyl selected value). |
onUnauthorized | disable | Option is visible but not selected. |
onUnauthorized | readonly | Option is disabled (radio options do not support true readonly semantic; disabled is used as fallback) |