Toggle
Two-state pressable button (default/outline).
ui form
Preview
Installation
npx slintcn@latest add toggleUsage
import { Toggle, ToggleVariant } from "slintcn/components/toggle.slint";
Toggle { text: "Bold"; pressed <=> bold; }
Properties
text
in
string
Label rendered inside.
pressed
in-out
bool
Two-way pressed state.
variant
in
ToggleVariant
Visual style — `default` or `outline`.
disabled
in
bool
When true, dims and stops responding.
toggled
callback
(bool)
Fired with the new `pressed` value.
API
ToggleVariantdefaultoutlineAccessibility
focusableyeskeyboardEnterSpaceDependencies
theme only
Installed automatically as transitive dependencies of slintcn add toggle.