GtkSwitch
A toggle switch widget.
Preview
CSS Node Tree
switch[:checked]
├── image (on icon)
├── image (off icon)
└── sliderProps
Prop
Type
Behavior
- Click or tap to toggle
- Drag the slider horizontally to toggle
- The
activeprop controls the user-facing state - The
stateprop can differ fromactiveduring async operations (e.g., connecting to WiFi) onStateSetcallback can returnfalseto reject the change
Animation
The slider animates between positions with a 100ms ease-out-cubic transition, matching the native GTK behavior.