Skip to content

Switch API

API reference docs for the Stash Switch component. Learn about the props, CSS, and other APIs of this exported module.

Import

ts
import Switch from '@leaflink/stash/Switch.vue';

Props

NameTypeDefaultDescription
checkedboolean | ArrayfalseThe current checked value, can be a boolean or an array of values
disabledbooleanfalsePrevent the user from changing the switch state.
hintTextstring '' Displays text below the input; hidden when the isReadOnly prop is truthy.
idstringundefinedUnique ID for the switch, required for accessibility purposes
labelstring '' Label text to display with switch
namestring '' HTML name property
valuestring | numberValue associated with switch when it is `checked`. This value is used to compare against `checked` property when passed as an array.

Slots

NameDescription
hintfor displaying hint text

Events

NameDescription
update:checked