Radio

PreviousNext

A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.

Installation

pnpm dlx bna-ui add radio

Usage

import { RadioGroup, RadioButton } from '@/components/ui/radio';
const [value, setValue] = useState('option1');

<RadioGroup
  options={[
    { label: 'Option 1', value: 'option1' },
    { label: 'Option 2', value: 'option2' },
    { label: 'Option 3', value: 'option3' },
  ]}
  value={value}
  onValueChange={setValue}
/>;

Examples

Default

Horizontal Layout

Disabled Options

Custom Styling

Form Integration

Large Size

Single Radio Button

API Reference

RadioGroup

The main container component that manages a group of radio buttons. Uses value/onValueChange (matching ToggleGroup's group-selection convention) rather than checkbox's checked/onCheckedChange or toggle's pressed/onPressedChange — each naming convention matches its own control's interaction model and is intentional, not an inconsistency.

PropTypeDefaultDescription
hapticbooleantrueWhether to trigger haptic feedback when an option is selected. Forwarded to every RadioButton in the group.
optionsRadioOption[]-Array of radio button options.
valuestring-The currently selected value.
onValueChange(value: string) => void-Callback fired when the selection changes.
disabledbooleanfalseWhether the entire group is disabled.
orientation'vertical' | 'horizontal''vertical'Layout orientation of the radio buttons.
styleViewStyle-Additional styles for the group container.
optionStyleViewStyle-Additional styles for each radio button.
labelStyleTextStyle-Additional styles for radio button labels.

RadioButton

Individual radio button component for custom layouts.

PropTypeDefaultDescription
hapticbooleantrueWhether to trigger haptic feedback when the option is selected. Re-selecting the active option stays silent.
optionRadioOption-The radio option data.
selectedboolean-Whether this radio button is selected.
onPress() => void-Callback fired when the button is pressed.
disabledbooleanfalseWhether this radio button is disabled.
styleViewStyle-Additional styles for the button container.
labelStyleTextStyle-Additional styles for the button label.

RadioOption

The shape of each radio option object.

PropTypeDescription
labelstringThe display text for the radio button.
valuestringThe value associated with this option.
disabledbooleanWhether this specific option is disabled.

Accessibility

The Radio component is built with accessibility in mind:

  • Uses TouchableOpacity for proper touch feedback
  • Supports disabled states with appropriate visual feedback
  • Proper opacity changes for disabled options
  • Screen reader friendly with semantic structure
  • Supports keyboard navigation patterns
  • Clear visual indicators for selected state