Skip to content

FormToggleSwitch ​

A FormKit wrapper for OpenVue's ToggleSwitch component.

Live Example on Website

Usage ​

vue
<FormKit type="formToggleSwitch" v-model="value" />

Object-based Example ​

vue
<script setup>
const schema = [
  {
    $formkit: 'formToggleSwitch',
    id: 'basic',
    name: 'basic',
    label: 'Basic'
  },
  {
    $formkit: 'formToggleSwitch',
    name: 'eu_citizen',
    id: 'eu',
    suffix: 'Are you a european citizen: '
  },
  {
    $formkit: 'formToggleSwitch',
    name: 'confirmation',
    id: 'confirm',
    prefix: 'Are you sure ?',
    wrapperClass: 'flex items-center'
  },
  {
    $formkit: 'formToggleSwitch',
    name: 'readonly',
    label: 'readonly',
    readonly: true
  },
  {
    $formkit: 'formToggleSwitch',
    name: 'custom',
    label: 'custom values',
    trueValue: 'A',
    falseValue: 'B'
  },
]
const data = { readonly: true }
</script>

<template>
  <FormKit :schema="schema" :data="data" />
</template>

Props ​

NameTypeDescription
trueValueanyValue for ON state
falseValueanyValue for OFF state
ptobjectPass-through options
ptOptionsobjectPass-through options
unstyledbooleanDisable default styles

See OpenVue ToggleSwitch docs for more details.

FormKit OpenVue Module