Skip to content

Switch โ€‹

A boolean toggle with sizes, color variants, optional loading state, and slot-overridable label and description text. Toggle Vue / CSS to switch the live demo and source together.

Basic โ€‹

Single switch with a label.

Vue SFC

Sizes โ€‹

Small, medium and large.

Vue SFC

Colors โ€‹

All built-in color variants.

Vue SFC

States โ€‹

Disabled, loading and pre-checked.

Vue SFC

Description โ€‹

Switch with a secondary description line.

Vue SFC

Slots โ€‹

Custom label and description via named slots.

Vue SFC

Event: change โ€‹

Listen to mno-change to react to toggling.

Vue SFC

Event log โ€‹

Live log of mno-change events.

Vue SFC

Customized โ€‹

Override per-element styling with cssClass (Vue) or utility classes (CSS).

Vue SFC

Card recipe โ€‹

Compose a card-style switch with your own CSS โ€” the library ships no helper.

Vue SFC

Types โ€‹

Importimport { SwitchProps } from 'mono-helper'
PropValueDefaultDescription
modelValuebooleanfalseTwo-way bound on/off state of the switch.
checkedbooleanfalseWhether the switch is checked (kept in sync with modelValue).
color'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info''primary'Color theme of the switch.
size'sm' | 'md' | 'lg''md'Size of the switch.
disabledbooleanfalseDisables interaction with the switch.
loadingbooleanfalseShows a loading state and blocks interaction.
labelstring''Text label shown next to the switch.
descriptionstring''Secondary description text shown under the label.
valuestring''Value submitted with the form when checked.
namestring''Form field name for the underlying input.
ariaLabelTextstringโ€”Accessible label for screen readers.
ariaLabelstringโ€”โ€”
cssClassSwitchCssClass{}Per-part class overrides for styling internal elements.