saturation/uisaturation/ui
DocsComponentsBlocksPages
GitHub

Sections

IntroductionComponentsInstallationMCPTheming

Components

ComponentsAccordionAI Chat InputAlertAnimated GroupAnimated NumberAvatarBadgeBeamBlur FadeBorder TrailBreadcrumbButtonButton GroupCalendar PickerCardChartCheckboxCollapsibleComboboxCommandComparison SliderContext MenuCredit CardData TableDate PickerDialogDropdown MenuEmoji PickerEmptyFieldFiltersFull CalendarGlow EffectInputInput GroupInput OTPItemKanbanKbdMenubarNavigation MenuNovel EditorPaginationParallaxProgressProgressive BlurRadio GroupRippleSelectSeparatorSheetSkeletonSliderSonnerSpinnerSpotlightSwitchTableTabsText EffectText ShimmerTextareaToggleToggle GroupTreeTypography
Docs/Components/Theme Toggle

Theme Toggle

A button that switches between light and dark mode using next-themes.

Loading...

Installation

pnpm dlx shadcn@latest add https://ui.saturation.io/r/theme-toggle.json

Dependencies

Requires next-themes to be set up in your project.

npm install next-themes

Wrap your app with ThemeProvider:

import { ThemeProvider } from "next-themes"

export default function RootLayout({ children }) {
  return (
    <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
      {children}
    </ThemeProvider>
  )
}

Usage

import { ThemeToggle } from "@/components/ui/theme-toggle"
<ThemeToggle />

API Reference

ThemeToggle

No additional props. The component internally uses useTheme() from next-themes to toggle between "light" and "dark".

PreviousTextareaNextThinking Indicator

On This Page

  • Installation
  • Dependencies
  • Usage
  • API Reference
  • ThemeToggle