Skip to main content
HomeFormRadio

Radio

Radio buttons are used when you have a group of mutually exclusive choices and only one selection from the group is allowed.

Sizes​

Radios are available in three sizes to cater for the diverse range of use cases and devices that our business uses. By default, the medium radio is used.

Small

Medium

Large

<qtm-radio-button name="size" size="small" checked>Small</qtm-radio-button>
<qtm-radio-button name="size" size="medium">Medium</qtm-radio-button>
<qtm-radio-button name="size" size="large">Large</qtm-radio-button>

Selection​

Radios can be checked by adding checked attribute.

Small

Medium

Large

<qtm-radio-button size="small" checked>Small</qtm-radio-button>
<qtm-radio-button size="medium" checked>Medium</qtm-radio-button>
<qtm-radio-button size="large" checked>Large</qtm-radio-button>

Colors​

Radios are available in two colors: primary and neutral. The default color is the primary color.

Primary Checked

Primary Unchecked

Neutral Checked

Neutral Unchecked

<qtm-radio-button name="primary" color="primary" checked>Primary Checked</qtm-radio-button>
<qtm-radio-button name="neutral" color="neutral" checked>Primary Checked</qtm-radio-button>
...

Errors​

Radios can also have an error state to show that a selection needs to be made in order to move forward, or that a selection that was made is invalid.

Primary Checked

Primary Unchecked

Neutral Checked

Neutral Unchecked

<qtm-radio-button name="primary-error" checked error
>Primary Checked</qtm-radio-button
>
...

Disabled​

Radios can also have a disabled state.

Primary Checked

Primary Unchecked

Neutral Checked

Neutral Unchecked

<qtm-radio-button name="primary-disabled" checked disabled>Primary Checked</qtm-radio-button>
...

Value​

You can set value for a radio button by using value attribute.

<qtm-radio-button value="small">Small</qtm-radio-button>

Name​

You can set name for a radio button by using name attribute.

<qtm-radio-button name="Radio-Button">Radio Button</qtm-radio-button>

Label​

You can set label for a radio button by using label attribute. When label attribute is set, the text of the button is set to the same.

<qtm-radio-button label="Radio Button" checked></qtm-radio-button>

Required​

If a radio button has the attribute required, it has to be checked.

<qtm-radio-button required>Radio Button</qtm-radio-button>

Input Id​

The id of the radio element

<qtm-radio-button input-id="radio-button">Radio Button</qtm-radio-button>

Custom labels​

Radios accepts any component as its label. Make sure to use items with clear textual labels, or elements that are self explanatory in the given context.

Option 1

This is some placeholder help text.

<qtm-radio-button checked>
<div>
<qtm-typography>Option 1</qtm-typography>
<qtm-typography component="caption-1" classes="text-bluegrey-500">
This is some placeholder help text.
</qtm-typography>
</div>
</qtm-radio-button>

Radio Group​

qtm-radio-group is a helpful wrapper used to group radio elements. Make sure that qtm-radio-group component has a name attribute.

Radio 1Radio 2Radio 3
<qtm-radio-group name="radioGroup1">
<qtm-radio-button checked>Radio 1</qtm-radio-button>
<qtm-radio-button>Radio 2</qtm-radio-button>
<qtm-radio-button>Radio 3</qtm-radio-button>
</qtm-radio-group>

Sizes​

qtm-radio-group are available in three sizes that correspond to the different bottom margin values and size of their child elements. By default, the medium size is used.

SmallRadio 1Radio 2Radio 3MediumRadio 1Radio 2Radio 3LargeRadio 1Radio 2Radio 3
<qtm-radio-group size="small" name="radioGroupSizeSmall">
<qtm-radio-button checked>Radio 1</qtm-radio-button>
<qtm-radio-button>Radio 2</qtm-radio-button>
<qtm-radio-button>Radio 3</qtm-radio-button>
</qtm-radio-group>
...

Value​

You can set a default value for a radio button group by using default-value attribute. And you can also control value of this group by using value attribute

Radio 1Radio 2Radio 3
<qtm-radio-group default-value="radio1" name="radioGroup">
<qtm-radio-button value="radio1">Radio 1</qtm-radio-button>
<qtm-radio-button value="radio2">Radio 2</qtm-radio-button>
<qtm-radio-button value="radio3">Radio 3</qtm-radio-button>
</qtm-radio-group>

API​

RadioButton​

Loading API documentation...

RadioGroup​

Loading API documentation...

Spotted a bug, have a question, or want to suggest a new feature?

Submit an issue on GitLab