Radio Group

A set of checkable controls where only one option can be selected.

Overview

Radio Group lets users choose one option from a mutually exclusive set. Items follow the same surface pattern as Checkbox: the radio item lands at parent +2, hover uses the contextual hover surface, and the checked state uses a brand border with a brand indicator dot.

Usage

import { Label } from "@tilt-legal/cubitt-components/label";
import {
  RadioGroup,
  RadioGroupItem,
} from "@tilt-legal/cubitt-components/radio-group";
<RadioGroup defaultValue="option-1">
  <Label orientation="horizontal">
    <RadioGroupItem value="option-1" />
    Option 1
  </Label>
  <Label orientation="horizontal">
    <RadioGroupItem value="option-2" />
    Option 2
  </Label>
</RadioGroup>

Examples

Sizes

Use the size prop on the group to scale all child items.

Disabled

Individual radio items can be disabled.

With Description

Use a wrapped label when a radio option has title and description content.

URL State

Provide paramName to sync selection with the current URL.

API Reference

RadioGroup

PropTypeDefaultDescription
valuestring-Controlled selected value.
defaultValuestring-Initial selected value when uncontrolled.
onValueChange(value: string) => void-Callback fired when the selected value changes.
disabledbooleanfalseDisables all radio items in the group.
namestring-Form name shared by the radio items.
requiredbooleanfalseMarks the group as required in forms.
size"sm" | "md" | "lg""md"Size applied to child items unless an item overrides it.
classNamestring-Additional classes for the group container.

URL State Props

PropTypeDefaultDescription
paramNamestring-URL parameter name. Providing this enables URL state.
paramValuestring-Controlled URL parameter value.
onUrlValueChange(value: string | null) => void-Callback fired when the URL-backed value changes.
paramClearOnDefaultbooleantrueRemoves the URL parameter when the value equals the default.
paramThrottlenumber-Throttles URL updates in milliseconds.
paramDebouncenumber-Debounces URL updates in milliseconds.

RadioGroupItem

PropTypeDefaultDescription
valuestring-Unique value for the radio item.
disabledbooleanfalseDisables this radio item.
size"sm" | "md" | "lg"-Item size. Inherits the group size when omitted.
classNamestring-Additional classes for the radio item.

Notes

  • Use RadioGroupItem inside RadioGroup.
  • Wrap RadioGroupItem in Label when the label text should toggle the item.
  • Give each RadioGroupItem a unique value within its group.

On this page