Skip to content

MazCheckbox ​

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

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

Basic usage ​

v-model="false"

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

const checked = ref(false)
</script>

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

Colors ​

v-model="[]"

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

const chosenColors = ref([])

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

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

Sizing ​

v-model="[]"

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

const chosenSizes = ref([])

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

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

Disabled ​

Props ​

NameDescriptionTypeRequiredDefaultPossible values
model-valuev-model The model value of the checkboxTNo--
idThe id of the checkboxstringNo--
colorThe color of the checkbox"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"No"primary"'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'destructive' | 'contrast' | 'transparent'
valueThe value of the checkbox when selectedMazCheckboxValueNo--
nameThe name of the checkboxstringNo"m-checkbox"-
sizeThe size of the checkbox"xs" | "sm" | "md" | "lg" | "xl" | "mini"No-'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'mini'
labelText labelstringNo--
disabledIf the checkbox is disabledbooleanNo--
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: TEmitted when the model value change
blurvalue: FocusEventEmitted when the checkbox lost focus
changevalue: TEmitted when the model value change
focusvalue: FocusEventEmitted when the checkbox is focused

Slots ​

NameDescriptionBindings
defaultvalue MazCheckboxValue