Skip to content

Switch ​

role=switch toggle

A setting that takes effect the moment it's flipped — notifications on, dark mode. When the choice only applies after a Save button, use a Checkbox: a switch promises it's already done.

Basic
  • A native checkbox with role="switch", so it's read as on / off and Space flips it.
  • The slot is its label; labelPosition="start" puts the label first. In a Field it gets the field's description and error.
  • In right-to-left pages the thumb travels the other way.

Usage ​

ts
import { BlessSwitch } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
idstring—
disabledboolean—
size"md" | "sm"—
labelPosition"start" | "end"—
modelValuebooleanfalse

Events

NamePayloadDescription
update:modelValue[value: boolean]

Slots

NameScopeDescription
default—

Released under the MIT License. Character names and artwork belong to their owners.