StretchSwitch

A toggle switch whose thumb stretches slightly while dragging or pressing, then snaps naturally to its destination via a snappy spring.

Reduce motion
Disable spring animations
Dark mode
Toggle dark theme

Installation

Add the component directly to your repository using shadcn CLI:

npx shadcn@latest add Surajmaurya1/easyui/stretch-switch

API Reference

PropTypeDefaultDescription
checkedbooleanundefinedControlled checked state
defaultCheckedbooleanfalseInitial checked state (uncontrolled)
disabledbooleanfalsePrevents interaction
onChange(checked: boolean) => voidundefinedCalled when the switch toggles
labelReact.ReactNodeundefinedLabel text on the left
descriptionstringundefinedHelper text below the label