Files
ui/docs/content/3.forms/7.toggle.md
2023-10-27 20:43:23 +02:00

1.0 KiB

description, links
description links
Display a toggle field.
label icon to
GitHub i-simple-icons-github https://github.com/nuxt/ui/blob/dev/src/runtime/components/forms/Toggle.vue
label icon to
Switch i-simple-icons-headlessui https://headlessui.com/vue/switch

Usage

Use a v-model to make the Toggle reactive.

Style

Use the color prop to change the style of the Toggle.

::component-card

props: color: 'primary'

::

Icon

Use any icon from Iconify by setting the on-icon and off-icon props by using this pattern: i-{collection_name}-{icon_name} or change it globally in ui.toggle.default.onIcon and ui.toggle.default.offIcon.

::component-card

props: onIcon: 'i-heroicons-check-20-solid' offIcon: 'i-heroicons-x-mark-20-solid' excludedProps:

  • onIcon
  • offIcon

::

Disabled

Use the disabled prop to disable the Toggle.

::component-card

props: disabled: true

::

Props

:component-props

Config

:component-preset