Toggle
Pressed buttons
A button that stays pressed — bold in a toolbar, a filter that's on. For a setting that applies at once, a Switch reads clearer; for a set of them, wrap toggles in a ToggleGroup.
Basic
Group Basic
align: left · fmt: [
"b",
"i"
]
- It is a
<button aria-pressed>, so it's read as "Bold, toggle button, pressed". - An icon-only toggle needs
label. - In a ToggleGroup,
type="single"allows one at a time (click the pressed one again to clear) andtype="multiple"any number; give the group alabel.
Usage
ts
import { BlessToggle, BlessToggleGroup } from "blessing-ui";API
BlessToggle
Props
| Name | Type | Default | Description |
|---|---|---|---|
value | string | number | — | required inside a BlessToggleGroup |
size | "md" | "sm" | "lg" | "md" | |
color | "text" | "accent" | "danger" | "accent" | |
disabled | boolean | — | |
label | string | — | |
pressed | boolean | false |
Events
| Name | Payload | Description |
|---|---|---|
update:pressed | [value: boolean] |
Slots
| Name | Scope | Description |
|---|---|---|
default | — |
BlessToggleGroup
Props
| Name | Type | Default | Description |
|---|---|---|---|
type | "single" | "multiple" | "single" | |
disabled | boolean | — | |
label | string | — | |
modelValue | T | T[] | — |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: T | T[] | undefined] |
Slots
| Name | Scope | Description |
|---|---|---|
default | — |