Skip to main content
  1. Docs
  2. Components
  3. 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

radio.tsx
// 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.

PropTypeDefaultWhat it does
labelReactNoderequiredThe group's question, as its legend.
value · defaultValue · onValueChangeValue—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.
columns1 | 2 | 3 | 41For tiles: the most columns, fewer where there isn't room.
description · errorReactNode—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-slotElementWhat 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".

cycle.tsx
<RadioGroup<"monthly" | "yearly"> label="Billing cycle" value={cycle} onValueChange={setCycle}>
  <Radio value="monthly" label="Monthly" />
  <Radio value="yearly" label="Yearly" />
</RadioGroup>
Next — RadioAccessibility