Mode Toggle
A toggle to switch between light and dark mode
Preview
Prerequisites
This component requires a theme provider to function properly. If you haven't set one up yet, consider using our complete layout setup:
Installation
Install the button
npx shadcn@latest add https://jt-components.vercel.app/r/mode-toggle.jsonpnpm dlx shadcn@latest add https://jt-components.vercel.app/r/mode-toggle.jsonyarn dlx shadcn@latest add https://jt-components.vercel.app/r/mode-toggle.jsonbunx --bun shadcn@latest add https://jt-components.vercel.app/r/mode-toggle.jsonUsage
import { ModeToggle } from "@/components/mode-toggle"<ModeToggle />Source Code
Loading component...
Props
| Prop | Type | Default |
|---|---|---|
align? | "start" | "end" | "center" | "center" |
Examples
Change the Dropdown Menu Alignment
The dropdown menu can be aligned to the start, center, or end of the button. This is useful when you want to ensure the dropdown menu is visible on the screen when the button is at the edge of the screen.
Last updated on