Tonic UI
Getting StartedColor ModeColor StyleVersionsContributing
THEME
BordersBreakpointsColorsOutlinesPositionsSpacingSizesShadowsTypography
BUILDING BLOCKS
BoxControlBox
UTILITIES

RadioGroup

RadioGroup is used to group related radio buttons.

Import

Usage

Uncontrolled radio group

EDITABLE EXAMPLE

Controlled radio group

EDITABLE EXAMPLE

Group orientation

Make a set of radios appear horizontal stacked rather than vertically, by adding direction="row" to the Stack component.

EDITABLE EXAMPLE

Colors

Use the variantColor prop to change the color scheme of the Radio. variantColor can be any color key with key 50(hover), 60(checked) that exist in the theme.colors.

EDITABLE EXAMPLE

Sizes

Use the size prop to change the size of the RadioGroup. You can set the value to sm, md, or lg.

EDITABLE EXAMPLE

States

EDITABLE EXAMPLE

Asynchronous data loading

EDITABLE EXAMPLE

Props

NameTypeDefaultDescription
namestringThe name used to reference the value of the control. If you don't provide this prop, it falls back to a randomly generated name.
valuestring | numberThe value to be used in the radio input. This is the value that will be returned on form submission.
disabledbooleanfalseIf true, all radios will be disabled.
variantColorstringThe color of the radio when it's checked. This should be one of the color keys in the theme (e.g. 'green', 'red').
sizestring'md'The size (width and height) of the radio. One of: 'sm', 'md', 'lg'
defaultValuestring | numberThe default input element value. Use when the component is not controlled.
childrenReactNodeThe children of the radio.
onChangefunctionA callback called when the state of the radio changes.