Radio Group

A set of checkable buttons, where only one of the buttons can be selected at a time.

We have two different versions for the Radio Group. A more classical (RadioGroupRegular) one that might be better for use inside forms, and a more fancy one (RadioGroup). They have slightly different APIs, so reference the API section below to see how to implement them.

You can change the active and inactive colors with the bgActiveStyles and bgStyles props.

You can change the active icon that is used when an option is selected, by passing an icon through the activeIcon prop.

You can change the size of the groups with the size prop by selecting sm, md, or lg.

ariaLabel
:
string
Set the aria label of the radio group.
name
:
string
=
''
Name attribute of radio inputs.
group
:
string
The group to bind to. Use this to set the default selected value here.
items
:
The radio items.
size
:
=
'md'
Set the size of the radio buttons. Options: 'sm' | 'md' | 'lg'.
activeIcon
:
string
=
''
Set the active icon that appears when an item is selected. Example: 'i-material-symbols-check-circle-outline text-on-primary'.
disabled
:
boolean
=
false
Allows you to disable the radio group.
required
:
boolean
=
false
Define whether or not the radio group is required (for forms).
loop
:
boolean
=
true
Define whether or not the focus should loop back to the first item when the last item is reached.
rootStyles
:
string
=
'flex gap-2'
Set the root styles for positioning the items.
bgActiveStyles
:
string
=
'primary-500'
Set active background classes.
bgStyles
:
string
=
'surface-500-50'
Set in-active background classes.
ariaLabel
:
string
Set the aria label of the radio group.
orientation
:
=
'vertical'
Set the orientation.
checked
:
string
Define the default value with the checked state. You can also bind to this prop.
radioItems
:
Define the available options.
disabled
:
boolean
=
false
Allows you to disable the radio group.
required
:
boolean
=
false
Define whether or not the radio group is required (for forms).
loop
:
boolean
=
true
Define whether or not the focus should loop back to the first item when the last item is reached.
size
:
=
'md'
Set the size of the radio items.
activeColor
:
string
=
'bg-primary-500'
Set the active color.
backgroundStyles
:
string
=
'bg-surface-100-50 hover:bg-primary-100'
Set the background color.
activeBackgroundStyles
:
string
=
'bg-primary-100 hover:bg-primary-300'
Set the active background color.
labelStyles
:
string
=
'capitalize leading-none text-surface-900-50'
Set the label styles.