Skip to main content
🏠FormRadioVersion: 1.4.0

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​

qtm-radio-button

PropertyTypeDefaultDescription
checkedbooleanfalseIf true, the radio is checked.
classesstringlist of classes to override or extend the styles applied to the component. You can use available utility classes by importing
color"neutral" | "primary"'primary'The color of the component
disabledbooleanfalseIf true, the component is disabled.
errorbooleanfalseIf true, the component is in error state.
inputIdstringThe id of the input element
labelstringLabel of the component
namestringName attribute of the input element
requiredbooleanfalseif true, the input element is required
size"large" | "medium" | "small"'medium'The size of the component
valuestringThe value of the component
EventTypeDescription
clickedCustomEvent<RadioButtonEvent>Callback fired when the radio is clicked. You can pull out the state radio by accessing event.target.checked / event.target.indeterminate

qtm-radio-group

PropertyTypeDefaultDescription
classesstringlist of classes to override or extend the styles applied to the component. You can use available utility classes by importing
defaultValuestringDefault selected value
namestringThis is a required attribute of the radio group element
size"large" | "medium" | "small"'medium'The size of element
valuestring''Used for setting the currently selected value
EventTypeDescription
valueChangedCustomEvent<RadioButtonEvent>Callback fired when a radio button is selected.

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

Submit an issue on GitLab