Components

Radio Group

A group of radio buttons where only one can be selected at a time.

A set of mutually exclusive options. Keyboard navigation uses roving tabindex: arrow keys move between options and selection follows focus.

Anatomy

  • #legend: Accessible group label rendered above the options.
  • #item: Content rendered inside each radio button element.

The radio button element itself is rendered by the component. Use the ui.item prop to add classes to it.

Usage

Examples

Object options with labels

Use object options when values need labels, descriptions, or disabled state.

<script setup lang="ts">
const options = [
  { value: "free", label: "Free", description: "Up to 3 projects." },
  { value: "pro", label: "Pro", description: "Unlimited projects." },
  { value: "team", label: "Team", description: "Everything in Pro, plus SSO." },
];
</script>

<template>
  <RadioGroup v-model="plan" :options="options" legend="Choose a plan" />
</template>

Custom item rendering

The #item slot renders inside each radio button. Provide only the visual content; the button handles pointer and keyboard selection.

<template>
  <RadioGroup
    v-model="selected"
    :options="options"
    :ui="{ item: 'plan-card' }"
  >
    <template #item="{ option, label, description, isChecked }">
      <span class="plan-card__dot" :data-checked="isChecked" />
      <span>
        <strong>{{ label }}</strong>
        <p>{{ description }}</p>
      </span>
    </template>
  </RadioGroup>
</template>

Horizontal layout

Use horizontal orientation for compact sets like sizes or segmented choices.

<template>
  <RadioGroup v-model="size" :options="['S', 'M', 'L', 'XL']" orientation="horizontal" />
</template>

Disabled options

Use getItemDisabled to disable individual options programmatically.

<template>
  <RadioGroup
    v-model="plan"
    :options="options"
    :get-item-disabled="(opt) => opt.value === 'enterprise'"
  />
</template>

Field and form validation

RadioGroup inherits Field name, required/disabled state, label, description, and validation feedback. A separate unnamed validation proxy allows required validation even when no serialization name is provided. Invalid submission focuses the selected or first enabled visible radio. Per-option native inputs still submit the selected named value.

Native reset restores the initial selection unless canceled. Unselected required groups reveal errors after interaction or submission, not on initial render.

API Reference

Props

PropTypeDefaultDescription
optionsany[]Required. Array of option values or objects.
valueKeystringProperty to use as the value when options are objects.
labelKeystring"label"Property to use as the display label.
descriptionKeystring"description"Property to use as the description text.
disabledbooleanfalseDisable all options.
orientation"horizontal" | "vertical""vertical"Layout direction.
legendstringVisible group label. Slot #legend takes priority.
loopbooleantrueWrap arrow key navigation at the ends.
namestringHTML name for form submission.
requiredbooleanfalseMarks the group as required.
ariaLabelstringaria-label on the group element.
ariaLabelledbystringaria-labelledby on the group element.
getItemDisabled(option: any) => booleanFunction to disable individual options.
asstring"div"Root element tag.
uiRadioGroupUiCSS class overrides.

Slots

SlotScoped propsDescription
legend{ legend }Group label. Defaults to the legend prop.
item{ option, value, label, description, isChecked, isDisabled, select }Each radio option.

UI Options

KeyDescription
rootRoot radiogroup element.
itemEach option item element.
indicatorDefault radio indicator.
inputHidden native radio input used for form submission.
textWrapper around label and description.
labelOption label element.
descriptionOption description element.
legendThe legend element.

Emits

EventPayloadDescription
value-change[value: string, details]Fired when selected value changes.

Styling Hooks

UI keyCSS classData attrs
rootakaza-radio-groupdata-akaza-orientation, data-akaza-disabled, data-akaza-invalid, data-akaza-dirty, data-akaza-touched, data-akaza-focused, data-akaza-filled
legendakaza-radio-group-legend
inputakaza-radio-group-input
itemakaza-radio-group-itemdata-akaza-state, data-akaza-disabled
indicatorakaza-radio-group-indicator
textakaza-radio-group-text
labelakaza-radio-group-label
descriptionakaza-radio-group-description

Keyboard

KeyBehavior
ArrowUp / ArrowDownSelects and focuses previous/next enabled item in vertical groups.
ArrowLeft / ArrowRightSelects and focuses previous/next enabled item in horizontal groups.
Home / EndSelects and focuses first or last enabled item.
SpaceSelects focused radio.
TabEnters group at selected item, or first enabled item.

Arrow navigation wraps when loop is true and skips disabled items.