BNA

BNA UI
26

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.

PropTypeDefaultDescription
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
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.

PropertyTypeDescription
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