Skip to content

MazRadio

MazRadio is a standalone component

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

NameDescriptionTypeRequiredDefault
styleStyle attribut of the component root elementNative typeNoundefined
classClass attribut of the component root elementNative typeNoundefined
idThe id of the radiostringNoundefined
model-valuev-model
TNoundefined
valueThe value of the radioTYesundefined
nameThe name of the radiostringYesundefined
labelThe label of the radiostringNoundefined
colorThe color of the radioMazColorNo'primary'
sizeThe size of the radioMazSizeNo'md'
disabledThe disabled state of the radiobooleanNofalse
errorWhether there is an error with the input.booleanNoundefined
successWhether the input is successful.booleanNoundefined
warningWhether there is a warning with the input.booleanNoundefined
hintThe hint text to display below the input.stringNoundefined

Events

Event namePropertiesDescription
update:model-valuevalue string | number | boolean - selected valueEvent emitted when value change
changevalue string | number | boolean - selected valueEvent emitted when value change
blurvalue FocusEvent - The focus eventEmitted when the radio lost focus
focusvalue FocusEvent - The focus eventEmitted when the radio is focused

Slots

NameDescriptionBindings
default