components
RadioButton
v.1.0.0 | SaturnAllow the user to select one item from a group.
<RadioButtonGroup variant="" legend="" name="" options="" /> <RadioButtonGroupUnControlled variant="DEFAULT" legend="Select an option" name="radio_basic" options={[ { label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }, ]} />
Variant
In Kubit Design System, users have the freedom to generate variants for each component according to their needs. While predefined variants are provided as examples, they can be modified or new ones can be added to align with the specific requirements of each project.
We have set this predefined style for its quick use, access them through the variant prop.
<RadioButtonGroupUnControlled
variant="DEFAULT"
legend="Select an option"
name="name"
options={[
{ label: 'Option 1', value: '1' },
{ label: 'Option 2', value: '2' },
]}
/>
Required
It's possible to mark the component as required using the required prop. Optionally, use the prop requiredSymbol to modify the symbol associated.
<RadioButtonGroupUnControlled
variant="DEFAULT"
legend="Select an option"
name="radio_required"
options={[
{ label: 'Option 1', value: '1' },
{ label: 'Option 2', value: '2' },
]}
required={true}
/>
Default selected option
Set the default selected option through the defaultSelectedOption prop.
<RadioButtonGroupUnControlled
variant="DEFAULT"
legend="Select an option"
name="radio_default_selected"
options={[
{ label: 'Option 1', value: '1' },
{ label: 'Option 2', value: '2' },
]}
required={true}
defaultSelectedOption={{label: 'Option 2', value: '2'}}
Disabled
Disable the entire radio button group setting the state prop to DISABLED.
<RadioButtonGroupUnControlled
variant="DEFAULT"
legend="Select an option"
name="radio_disabled"
options={[
{ label: 'Option disabled', value: '1' },
{ label: 'Option 2', value: '2' },
]}
state="DISABLED"
/>
Disable specific options
Disable some options through the state option prop.
<RadioButtonGroupUnControlled
variant="DEFAULT"
legend="Select an option"
name="radio_disable_option"
options={[
{ label: 'Option disabled', value: '1', state: 'DISABLED' },
{ label: 'Option 2', value: '2' },
]}
/>
Tooltip
If extra guidance is needed a tooltip component can be added. Check here the specifications. For a quick use, this props can be set:
- infoIcon: trigger element that will show the tooltip.
- tooltip: content that will be displayed.
<RadioButtonGroupUnControlled
variant="DEFAULT"
legend="Select an option"
name="radio_tooltip"
options={[
{ label: 'Option 1', value: '1' },
{ label: 'Option 2', value: 'S' },
]}
infoIcon={{ icon: 'ICON_PLACEHOLDER' }}
tooltip={{