A simple switch component built from scratch using React and TypeScript.
This project was created as a way to deeply understand how a basic UI interaction works under the hood — from state handling to accessibility and smooth UI feedback.
Even simple UI components hide important complexity:
- state synchronization
- user interaction handling
- accessibility behavior
- visual feedback
This switch was built to understand and implement those concepts manually, without relying on external UI libraries.
- Toggle between ON / OFF states
- Smooth visual transition
- Keyboard support (Space / Enter)
- Click and touch support
- Fully controlled component behavior
- Minimal and clean implementation
- React
- TypeScript
- Tailwind CSS
- Framer Motion
import Switch from "./components/Switch";
export default function Example() {
return <Switch/>
}