RadioButton is an extension to standard radio button element with theming.

import RadioButton from 'primevue/radiobutton';

Two-way value binding is defined using v-model.

<div class="flex flex-wrap gap-3">
    <div class="flex align-items-center">
        <RadioButton v-model="ingredient" inputId="ingredient1" name="pizza" value="Cheese" />
        <label for="ingredient1" class="ml-2">Cheese</label>
    <div class="flex align-items-center">
        <RadioButton v-model="ingredient" inputId="ingredient2" name="pizza" value="Mushroom" />
        <label for="ingredient2" class="ml-2">Mushroom</label>
    <div class="flex align-items-center">
        <RadioButton v-model="ingredient" inputId="ingredient3" name="pizza" value="Pepper" />
        <label for="ingredient3" class="ml-2">Pepper</label>
    <div class="flex align-items-center">
        <RadioButton v-model="ingredient" inputId="ingredient4" name="pizza" value="Onion" />
        <label for="ingredient4" class="ml-2">Onion</label>

RadioButtons can be generated using a list of values.

<div v-for="category in categories" :key="category.key" class="flex align-items-center">
    <RadioButton v-model="selectedCategory" :inputId="category.key" name="dynamic" :value="" />
    <label :for="category.key" class="ml-2">{{ }}</label>

Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

<RadioButton v-model="checked" variant="filled" binary />

Invalid state is displayed using the invalid prop to indicate a failed validation. You can use this style when integrating with form validation libraries.

<RadioButton invalid binary />

When disabled is present, the element cannot be edited and focused.

<RadioButton v-model="checked" disabled :value="checked" />

Screen Reader

RadioButton component uses a hidden native radio button element internally that is only visible to screen readers. Value to describe the component can either be provided via label tag combined with id prop or using aria-labelledby, aria-label props.

<label for="rb1">One</label>
<RadioButton inputId="rb1" />

<span id="rb2">Two</span>
<RadioButton aria-labelledby="rb2" />

<RadioButton aria-label="Three" />

Keyboard Support

tabMoves focus to the checked radio button, if there is none within the group then first radio button receives the focus.
left arrowup arrowMoves focus to the previous radio button, if there is none then last radio button receives the focus.
right arrowdown arrowMoves focus to the next radio button, if there is none then first radio button receives the focus.
spaceIf the focused radio button is unchecked, changes the state to checked.