Toggle
Each click flips pressed and sets
aria-pressed on the button. Bind the state or listen with onPressedChange.
Installation
Copy the command below and run it in your terminal.
Usage
Bind pressed (defaults to false), or pass onPressedChange. Icon-only toggles need
an aria-label. variant="outline" adds a border.
Examples
Icon toggle
Text toggle
Sizes
Disabled
Anatomy
Toggle - Toggles a pressed state.
<script lang="ts"> import Bold from '@lucide/svelte/icons/bold'; import { Toggle } from '@sivir-ui/svelte/components/toggle'; let bold = $state(true); </script> <Toggle bind:pressed={bold} aria-label="Bold"> <Bold size={14} /> </Toggle>