Radio

Radio buttons let people select one option from a set of options

import { RadioGroup, Radio, RadioParts } from '@cerberus/react'

Usage

The Radio component is a controlled component that can be used to select one option from a set. Simply wrap the Radio components in a RadioGroup component to create a group of radio buttons.

Orientation

The RadioGroup component supports two orientations: horizontal, and vertical. The default orientation is horizontal.

Sizes

The Radio component supports two sizes: sm, and md. The default size is sm.

Primitives

You can utilize the primitive components to customize the radio.

ComponentDescription
RadioGroupRootThe context provider for the RadioGroup parts
RadioGroupLabelThe label of the radio
RadioGroupIndicatorThe indicator of the radio state
RadioGroupItemThe container of the label and control of the radio
RadioGroupItemTextThe label for a single radio
RadioGroupItemControlThe visual input of a single radio
RadioGroupItemHiddenInputThe native input for the radio

API

Props

RadioGroup

The RadioGroup component is an abstraction of the primitives and accepts the following props:

NameDefaultDescription
orientationhorizontalThis orientation of the group.

The RadioGroup component also accepts all the props of the RadioGroupRoot primitive props

Radio

The Radio component is an abstraction of the primitives and accepts the following props:

NameDefaultDescription
sizesmThe size of the radio.

The Radio component also accepts all the props of the RadioGroupItem primitive props

Parts

The RadioParts API is an Object containing the full family of components.

NameDescription
RootThe RadioGroupRoot component which is the Provider for the family.
LabelThe RadioGroupLabel component which displays the label and "required" notice.
IndicatorThe RadioGroupIndicator component which displays based on the checked state.
ItemThe RadioGroupItem component which is the container to a single radio item.
ItemTextThe RadioGroupItemText component which is the label of the radio.
ItemControlThe RadioGroupItemControl component which is the visual field.
HiddenInputThe RadioGroupHiddenInput component which displays the native input.