Patterns
DarkModeToggle
Animated toggle switch for light/dark mode with size variants.
Quick Preview
Dark Mode
Installation
# No extra dependencies
// Copy component fromsrc/components/patterns/DarkModeToggle.tsx
Usage
import DarkModeToggle from '@/components/patterns/DarkModeToggle'<DarkModeTogglesize="md"label="Appearance"onChange={(dark) => applyTheme(dark)}/>
Examples
Size Variants
Small
Medium
Large
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
initialMode | 'light' | 'dark' | 'dark' | Starting mode |
label | string | - | Label text next to toggle |
size | 'sm' | 'md' | 'lg' | 'md' | Toggle size |
className | string | - | Additional CSS classes |