Weftv0.4.0
GitHubFigma
Blade AI
Inputs · Radiostable

Radio

Lets people pick exactly one option from a short list, such as a Blade AI billing cycle. Options always live in a RadioGroup, which owns the value, label, help and error text. Three sizes, a round control and roving keyboard focus.

Preview

#preview

Switch size, orientation and state. Show code opens the React and CSS below.

Billing cycle
Two months free.
size medium · vertical · default
billing-cycle.tsx
import { Radio, RadioGroup } from "@blade-ai/weft/components/radio";

export function BillingCycle({ value, onChange }: Props) {
  return (
    <RadioGroup
      label="Billing cycle"
      name="cycle"
      value={value}
      onChange={({ value }) => onChange(value)}
    >
      <Radio value="monthly">Monthly</Radio>
      <Radio value="yearly" helpText="Two months free.">Yearly</Radio>
      <Radio value="custom">Custom</Radio>
    </RadioGroup>
  );
}

All states

#all-states

Every state from the Radio spec, named. Medium unless noted.

Radio · 14 states · size medium unless noted
Billing cycle
Unselected · selected
Billing cycle
None selected
Billing cycle
Hover · selected
Billing cycle
Hover · unselected
Billing cycle
Focus-visible
Billing cycle
Pressed · unselected
Billing cycle
Pressed · selected
Billing cycle
Group disabled
Billing cycle
Read-only
Billing cycle
Invalid
Billing cycle
You can change this later.
Help text
Billing cycle
Horizontal
Billing cycle
Small
Billing cycle
Large

Props

#props

Booleans are is-prefixed. RadioGroup owns name, value and validation. Anything marked UNDEFINED is an open decision.

Prop
Type
Default
Description
Radio.value *
string
—
Value submitted when this option is selected. Unique within the group.
Radio.children
ReactNode
—
Visible label, rendered inside the <label>; clicking it selects the option. Required unless the input is given an aria-label (prop name UNDEFINED).
Radio.helpText
string
—
Hint under this option's label, linked with aria-describedby.
Radio.size
"small" | "medium" | "large"
"from group"
Circle 14 / 16 / 20px with label 12 / 14 / 16. Inherits the RadioGroup size.
Radio.isDisabled
boolean
false
Disables this option only: skipped by Tab and arrow keys, not submitted, 50% opacity.
RadioGroup.label *
string
—
Legend text that names the group. Rendered as <legend>.
RadioGroup.name
string
"auto id"
Form field name shared by every option; one value is submitted. Required for forms.
RadioGroup.value
string
—
Controlled selected value. Use with onChange; the component never changes its own state when set.
RadioGroup.defaultValue
string
—
Initial value when uncontrolled. Ignored if value is set. Unset means nothing is selected.
RadioGroup.onChange
({ name: string; value: string; event }) => void
—
Fires when the selection changes (click, label click, arrow key, Space). Not fired for the option that is already selected, or when disabled or read-only. Required when controlled.
RadioGroup.isDisabled
boolean
false
Disables every option: not focusable, not submitted, 50% opacity.
RadioGroup.isRequired
boolean
false
One option must be selected to submit. Sets required on the inputs.
RadioGroup.isReadOnly
boolean
false
Focusable and submitted, but the value can't change; arrow keys move focus only. Visual treatment is UNDEFINED (gray fill proposed).
RadioGroup.validationState
"none" | "error"
"none"
"error" draws the negative border on every option and sets aria-invalid on the group.
RadioGroup.errorText
string
—
Shown once under the group when validationState is "error"; replaces helpText. Required when validationState="error".
RadioGroup.helpText
string
—
Hint under the group, linked to the fieldset with aria-describedby.
RadioGroup.orientation
"vertical" | "horizontal"
"vertical"
Vertical stack (gap spacing-4) or a row for 2-3 short options (gap spacing-7).
RadioGroup.size
"small" | "medium" | "large"
"medium"
Passed to every Radio.
RadioGroup.necessityIndicator
"required" | "optional" | "none"
"none"
Marks the legend as required or optional. Visual treatment: UNDEFINED (none for now).

Usage

#usage

Short rules for choosing and writing radios.

Do
Use a native <input type="radio"> with a shared name and a real <label>; keep the input in the accessibility tree.
Keep the 1px interactive/border/primary/default outline on selected circles.
Use only the Theme tokens listed under States; Global tokens only for size, spacing, radius, type.
Wrap options in RadioGroup (fieldset + legend) and show one group error.
Enter the group at the selected option (else the first); arrows move and select, wrap, skip disabled.
Clear the error as soon as the value becomes valid.
Don't
Don't add component tokens (no radio/*); add a Theme token or flag UNDEFINED.
Don't make every option its own tab stop.
Don't show the focus ring on mouse click; use :focus-visible.
Don't select on Enter, or fire onChange for the option that is already selected.
Don't use a lone radio, or radios for more than about 6 options (use Select).
Don't hide the input with display:none or visibility:hidden.

Accessibility

#accessibility

Native input type radio with a shared name. Arrows move and select; Enter never selects.

Keyboard
Key
Action
Tab / Shift+Tab
Enter at the selected option, else the first enabled one; next Tab leaves the group.
Arrow Down / Right
Next enabled option, selected; wraps last -> first; disabled skipped.
Arrow Up / Left
Previous enabled option, selected; wraps first -> last; disabled skipped.
Space
Selects the focused option if none is selected; else no-op.
Enter
No select; submits the form (native).
Click label
Select + focus the input; no ring (not :focus-visible).
ARIA
Element
Role / attribute
When
input
type="radio"
Always
input
name
RadioGroup name, shared by every option
input
checked
RadioGroup value === Radio value
input
value
Radio value
input
aria-label
label-less options only (prop name UNDEFINED)
input
aria-describedby
id of Radio helpText
input
required
RadioGroup isRequired
input
disabled
Radio or RadioGroup isDisabled
fieldset
aria-describedby
id of group helpText, or errorText when invalid
fieldset
aria-invalid="true"
validationState = "error"
legend
text
RadioGroup label
radiogroup (custom build only)
aria-readonly="true"
isReadOnly

Agent Spec

#agent-spec

Machine-readable spec, tables (a)–(h). Same source as /specs/radio.json. Anything marked UNDEFINED needs a decision before it is built.

/specs/radio.json·component: "Radio"·package: "@blade-ai/weft"·updated 2026-11-24
[
  "Pressed fill for a selected circle (--undefined-interactive-background-primary-pressed; falls back to the highlighted fill)",
  "Read-only visual treatment (gray fill proposed, not approved)",
  "When the error first shows: on submit (fallback) or on change",
  "necessityIndicator visual (fallback: none; say it in the legend)",
  "Name of the aria-label prop for label-less options",
  "Name of the autoFocus prop",
  "Dot motion (fallback: instant)"
]