gray
radius
Forms

Radio group

Exactly one choice from a small set. Round, because that shape is what says the options are exclusive.

One tab stop

Tab into the group, then use the arrow keys. Radix gives it a roving tabindex, so the group is one stop and the arrows move between options.

<RadioGroup.Root defaultValue="minor">
<RadioGroup.Item value="patch">Patch: bug fixes only</RadioGroup.Item>
<RadioGroup.Item value="minor">Minor: new tokens, nothing removed</RadioGroup.Item>
<RadioGroup.Item value="major">Major: a token was renamed</RadioGroup.Item>
</RadioGroup.Root>

Disabled

Disable the root for the whole group, or one item on its own.

<RadioGroup.Root defaultValue="patch">
<RadioGroup.Item value="patch">Patch</RadioGroup.Item>
<RadioGroup.Item value="minor">Minor</RadioGroup.Item>
<RadioGroup.Item value="major" disabled>Major: needs a maintainer</RadioGroup.Item>
</RadioGroup.Root>
<RadioGroup.Root defaultValue="minor" disabled>
<RadioGroup.Item value="minor">Minor</RadioGroup.Item>
<RadioGroup.Item value="major">Major</RadioGroup.Item>
</RadioGroup.Root>

Parts

Import it as a namespace, and the parts work on either side of the server boundary.

import * as RadioGroup from '@minuk-hwang-design-system/components-react/radio-group';
PartWhat it is
RadioGroup.RootOwns the value and the roving focus.
RadioGroup.ItemOne option. With children it renders the row and the label association.

Props

PropTypeDefaultNotes
Root.valuestringControlled selection.
Root.defaultValuestringUncontrolled initial selection.
Root.onValueChange(value: string) => voidFires with the chosen item's value.
Root.disabledbooleanfalseDisables every option in the group.
Item.valuestringWhat this option is worth.
Item.disabledbooleanfalseDisables one option. The arrow keys skip it.