Volt UI
Components

Radio

A Radio is a form control that allows the user to select a value from a set of options

Basic Usage

A Radio is a form control that allows the user to select a value from a set of options

import { RadioGroup, RadioGroupItem, Label } from "@epilot/volt-ui"

<RadioGroup defaultValue="daily">
  <div className="flex items-center gap-2">
    <RadioGroupItem value="daily" id="daily" />
    <Label htmlFor="daily">Daily</Label>
  </div>
  <div className="flex items-center gap-2">
    <RadioGroupItem value="weekly" id="weekly" />
    <Label htmlFor="weekly">Weekly</Label>
  </div>
  <div className="flex items-center gap-2">
    <RadioGroupItem value="monthly" id="monthly" />
    <Label htmlFor="monthly">Monthly</Label>
  </div>
</RadioGroup>

API Reference

RadioGroup

The root component that wraps a group of radio items. Manages the selected value state for all radio items within it.

PropTypeDefaultDescription
valuestring-Controlled value of the selected radio item.
defaultValuestring-Uncontrolled default value of the selected radio item.
onValueChange(value: string) => void-Callback fired when the selected value changes.
disabledbooleanfalseWhen true, prevents all radio items in the group from being interacted with.
requiredbooleanfalseWhen true, indicates that a radio item must be selected before form submission.
namestring-The name of the radio group, used when submitting a form.
classNamestring-Additional CSS classes to apply to the radio group container.

RadioGroupItem

An individual radio button item within a radio group. Each item must have a unique value.

PropTypeDefaultDescription
valuestring-The value of the radio item (required). Must be unique within the radio group.
disabledbooleanfalseWhen true, prevents the radio item from being interacted with.
idstring-The unique identifier for the radio item element.
classNamestring-Additional CSS classes to apply to the radio item.
aria-invalidbooleanfalseWhen true, indicates that the radio item is invalid.