MeldUI

Toggle

A two-state button that can be either on or off.

Usage

Variants

Sizes

Props

PropTypeDefaultDescription
modelValueboolean-The controlled toggle state. Use with v-model.
defaultValueboolean-The default toggle state for uncontrolled usage.
variant'default' | 'outline''default'The visual style variant.
size'default' | 'sm' | 'lg''default'The size of the toggle.
disabledbooleanfalseWhether the toggle is disabled.

Events

EventPayloadDescription
update:modelValuebooleanEmitted when the toggle state changes.

Slots

SlotPropsDescription
default{ modelValue: boolean, state: 'on' | 'off', pressed: boolean, disabled: boolean }Toggle content with access to the toggle state.