Skip to content

Switch ​

State belongs to the parent. Compose this component with the props and slots below.

Preview ​

Open in the playground

Usage ​

SwitchExample.vueVue / TS
<script setup lang="ts">
import { ref } from 'vue'
import { FzSwitch } from '@chrisdalbano/forza-ui'
const enabled = ref<boolean>(true)
</script>

<template>
  <FzSwitch v-model="enabled" label="Precise values" />
</template>
TypeScript exampleSource you can use.

Import the shared stylesheet once and wrap your app in .fz-theme. See installation.

Props ​

NameTypeRequiredDefault
labelstringYesNone
disabledboolean | undefinedNoNone
modelValuebooleanYesNone

Events and state ​

v-model: boolean

  • update:modelValue: [value: boolean]

Slots ​

none

Add from source ​

sh
forza add switch

Set up the CLI first. Generated API tables come from the Vue source, using Vue Language Tools.

Released under the MIT License. Independent work.