Skip to Content
✨ Just dropped my UI Library — still cooking up some magic! Stay tuned & maybe… hire me  or sponsor me 😉 
DocumentationSwitch

Switch

A smooth, accessible toggle switch component with beautiful hover animations and seamless state transitions. Perfect for settings, preferences, and binary choices.

Install Dependencies

npx
quickcode-ui add Switch

Usage

Switch Examples

Props

PropTypeDefaultDescription
checkedbooleanfalseWhether the switch is checked
onCheckedChange(checked: boolean) => void-Callback fired when the switch state changes
disabledbooleanfalseWhether the switch is disabled
idstring-Unique identifier for the switch input
classNamestring-Additional CSS classes for custom styling
size"sm" | "default" | "md" | "lg""default"Size variant of the switch component

Sizes

SizeDimensionsDescription
sm32×16pxSmall size for compact layouts
default48×24pxStandard size for most use cases
md56×28pxMedium size for emphasis
lg64×32pxLarge size for primary actions

Features

  • Smooth Animations: Fluid transitions with hover effects and gentle shadow animations
  • Keyboard Accessible: Full keyboard navigation support with focus management
  • Touch Friendly: Optimized for mobile and touch interactions
  • Visual Feedback: Subtle hover animations with expanding shadow effects
  • Dark Mode Ready: Seamless integration with light and dark themes using design tokens
  • Controlled & Uncontrolled: Supports both controlled and uncontrolled usage patterns
Last updated on