Docs
→Button
→Toggle Switch
Toggle Switch
A tactile on/off switch with indicator light and spring animation.
by Sarthak Kapila
Installation
Usage
Toggle Switch Example
1import ToggleSwitch from "@/components/toggle-switch";23export default function Example() {4 return <ToggleSwitch defaultValue={false} />5}
Understanding the component
The switch animates the thumb with a spring and updates a small indicator light. Transitions are tuned for a crisp, tactile feel.
Props
| Prop | Type | Default | Description | 
|---|---|---|---|
| defaultValue | boolean | false | Initial on/off state. | 
| onChange | (value: boolean) => void | - | Called when the value changes. |