Skip to content

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

Before use it, you should install the MazUi plugin in your project, follow instructions in Getting Started

Basic usage ​

v-model="undefined"

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="undefined"

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 ​

Props ​

NameDescriptionTypeRequiredDefaultPossible values
idThe id of the radiostringNo--
model-valuev-model The value of the radioTNo--
valueThe value of the radioTYes--
nameThe name of the radiostringYes--
labelThe label of the radiostringNo--
colorThe color of the radio"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"No"primary"'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'destructive' | 'contrast' | 'transparent'
sizeThe size of the radio"xs" | "sm" | "md" | "lg" | "xl" | "mini"No-'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'mini'
disabledThe disabled state of the radiobooleanNofalse-
errorWhether there is an error with the input.booleanNo--
successWhether the input is successful.booleanNo--
warningWhether there is a warning with the input.booleanNo--
hintThe hint text to display below the input.stringNo--

Events ​

Event namePayloadDescription
update:model-valuevalue: TEvent emitted when value change
blurvalue: FocusEventEmitted when the radio lost focus
changevalue: TEvent emitted when value change
focusvalue: FocusEventEmitted when the radio is focused

Slots ​

NameDescriptionBindings
defaultisSelected boolean
value T