Skip to content

Swap ​

Two-face toggle (icon swap)

An on/off control drawn as two icons that trade places — play and pause, like, mute. It is a checkbox underneath, so it is announced as checked or not. For a toggle with a visible text label use Switch or Toggle.

Basic
  • label names the on state (Playing, Liked, Muted), because it is read with checked / not checked. "Play / pause" would be read as "Play / pause, checked" and mean nothing.
  • #on and #off are hidden from screen readers; the label speaks for them.
  • effect: fade (default), rotate, flip. All of them respect reduced motion.

Usage ​

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

API ​

Props

NameTypeDefaultDescription
idstring—
label*string—
disabledboolean—
effect"fade" | "rotate" | "flip"—how the two faces exchange
modelValuebooleanfalse

Events

NamePayloadDescription
update:modelValue[value: boolean]

Slots

NameScopeDescription
on—
off—

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