Components Forms
RadioGroup
StableA labelled set of mutually exclusive options, with list and card layouts.
Use RadioGroup when exactly one option must be chosen from a small, visible set, especially when options need explanation. The card variant suits plan or workflow choices with descriptions. For long lists, use Select or NativeSelect; for two-state settings that apply immediately, use Switch.
Overview
import { Radio, RadioGroup } from '@bindshq/stance-react';
export function Basic() {
return (
<RadioGroup label="Signing order" defaultValue="parallel">
<Radio
value="parallel"
label="Any order"
description="Everyone receives the request at once."
/>
<Radio
value="sequential"
label="One after another"
description="Each signer is notified when the previous one finishes."
/>
</RadioGroup>
);
}Light, dark and high contrast
Every Stance component is designed and tested in all three appearance modes.
Import
import { RadioGroup, Radio } from '@bindshq/stance-react';Platforms
RadioGroup has native counterparts. They share Stance tokens and intent, and use each platform’s own controls and conventions. The live previews on this page are the web implementation.
import { RadioGroup, Radio } from '@bindshq/stance-react';Examples
import { Radio, RadioGroup } from '@bindshq/stance-react';
export function Cards() {
return (
<RadioGroup
label="Deployment method"
variant="card"
defaultValue="relay"
orientation="horizontal"
>
<Radio
value="relay"
label="Exchange relay"
description="Signatures are applied server-side to every outgoing email."
/>
<Radio
value="addin"
label="Outlook add-in"
description="Users pick their signature while composing."
/>
<Radio
value="manual"
label="Manual install"
description="Users copy the HTML into their mail client."
/>
</RadioGroup>
);
}import { Radio, RadioGroup } from '@bindshq/stance-react';
export function Horizontal() {
return (
<RadioGroup label="Logo size" orientation="horizontal" defaultValue="md" size="sm">
<Radio value="sm" label="Small" />
<Radio value="md" label="Medium" />
<Radio value="lg" label="Large" />
</RadioGroup>
);
}import { Radio, RadioGroup } from '@bindshq/stance-react';
export function Validation() {
return (
<RadioGroup label="Plan" required error="Choose a plan to continue">
<Radio value="starter" label="Starter" />
<Radio value="team" label="Team" />
<Radio value="enterprise" label="Enterprise" description="Contact sales" disabled />
</RadioGroup>
);
}API reference
RadioGroup
| Prop | Type | Default | Description |
|---|---|---|---|
label* required | ReactNode | None | Group label, rendered as the legend. |
value | string | null | None | Controlled value. |
defaultValue | string | null | null | Initial value. |
onValueChange | (value: string) => void | None | Called when the selection changes. |
name | string | None | Form field name; generated if omitted. |
variant | 'default' | 'card' | 'default' | List of radios or selectable cards. |
orientation | 'vertical' | 'horizontal' | 'vertical' | Layout of the options. |
description / error | ReactNode | None | Help text and error message. |
required / disabled | boolean | false | Required indicator and native required; disable all options. |
Radio
| Prop | Type | Default | Description |
|---|---|---|---|
value* required | string | None | The option value. |
label | ReactNode | None | Option label. |
description | ReactNode | None | Supporting text, linked via aria-describedby. |
disabled | boolean | None | Disables this option. |
Accessibility
- Built from native radio inputs sharing one name, so arrow keys move selection and Tab enters on the checked option, exactly as browsers implement it.
- The fieldset carries role="radiogroup" with the legend as its name; error and required state are exposed on the group.
- Card options show focus on the whole card and selection with both border weight and the radio dot, not colour alone.
Keyboard
| Keys | Action |
|---|---|
| Tab | Moves into the group (to the checked option) and out of it. |
| ArrowDown ArrowRight | Selects the next option. |
| ArrowUp ArrowLeft | Selects the previous option. |
| Space | Selects the focused option if none is selected. |
Usage guidelines
Do
- Pre-select the safest or most common option when there is one.
- Keep options to about seven or fewer.
Don’t
- Use radios for a single on/off choice; use Checkbox or Switch.