Skip to content

MazSwitch

MazSwitch 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

Disabled

vue
<template>
  <MazSwitch
    v-for="color in colors"
    v-model="switchValue"
    :color="color"
    :name="color"
    :key="color"
  />

  <p>Disabled</p>

  <MazSwitch
    v-model="switchValue"
    name="disabled"
    disabled
  >
    {{ color }}
  </MazSwitch>
</template>

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

  const switchValue = ref(false)
  const switchValueDisabled = ref(false)

  const colors = [
    'primary',
    'secondary',
    'info',
    'success',
    'warning',
    'danger',
  ]
</script>

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 switchboolean-false
idThe id of the switchstring-undefined
disabledIf the switch is disabledboolean-false
nameThe name of the switchstring-undefined
colorThe color of the switchColor-'primary'

Events

Event namePropertiesDescription
update:model-valuevalue boolean - The new valueEmitted when the model value changes
changevalue boolean - The new valueEmitted when the model value changes

Slots

NameDescriptionBindings
defaultThe label of the switchvalue Boolean - The value of the switch