Skip to content

Radio

The Radio component lets people choose a single option from a set. It’s a compound component: Radio.Root provides the group context and manages selection, and each Radio.Item is a selectable option. Radio.Item must always be used inside a Radio.Root.

Variations

Disable items selectively

The whole group can be disabled with disabled on Radio.Root (try it in the playground above). To disable only certain options, pass disabled to the individual Radio.Items instead.

Installation

import { Radio } from "@harnessio/ui/components";
function Example() {
const [group1Value, setGroup1Value] = React.useState("option1");
return (
<Radio.Root
label="Label text"
caption="Caption text"
value={group1Value}
onValueChange={setGroup1Value}
>
<Radio.Item value="option1" label="Option 1" caption="This is option 1" />
<Radio.Item value="option2" label="Option 2" caption="This is option 2" />
</Radio.Root>
);
}