BDMG UI

Radio Button Group

Single-select radio group with four visual types and row or column layout. Use value and onChange for controlled usage.

Installation

tsx
import { RadioButtonGroup } from "@workspace/ui/components/radio-button-group"

Basic usage

tsx
<RadioButtonGroup
  name="choice"
  label="Choose one"
  options={[
    { value: "yes", label: "Yes" },
    { value: "no", label: "No" },
  ]}
  value={value}
  onChange={setValue}
/>
Choose one

Types

  • 1 – Default circular radio
  • 2 – Pill style
  • 3 – Bordered card style
  • 4 – Segmented control
tsx
<RadioButtonGroup name="t2" type="2" options={options} value={v2} onChange={setV2} layout="row" />
<RadioButtonGroup name="t3" type="3" options={threeOptions} value={v3} onChange={setV3} />
<RadioButtonGroup name="t4" type="4" options={threeOptions} value={v4} onChange={setV4} />
Type 2 (pill)
Type 3 (card)
Type 4 (segmented)

Row layout

tsx
<RadioButtonGroup
  name="row"
  label="Layout row"
  options={options}
  value={value}
  onChange={setValue}
  layout="row"
/>
Layout row

Props

PropTypeDefaultDescription
name*string-Form field name (and native name).
options*RadioOption[]-Array of { value, label, disabled? }.
valuestring-Controlled value.
onChange(value: string) => void-Called when selection changes.
type"1" | "2" | "3" | "4""1"Style: 1=default circle, 2=pill, 3=bordered card, 4=segmented.
layout"row" | "column""column"Options layout.
labelstring-Legend/label for the group.
errorstring-Error message below the group.
hintstring-Hint text below.
containerClassNamestring-Classes for the wrapper.
optionClassNamestring-Classes for each option.