Radio

Updated:

Use as a single option within a Radio Group.

Development

Setting the selected option

In traditional HTML, radio buttons (<input type="radio">) are grouped by a shared name and a specific option is pre-selected using the checked attribute.

q2-radio can still be pre-selected by using the checked attribute, however, with the custom components q2-radio and q2-radio-group, this process uses hierarchy of means by which to pre-select for a certain q2-radio .

As previously stated, to pre-select a q2-radio, you may use the checked attribute and set it to true. However, this functionality is overridden by setting a value to the q2-radio-group. If a value is set to the q2-radio-group, it will always pre-select that corresponding option.

Alternatively, if no value is set to q2-radio-group, the q2-radio-group component will search for any checked q2-radio options and only select the first listed individual q2-radio, and will proceed to uncheck any following q2-radio(s).

Properties

The q2-radio element has one or more properties that support text localization. Those properties are indicated by the localizable badge in the description.

Learn more about properties.

checked

The state of the radio. This modifies the visual appearance of the element.

disabled

Disables the radio and prevents interaction.

hideLabel
hide-label

Hide's the field's <label> element from view.

Only use when a visible label is impractical.

label

The text that describes the individual radio option.

Localizable
readonly

The radio is non-interactive, but remains focusable.

value

The value that is returned in the change event that is emitted from the q2-radio-group.

Events

The q2-radio element exposes events that can be used to send and receive data from the component based on user interaction.

Learn more about events.

change

Emitted when the radio is checked.

Event Detail Type signature

{ value: string; }

tctChange

Emitted when the radio is checked.

Event Detail Type signature

{ value: string; }

Accessibility

Accessibility Report

Tecton components are designed and tested to be WCAG compliant when used appropriately, and do not get released without proper validation. Developers should prefer not to set ARIA attributes when using components from the Tecton Design System.

CSS Variables

The following CSS variables are available to override the default theme styles of the q2-radio component.