Radio Group
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
| Prop | Type | Default | Description |
|---|---|---|---|
options | any[] | — | Required. Array of option values or objects. |
valueKey | string | — | Property to use as the value when options are objects. |
labelKey | string | "label" | Property to use as the display label. |
descriptionKey | string | "description" | Property to use as the description text. |
disabled | boolean | false | Disable all options. |
orientation | "horizontal" | "vertical" | "vertical" | Layout direction. |
legend | string | — | Visible group label. Slot #legend takes priority. |
loop | boolean | true | Wrap arrow key navigation at the ends. |
name | string | — | HTML name for form submission. |
required | boolean | false | Marks the group as required. |
ariaLabel | string | — | aria-label on the group element. |
ariaLabelledby | string | — | aria-labelledby on the group element. |
getItemDisabled | (option: any) => boolean | — | Function to disable individual options. |
as | string | "div" | Root element tag. |
ui | RadioGroupUi | — | CSS class overrides. |
Slots
| Slot | Scoped props | Description |
|---|---|---|
legend | { legend } | Group label. Defaults to the legend prop. |
item | { option, value, label, description, isChecked, isDisabled, select } | Each radio option. |
UI Options
| Key | Description |
|---|---|
root | Root radiogroup element. |
item | Each option item element. |
indicator | Default radio indicator. |
input | Hidden native radio input used for form submission. |
text | Wrapper around label and description. |
label | Option label element. |
description | Option description element. |
legend | The legend element. |
Emits
| Event | Payload | Description |
|---|---|---|
value-change | [value: string, details] | Fired when selected value changes. |
Styling Hooks
| UI key | CSS class | Data attrs |
|---|---|---|
root | akaza-radio-group | data-akaza-orientation, data-akaza-disabled, data-akaza-invalid, data-akaza-dirty, data-akaza-touched, data-akaza-focused, data-akaza-filled |
legend | akaza-radio-group-legend | — |
input | akaza-radio-group-input | — |
item | akaza-radio-group-item | data-akaza-state, data-akaza-disabled |
indicator | akaza-radio-group-indicator | — |
text | akaza-radio-group-text | — |
label | akaza-radio-group-label | — |
description | akaza-radio-group-description | — |
Keyboard
| Key | Behavior |
|---|---|
ArrowUp / ArrowDown | Selects and focuses previous/next enabled item in vertical groups. |
ArrowLeft / ArrowRight | Selects and focuses previous/next enabled item in horizontal groups. |
Home / End | Selects and focuses first or last enabled item. |
Space | Selects focused radio. |
Tab | Enters group at selected item, or first enabled item. |
Arrow navigation wraps when loop is true and skips disabled items.