Skip to content

MToggle <m-toggle> ​

A switch. The knob smears across, slams into the end and throws up a splash, and the track floods and settles. Built on a native checkbox with role="switch", so it works in forms and with the keyboard.

Demo source
vue
<script setup lang="ts">
import { ref } from 'vue';
import { MToggle } from 'vue-manga-ui';

const on = ref(false);
</script>

<template>
  <MToggle v-model="on" label="Notifications" name="notify" />
</template>

Props ​

PropTypeDefaultDescription
labelstring""Visible label.
disabledbooleanfalseDisables the toggle.
namestring—Form field name.
modelValuebooleanfalseWhether the switch is on.

Other HTML attributes (id, class, aria-*, data-*…) fall through to the component’s element and are type-checked.

Events ​

EventPayloadDescription
update:modelValue[value: boolean]v-model update.