- Docs
- Components
- Forms
Radio
One answer from a few, all in view and always answered. The group is one Tab stop.
- Import
- @qeetrix/react
- Status
- StableSince 0.0.2
- Renders
<div role="radiogroup">Server-rendered- Tested
- WCAG 2.2 AAaxe on every pull request
01
Import
// From the package: a build keeps only what it uses.
import { RadioGroup, Radio } from "@qeetrix/react";
// Or from its own path.
import { RadioGroup, Radio } from "@qeetrix/react/radio";02
Props
And every native attribute of the element it renders.
| Prop | Type | Default | What it does |
|---|---|---|---|
label | ReactNode | required | The group's question, as its legend. |
value · defaultValue · onValueChange | Value | — | The chosen value; generic: RadioGroup<"monthly" | "yearly">. |
orientation | "vertical" | "horizontal" | "vertical" | horizontal for short options. |
variant | "default" | "tile" | "default" | Rows, or tiles with an icon, a title and a line. |
columns | 1 | 2 | 3 | 4 | 1 | For tiles: the most columns, fewer where there isn't room. |
description · error | ReactNode | — | Under the group; the error marks it invalid. |
name · disabled · required | … | — | As on a form control. |
Radio: value · label · description · icon · disabled | … | — | One option; value is required. |
03
Parts
Each part carries a data-slot, for tests and placement.
| data-slot | Element | What it is |
|---|---|---|
radio | <div> | A row. |
radio-indicator | <span role="radio"> | The circle: ref and Base UI props land here. |
04
Typed values
The value's type follows the group's: onValueChange gets "monthly" | "yearly".
<RadioGroup<"monthly" | "yearly"> label="Billing cycle" value={cycle} onValueChange={setCycle}>
<Radio value="monthly" label="Monthly" />
<Radio value="yearly" label="Yearly" />
</RadioGroup>