aura

Radio

The Radio component is a fancy radio input. It behaves as a standard HTML radio input, but it is styled to match the design system.

Per default they are rendered inlined, but can be stacked by wrapping them in a flex container or using a field.

Field Attributes

  • label (String): The label of the checkbox.
  • label-start (String): The label of the checkbox, rendered before the checkbox.
  • description (String): The description of the checkbox.
  • desc-start (String): The description of the checkbox, rendered before the checkbox.

Group Attributes

  • legend (String): The legend of the group.
  • divided (Boolean): Whether the checkboxes should be separated by a divider.
  • inline (Boolean): Whether the checkboxes should be rendered inline.

Basic Usage

Copy to clipboard

<aura:radio name="favourite-show" label="Rick and Morty" value="1" checked/>
<aura:radio name="favourite-show" label="The Simpsons" value="2" />
<aura:radio name="favourite-show" label="Family Guy" value="3" />

Alternative Label

Copy to clipboard

<aura:radio label-start="Rick and Morty" ... />

Disabled and Checked

Copy to clipboard

<aura:radio disabled ... />

Grouped

To group toggle switches, wrap them in a aura:toggle.group component.

Default Group

Copy to clipboard

<aura:radio.group legend="Default Group">
    <aura:radio label="Toggle 1" />
    <aura:radio label="Toggle 2" />
    <aura:radio label="Toggle 3" />
</aura:radio.group>

Group styles

When grouping radios, you can use the inline attribute to render them inline. or divided to separate them with a divider.

Divided Group
Inline Group

Copy to clipboard

<aura:radio.group divided>
    ...
</aura:radio.group>

<aura:radio.group inline>
    ...
</aura:radio.group>