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
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | undefined | Controlled checked state |
| defaultChecked | boolean | false | Initial checked state (uncontrolled) |
| disabled | boolean | false | Prevents interaction |
| onChange | (checked: boolean) => void | undefined | Called when the switch toggles |
| label | React.ReactNode | undefined | Label text on the left |
| description | string | undefined | Helper text below the label |