Skip to content

RadioGroup

Status: stableAccessibility reviewedtenet-ui@0.4.0
Import
import { RadioGroup } from 'tenet-ui';

Also accepts every prop of Omit<HTMLAttributes<HTMLFieldSetElement>, 'onChange'>.

Source: src/components/Radio/Radio.tsx

When to use: choosing exactly one option from a small, visible set. Always use Radio inside a RadioGroup — never a lone radio or a styled <div>.

  • RadioGroup renders a <fieldset>/<legend> and shares the name + selection with its Radio children — don’t set name on each radio by hand.
  • Give the group a label; give each Radio a label and a unique value. Add caption on the group or per radio for help text.
  • Control with value + onChange(value), or leave uncontrolled with defaultValue.
  • The dot color comes from the accent token — never hardcode it.
  • <RadioGroup label="Visibility" defaultValue="public">
    <Radio value="public" label="Public" />
    <Radio value="private" label="Private" />
    </RadioGroup>
  • ❌ three <input type="radio"> with a hand-set name and separate <label>s — reinvents the group, easy to get a11y wrong.
2 stories for RadioGroup — open in Storybook

The full matrix (all args, controls, accessibility panel) is in Storybook.

RadioGroup

PropTypeDefaultDescription
namestringShared form field name. Auto-generated if omitted.
label *ReactNodeGroup label (rendered as a fieldset legend).
captionReactNodeOptional helper text for the whole group.
valuestringControlled selected value.
defaultValuestringUncontrolled initial selected value.
onChange(value: string) => voidCalled with the newly selected value.
requiredbooleanfalseMark the group required (asterisk on the legend).
disabledbooleanfalseDisable every radio in the group.
childrenReactNodeRadio children.

* required

Radio

PropTypeDefaultDescription
value *stringThe value submitted when this radio is selected (required).
labelReactNodeVisible label rendered next to the control.
captionReactNodeOptional helper text under the label.

* required