Toggle

Toggle is a flexible switch component for boolean values. It supports color and size variants, and integrates easily with forms and v-model. Use it for enabling or disabling settings, preferences, or features.

Basic Usage

Code Example
Basic.vue

Components

The Toggle components include the following:

  • Toggle - A flexible switch component for boolean values.
  • ValidatorHint - A component for displaying validation messages or hints.

Toggle

The Toggle component provides a styled switch for boolean values, supporting color and size variants, and easy v-model integration.

Toggle Props Type Description
modelValue
any
v-model The current value (checked state).
disabled
boolean

Disables the toggle.

validator
boolean

Adds the validator class for toggle validation styling.

theme-controller
boolean

When checked, the page's theme will match the toggle's value.

color
string

Sets the color theme. Options: neutral, primary, secondary, accent, success, info, warning, error.

   
neutral
boolean

Sets color to neutral.

   
primary
boolean

Sets color to primary.

   
secondary
boolean

Sets color to secondary.

   
accent
boolean

Sets color to accent.

   
success
boolean

Sets color to success.

   
info
boolean

Sets color to info.

   
warning
boolean

Sets color to warning.

   
error
boolean

Sets color to error.

size
'xs' | 'sm' | 'md' | 'lg' | 'xl'

Sets the toggle size. Options: xs, sm, md, lg, xl.

   
xs
boolean

Sets size to xs.

   
sm
boolean

Sets size to sm.

   
md
boolean

Sets size to md.

   
lg
boolean

Sets size to lg.

   
xl
boolean

Sets size to xl.

Toggle Events Arguments Description
update:modelValue
v-model Emitted when the checked state changes.

ValidatorHint

The ValidatorHint component provides a styled container for validation messages or hints, often used in conjunction with form validation.

ValidatorHint Slots Description
default

Displays the validation message or hint text.

Examples

Color

Toggle switches with different color variants.

Code Example
Color.vue

In Card

Toggle used inside a card layout.

Code Example
InCard.vue

Size

Different toggle sizes.

Code Example
Size.vue