Radio Group

A set of mutually exclusive options. Fully accessible, keyboard-navigable, and styled to match the bloom palette.

Installation

npm install @bloomkit/react

Usage

import { RadioGroup, RadioGroupItem } from "@bloomkit/react";
 
<RadioGroup defaultValue="calm">
  <RadioGroupItem value="calm" label="Calm" />
  <RadioGroupItem value="focused" label="Focused" />
  <RadioGroupItem value="energized" label="Energized" />
</RadioGroup>

Controlled

const [value, setValue] = useState("calm");
 
<RadioGroup value={value} onValueChange={setValue}>
  <RadioGroupItem value="calm" label="Calm" />
  <RadioGroupItem value="focused" label="Focused" />
  <RadioGroupItem value="energized" label="Energized" />
</RadioGroup>

Without labels

<RadioGroup defaultValue="a">
  <RadioGroupItem value="a" aria-label="Option A" />
  <RadioGroupItem value="b" aria-label="Option B" />
</RadioGroup>

Props

RadioGroup

PropTypeDefaultDescription
valuestring—Controlled selected value
defaultValuestring—Initial selected value (uncontrolled)
onValueChange(value: string) => void—Called when the selected value changes
disabledbooleanfalseDisables all items in the group
classNamestring""Additional Tailwind classes

RadioGroupItem

PropTypeDefaultDescription
valuestring—The value this item represents
labelstring—Text label rendered beside the radio button
disabledbooleanfalseDisables this item independently
classNamestring""Additional Tailwind classes