Skip to content

MazCheckbox

MazCheckbox is a standalone component that replaces the standard html input checkbox. Color options are available.

INFO

Before you have to import the global css files in your project, follow instructions in Getting Started

Basic usage

v-model="false"

vue
<template>
  <MazCheckbox v-model="checked" :label="checked ? 'Checked' : 'Unchecked'" />
</template>

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

  const checked = ref(false)
</script>

Colors

v-model="[]"

View code
vue
<template>
  <MazCheckbox
    v-for="color in colors"
    :key="color"
    v-model="chosenColors"
    :color="color"
    :id="color"
    name="color"
    :value="color"
  >
    {{ color }}
  </MazCheckbox>
</template>

<script lang="ts" setup>
  import { ref } from 'vue'
  import MazCheckbox, { type Color } from 'maz-ui/components/MazCheckbox'

  const chosenColors = ref([])

  const colors: Color[] = [
    'primary',
    'secondary',
    'info',
    'success',
    'warning',
    'danger',
    'white',
    'black',
    'theme',
  ]
</script>

Sizing

v-model="[]"

View code
vue
<template>
  <MazCheckbox
    v-for="size in sizes"
    :key="size"
    v-model="chosenSizes"
    name="size"
    :value="size"
    :size="size"
  >
    {{ size }}
  </MazCheckbox>
</template>

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

  const chosenSizes = ref([])

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

Disabled

Props, Event & Slots

Props

Prop nameDescriptionTypeValuesDefault
styleStyle attribut of the component root elementTSIndexedAccessType-undefined
classClass attribut of the component root elementTSIndexedAccessType-undefined
modelValueThe model value of the checkboxT-undefined
idThe id of the checkboxstring-undefined
colorThe color of the checkboxColor-'primary'
valueThe value of the checkbox when selectedunion-undefined
nameThe name of the checkboxstring-'m-checkbox'
sizeThe size of the checkboxSize-'md'
labelText labelstring-undefined
disabledIf the checkbox is disabledboolean-false
errorWhether there is an error with the input.boolean-
successWhether the input is successful.boolean-
warningWhether there is a warning with the input.boolean-
hintThe hint text to display below the input.string-

Events

Event namePropertiesDescription
update:model-valuevalue mixed - The new valueEmitted when the model value change
changevalue mixed - The new valueEmitted when the model value change
blurvalue FocusEvent - The focus eventEmitted when the checkbox lost focus
focusvalue FocusEvent - The focus eventEmitted when the checkbox is focused

Slots

NameDescriptionBindings
default