StartFoundationsComponentsContent

Radio group

A radio group asks for exactly one answer from a short list. tk-radio-group holds the label and the value; each tk-radio is one option.

Stable Figma
OverviewUsageAPIAccessibility
Email Phone call Don't contact me
<tk-radio-group label="How should we contact you?" name="contact" required>
  <tk-radio value="email">Email</tk-radio>
  <tk-radio value="phone" helper="Weekdays, 9:00 to 17:00">Phone call</tk-radio>
  <tk-radio value="none">Don't contact me</tk-radio>
</tk-radio-group>

Anatomy

Part What it is
tk-radio-group the group and the form field; one Tab stop for all its options
group label the legend: usually the question, required
group helper and error under the group label, above the options
group default slot the tk-radio items, stacked vertically
tk-radio one option; works only inside a group
circle 20px; a filled circle with a dot when selected
default slot the option label, required; it is the option's accessible name
helper an optional hint under the option label

The whole row, circle and label, is one click target.

Value

The group's value is the selected option's value. Set it on the group to preselect an option; empty means nothing is selected.

Light Dark Match the system
<tk-radio-group label="Theme" name="theme" value="system">
  <tk-radio value="light">Light</tk-radio>
  <tk-radio value="dark">Dark</tk-radio>
  <tk-radio value="system">Match the system</tk-radio>
</tk-radio-group>
  • Put name, value, required, and error on the group, never on an option.
  • Leave questions unselected. In settings, show the current value.
  • The group submits one name and value; nothing while nothing is selected.

States

Standard Express
<tk-radio-group label="Delivery" name="delivery" value="standard">
  <tk-radio value="standard">Standard</tk-radio>
  <tk-radio value="express" helper="Not available for this address" disabled>Express</tk-radio>
</tk-radio-group>

On hover, a selected circle's fill changes; an unselected circle stays the same. Keyboard focus shows a ring around the circle.

  • disabled on an option: grayed and skipped by the arrow keys. Say why in its helper, or leave the option out.
  • disabled on the group: disables every option and removes the Tab stop. Selected and unselected disabled circles differ only by a faint dot, so if the locked choice matters, say it in text.

Required and error

Free Team
<tk-radio-group label="Plan" name="plan" required error="Select a plan">
  <tk-radio value="free">Free</tk-radio>
  <tk-radio value="team">Team</tk-radio>
</tk-radio-group>
  • required blocks the form from submitting until an option is selected, and adds an asterisk.
  • error shows your message above the options, so it stays in view on a long list. It doesn't color any circle.
  • The group doesn't validate. You set error and clear it.