Create Playground GitHub crates.io npm

Switch

Sliding on/off toggle (36×20 track) with optional label.

ui form

Preview

Installation

cargo slintcn add switch

Usage

import { Switch } from "slintcn/components/switch.slint";

Switch { label: "Dark mode"; checked <=> dark; }

Properties

checked in-out bool

Two-way on/off state.

label in string

Text shown to the right of the track.

disabled in bool

When true, the switch dims and stops responding.

toggled callback (bool)

Fired with the new `checked` value.

API

Accessibility
focusableyes
keyboardSpace

Dependencies

focus-ring

Installed automatically as transitive dependencies of slintcn add switch.