Back to Components
Feedback

Switch

Toggle switch for boolean settings, built with accessible primitives.

Off

Dependencies

  • @radix-ui/react-switch
  • clsx
  • tailwind-merge

Files

  • components/ui/switch.tsx

Installation

Using shadcn CLI

npx shadcn add switch --url https://ui.hampton.io

Manual installation

Copy the component file to your project and install dependencies:

npm install @radix-ui/react-switch clsx tailwind-merge