Skip to main content

Radio group

One choice from a short list shown at once.

In Multi-brand

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Multi-brand: Picks a plan.

  • Use it when: Two to about five options where the answer is one of them.
  • Not when: Many options (select), many answers (checkboxes), or a setting that applies at once (switch).

Instead:

Words​

  • Shared structure: object, state, next step.
  • Brand tone lives in headlines and marketing copy, not in errors.
  • Errors and confirmations read the same in every brand.
  • Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Get started

See Voice and tone for the whole voice.

Accessibility and keyboard​

KeyboardWhat happensNot
undefinedArrow keys move the choice; Tab leaves the group.undefined

Test before you ship:

  • The options are a group with a question as its name. undefined

Use it in code​

npx open-ds add radio-group

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Radio group reads 14 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Radio group's tokens to change Radio group alone.

Changes with theme

Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Radio group
Gapcomponent.radio-group.gapcomponent-spacing-map.x3var(--radio-group-gap)space.20:1.25rem
Icon
Changes with theme
component.radio-group.iconcolor.action.primaryvar(--radio-group-icon)Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F
Item
Icon sizecomponent.radio-group.item.icon-sizesize.iconvar(--radio-group-item-icon-size)size.16:1rem
Cornercomponent.radio-group.item.radiusradius.roundvar(--radio-group-item-radius)radius.full:9999px
Border
Changes with theme
component.radio-group.item.bordercolor.border.strongvar(--radio-group-item-border)Aster Lightslate-deep.light.500:#64748BAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.500:#64748BBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.500:#64748BCoral Darkslate-deep.dark.400:#96A3B5
Text
Changes with theme
component.radio-group.item.labelcolor.action.primaryvar(--radio-group-item-label)Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F
Shadow
Changes with theme
component.radio-group.item.shadowelevation.cardvar(--radio-group-item-shadow)Aster Lightshadow.cardAster Darkshadow.card-darkBirch Lightshadow.cardBirch Darkshadow.card-darkCoral Lightshadow.cardCoral Darkshadow.card-dark
Border focus
Changes with theme
on focus
component.radio-group.item.border-focuscolor.border.focusvar(--radio-group-item-border-focus)Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F
Disabled opacity disabled
when disabled
component.radio-group.item.disabled-opacity-disabledopacity.disabledvar(--radio-group-item-disabled-opacity-disabled)opacity.40:0.4
Border invalid
Changes with theme
when invalid
component.radio-group.item.border-invalidcolor.status.dangervar(--radio-group-item-border-invalid)Aster Lightred.light.600:#C42B2BAster Darkred.dark.600:#F28B8BBirch Lightred.light.600:#C42B2BBirch Darkred.dark.600:#F28B8BCoral Lightred.light.600:#C42B2BCoral Darkred.dark.600:#F28B8B
Focus ring invalid
Changes with theme
when invalid
component.radio-group.item.focus-ring-invalidcolor.status.dangervar(--radio-group-item-focus-ring-invalid)Aster Lightred.light.600:#C42B2BAster Darkred.dark.600:#F28B8BBirch Lightred.light.600:#C42B2BBirch Darkred.dark.600:#F28B8BCoral Lightred.light.600:#C42B2BCoral Darkred.dark.600:#F28B8B
Focus
on focus
component.radio-group.item.focusborder-width.focusvar(--radio-group-item-focus)border-width.2:2px
Focus ring focus
Changes with theme
on focus
component.radio-group.item.focus-ring-focuscolor.border.focusvar(--radio-group-item-focus-ring-focus)Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F
Focus ring offset focus
Changes with theme
on focus
component.radio-group.item.focus-ring-offset-focuscolor.surface.canvasvar(--radio-group-item-focus-ring-offset-focus)Aster Lightslate-deep.light.50:#F8FAFCAster Darkslate-deep.dark.0:#020617Birch Lightslate-deep.light.50:#F8FAFCBirch Darkslate-deep.dark.0:#020617Coral Lightslate-deep.light.50:#F8FAFCCoral Darkslate-deep.dark.0:#020617
From the system
Edge
Changes with theme
color.border.default
straight from the system, through --border
Aster Lightslate-deep.light.200 · #E2E8F0Aster Darkslate-deep.dark.100 · #1E293BBirch Lightslate-deep.light.200 · #E2E8F0Birch Darkslate-deep.dark.100 · #1E293BCoral Lightslate-deep.light.200 · #E2E8F0Coral Darkslate-deep.dark.100 · #1E293B