Animated Switch

A switch component with smooth animations.

Dependencies

framer-motion

Installation

npm install framer-motion

Props

NameTypeDefaultDescription
idstring-Unique identifier for the switch input.
namestring-Name attribute for the switch input.
checkedbooleanfalseIndicates whether the switch is toggled on.
onChange(event: React.ChangeEvent<HTMLInputElement>) => void-Callback function triggered when the switch state changes.
labelstring''Label text for the switch.
classNamestring''Additional CSS classes to apply to the switch container.
Brought to life by Naseem Ansari – Building Experiences that Inspire