Shopware Design

Radio Group

Usage

Radio Group presents a set of mutually exclusive options where only one selection is allowed. Use it when the available choices should stay visible on the page instead of being hidden in a collapsed control, and when users benefit from scanning or comparing a small number of options before choosing one.

import {
  MtRadioGroupRoot,
  MtRadioGroupList,
  MtRadioGroupItem,
  MtRadioGroupCardItem,
  MtRadioGroupCustomItem,
  MtRadioGroupIndicator,
} from "@shopware-ag/meteor-component-library";

Examples

Card item

Use card items when each option needs a label and a short supporting description.

Custom item

Build fully custom option cards when you need richer content or a different layout.

Anatomy

Radio Group is a compound component made up of several public exports:

  • MtRadioGroupRoot provides the shared label, help text, hint, error handling, and selected-value state.
  • MtRadioGroupList lays out a standard vertical list of radio items with the expected spacing.
  • MtRadioGroupItem renders the default radio option with a label.
  • MtRadioGroupCardItem renders a bordered option card with a label and an optional description.
  • MtRadioGroupCustomItem lets you build fully custom option cards while still participating in the shared radio-group state.
  • MtRadioGroupIndicator renders the actual radio input and control, and is mainly useful inside custom-item compositions.

API reference

Root

Props

PropTypeDefault
model-valuestring | number | boolean | nullnull
disabledfalse | truefalse
aria-described-bystringundefined
labelstring""
help-textstring""
namestringundefined
error{ detail: string; }undefined
hint
Optional caption below the field. The `#hint` slot takes precedence when provided.
string | nullnull

Events

EventPayload
update:modelValue[value: string | number | boolean | null]

Slots

SlotBindings
hint{}
default{ disabled: boolean; identification: string; }

Card item

Props

PropTypeDefault
id *
The id of the radio input; its label and description refer to it.
string
value *
The value the group takes when this option is selected.
string | number | boolean
label *
The visible name of the option, which also names its radio input.
string
description
Supporting text below the label, announced as the description of the radio input.
stringundefined
required
Marks the radio input as required.
false | truefalse
aria-described-by
The ids of further elements that describe the option.
stringundefined
error
Marks the option as invalid for assistive technology (`aria-invalid`). The error state of the group applies as well.
false | truefalse

Best practices

Do
  • Use clear, concise labels for each option.
  • Use a descriptive group label that explains what the user is selecting.
  • Include help text or a hint when the selection needs additional context.
  • Use the error prop to display validation errors when needed.
  • Ensure each radio item has a unique id and value.
  • Use MtRadioGroupList to space standard items or card items vertically.
  • Use MtRadioGroupItem for simple choices that only need a label.
  • Use MtRadioGroupCardItem when a short description helps users compare options.
  • Use MtRadioGroupCustomItem for richer content or layouts, such as pricing plans with feature lists.
  • Keep the number of options manageable. A small visible set is the sweet spot.
Don't
  • Do not use Radio Group for multiple selections. Use Checkbox instead.
  • Do not use a single radio button. Radio groups should present a real choice.
  • Do not omit labels. Always provide clear labels for accessibility and usability.
  • Do not use radio groups for long lists of options where a Select would be easier to scan.
  • Do not use the same value for multiple items within the same group.
  • Do not forget to handle the v-model binding so the selected value stays in sync.

Behavior

  • Radio Group uses v-model on MtRadioGroupRoot to manage the selected value across all items in the group.
  • Use standard items and card items inside MtRadioGroupRoot. Both share the selected value, group name, and disabled state.
  • Clicking anywhere on a card selects its option. A disabled group prevents selection on all its cards.
  • Card items inherit the root's error state. Set a card's error prop to mark an individual option as invalid.
  • MtRadioGroupCustomItem gives you layout freedom, but you still need to render MtRadioGroupIndicator so the custom option remains a real radio control.
  • helpText, hint, and error follow the shared field patterns used by other form components.

Accessibility

  • Provide a clear group label or other nearby visible context so users understand what the choice controls.
  • MtRadioGroupIndicator uses native radio inputs. Tab enters or leaves the group, arrow keys move between options and select them, and Space selects the focused option.
  • Card items keep the native radio input and show a focus outline around the card during keyboard navigation.
  • A card's label names its radio input. Its description is associated with the input so screen readers can announce the supporting text.
  • Use ariaDescribedBy on a card to reference additional descriptive text by its element ID.
  • Keep option labels explicit so users do not need surrounding context to understand each choice.
  • If you build custom items, make sure the visible content still makes the selected state and choice meaning clear.
  • Checkbox: when users can turn an option on or off independently or choose multiple items.
  • Select: when there are more options or when space is limited.