Toggle
A toggle button component that changes background and icon color based on state. Built on top of bits-ui's Toggle for accessibility and keyboard navigation.
Import
import Toggle from "$lib/components/Toggle.svelte"; Basic Usage
A toggle button with different combinations of icon and label.
Toggle With Label
Disabled
Properties
Name
Type
Description
pressed
Type
boolean
Default: false
The controlled pressed state of the toggle.
icon
Type
string
Default: ""
Icon name for the toggle (without .svg extension).
label
Type
string
Default: ""
Optional text label next to the toggle.
disabled
Type
boolean
Default: false
Whether the toggle is disabled.