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

Radio

Radio buttons are used when only one choice may be selected in a series of options.

Import

Usage

EDITABLE EXAMPLE

Colors

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

EDITABLE EXAMPLE

Sizes

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

EDITABLE EXAMPLE

States

EDITABLE EXAMPLE

Props

NameTypeDefaultDescription
idstringThe id attribute of the input field.
namestringThe name of a input field in a series of radio buttons. The name is useful for form submissions.
valuestring | numberThe value for radio button input. This is the return value for form submissions.
variantColorstringThe color of the radio button when it is selected. The color should be one of the color keys in the theme (for example, 'green', 'red')
sizestring'md'The size (width and height) of a radio button. Acceptable values: 'sm', 'md', 'lg'
defaultCheckedbooleanIf true, the radio button will be selected initially.
checkedbooleanIf true, the radio button will be selected. Use onChange to update the state for a controlled component.
disabledbooleanIf true, the radio button will be disabled. This sets aria-disabled=true and you can set this state by using the _disabled prop.
childrenReactNodeThe children of the radio button.
onChangefunctionA callback called when the state is changed.
onBlurfunctionA callback called when the radio button loses focus.
onFocusfunctionA callback called when the radio button receives focus.