Actions

Toggle

A pressed/unpressed button, for standalone toggles like a toolbar formatting button or a favorite/bookmark action — pair multiple instances with your own shared state for exclusive selection.

html
<UiToggle />

Model value

modelValue is whether the toggle is pressed, bound two-way with v-model. Its content can be an icon, a label, or both.

Size

size is the size of the toggle.

Variant

variant sets how the toggle looks once pressed. Unpressed it's always quiet, whatever this is set to.

Color

color is the pressed state's color.

Icon

icon is the icon inside the toggle — on its own, or beside a label.

Icon size

iconSize is scaled against the toggle by default. Set it explicitly when the icon has to carry more weight than the control around it.

Disabled

disabled disables interaction with the toggle.

Exclusive selection

A view switcher, driven off one shared value rather than each toggle's own.

No built-in group

Toggle only tracks its own pressed state. For an exclusive set (like the view switcher above), drive each Toggle's model-value off shared state yourself rather than expecting radio-style behavior for free.


API Reference

Generated from the component's source — props, slots and emits as the component actually declares them.

Props

Prop
Type
Default
Description
boolean
false
Whether the toggle is pressed (on).
"sm" | "md" | "lg"
'md'
The size of the toggle.
"solid" | "subtle" | "soft" | "ghost"
'subtle'
The visual style applied when the toggle is pressed.
"neutral" | "primary" | "secondary" | "success" | "error" | "warning" | "info" | "pending"
'neutral'
The color theme applied when the toggle is pressed.
string
Name of the icon displayed inside the toggle.
number | "xs" | "sm" | "md" | "lg" | "xl"
'sm' on a small toggle, 'md' otherwise
Size of the icon, passed through to the UiIcon component.
boolean
false
Disables interaction with the toggle.

Slots

Slot
default

Emits

Event
Payload
Description
update:modelValue
[value: boolean]

Types

ts
type Variant = "solid" | "subtle" | "soft" | "ghost";
ts
type Color = "neutral" | "primary" | "secondary" | "success" | "error" | "warning" | "info" | "pending";