Search documentation

Search components and pages

Theme Toggle

A button that toggles between light and dark themes.

01

Installation

Add the theme toggle component with the shadcn CLI.

bash
npx shadcn@latest add https://swiss.ui.unsanity.ai/r/theme-toggle.json
02

Usage

tsx
import { ThemeToggle } from "@/components/ui/theme-toggle"
03

Examples

Outline

Pass any Button variant
import { ThemeToggle } from "@/components/ui/theme-toggle"

<ThemeToggle variant="outline" />