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";
2
3export 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


PropTypeDefaultDescription
defaultValuebooleanfalseInitial on/off state.
onChange(value: boolean) => void-Called when the value changes.