Hone UI
Components

Radio and RadioGroup

A set of radio buttons where one is chosen.

RadioGroup holds the choice and Radio is one option. Both are client components built on native radio inputs that share a name, so arrow keys move the choice and the browser fires a real change event for each move. They read theme defaultProps.

import Radio from '@hone-ui/react/Radio';
import RadioGroup from '@hone-ui/react/RadioGroup';

Examples

<RadioGroup aria-label="Fruit" defaultValue="apple">
  <FormControlLabel value="apple" control={<Radio />} label="Apple" />
  <FormControlLabel value="pear" control={<Radio />} label="Pear" />
</RadioGroup>

A controlled group reads value from your state:

<RadioGroup aria-label="Plan" value={plan} onChange={(event, value) => setPlan(value)} row>
  <FormControlLabel value="free" control={<Radio />} label="Free" />
  <FormControlLabel value="pro" control={<Radio />} label="Pro" />
</RadioGroup>

To name the group with a FormLabel, give the label an id and the group aria-labelledby.

<FormControl>
  <FormLabel id="plan">Plan</FormLabel>
  <RadioGroup aria-labelledby="plan">...</RadioGroup>
</FormControl>

RadioGroup props

PropTypeDefaultDescription
valueunknownnoneThe controlled choice. null chooses nothing. Compared as a string.
defaultValueunknownnoneThe starting choice when uncontrolled.
onChange(event, value: string) => voidnoneThe real change event and event.target.value.
namestringgeneratedShared by every radio input.
rowbooleanfalseLays the radios out in a row.
aria-label, aria-labelledbystringnoneNames the group.
sx, className, style, ref, childrenStandard. They go to the root div.

Inside a FormControl, disabled disables every radio and required sets aria-required on the group.

Radio props

PropTypeDefaultDescription
valueunknownnoneThe option's value. Compared as a string.
checked, defaultCheckedbooleannoneOnly for a Radio outside a RadioGroup. Ignored inside one.
onChange(event, checked) => voidnoneFires on the radio that became chosen.
color'default', 'primary', 'secondary', 'error', 'info', 'success', 'warning''primary'The chosen color.
size'small', 'medium''medium'The size.
disabled, required, readOnlybooleanfalseAs in Checkbox.
icon, checkedIconReactNodering, ring with dotReplace the drawings.
name, autoFocus, id, inputRef, slotProps, inputProps, disableRippleAs in Checkbox. Inside a group, name comes from the group.
sx, className, style, refStandard. They go to the root div.

Inside a FormControl, disabled and required follow it and error colors the radio.

Notes

  • A Radio inside a RadioGroup ignores checked. Set value on the group instead.
  • No slots prop.
  • The real input covers each radio, so test tools can click it directly, with no force.

Accessibility

RadioGroup renders role="radiogroup". Give it aria-label or aria-labelledby. Name each Radio with FormControlLabel or inputProps['aria-label'].

On this page