Playground GitHub npm

Switch

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

ui form

Preview

Installation

npx slintcn@latest 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

theme only

Installed automatically as transitive dependencies of slintcn add switch.