---
title: "MazRadio"
description: "MazRadio is a radio input with a label, colors and sizes to pick one value among several options; see MazRadioButtons for a ready-made group"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-radio"
---

# MazRadio

> MazRadio is a radio input with a label, colors and sizes to pick one value among several options; see MazRadioButtons for a ready-made group

- Package: `maz-ui`
- Import: `import MazRadio from 'maz-ui/components/MazRadio'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-radio

> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)

## Basic usage

`v-model=""`

**Details: View code**

```vue
<script lang="ts" setup>
import MazRadio from 'maz-ui/components/MazRadio'
import { ref } from 'vue'

const chosenColor = ref('primary')
const chosenSize = ref('mini')

const colors: Color[] = [
  'primary',
  'secondary',
  'info',
  'success',
  'warning',
  'destructive',
  'accent',
  'contrast',
]
</script>

<template>
  <MazRadio
    v-for="color in colors"
    :key="color"
    v-model="chosenColor"
    name="chosenColor"
    :color="color"
    :value="color"
  >
    {{ color }}
  </MazRadio>
</template>
```

## Sizing

`v-model=""`

**Details: View code**

```vue
<script lang="ts" setup>
import MazRadio from 'maz-ui/components/MazRadio'
import type { Size } from 'maz-ui/components'
import { ref } from 'vue'

const chosenSize = ref('mini')

const sizes: Size[] = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
</script>

<template>
  <MazRadio
    v-for="size in sizes"
    :key="size"
    v-model="chosenSize"
    name="chosenSize"
    :size="size"
    :value="size"
    :label="size"
  />
</template>
```

## Disabled

## MazRadio API

`import MazRadio from 'maz-ui/components/MazRadio'`

### Props

- `id` (`string`): The id of the radio.
- `model-value` (`T`, `v-model`): The value of the radio.
- `value` (`T`, required): The value of the radio.
- `name` (`string`, required): The name of the radio.
- `label` (`string`): The label of the radio.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the radio.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): The size of the radio.
- `disabled` (`boolean`, default: `false`): The disabled state of the radio.
- `error` (`boolean`): Whether there is an error with the input.
- `success` (`boolean`): Whether the input is successful.
- `warning` (`boolean`): Whether there is a warning with the input.
- `hint` (`string`): The hint text to display below the input.

### Events

- `@update:model-value` (payload: `value: T`): Event emitted when value change
- `@blur` (payload: `value: FocusEvent`): Emitted when the radio lost focus
- `@change` (payload: `value: T`): Event emitted when value change
- `@focus` (payload: `value: FocusEvent`): Emitted when the radio is focused

### Slots

- `#default` Bindings: `isSelected: boolean`, `value: T`.
