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
| Name | Type | Default | Description |
|---|---|---|---|
id | string | — | |
disabled | boolean | — | |
size | "md" | "sm" | — | |
labelPosition | "start" | "end" | — | |
modelValue | boolean | false |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: boolean] |
Slots
| Name | Scope | Description |
|---|---|---|
default | — |