Rendyn

Component library

189 components

Interaction

Theme Toggler

Animated Theme Toggler supports a controlled theme and callback plus a reveal treatment.

Interactive exampleReact Tailwind CSS

Practical React example

Connect a theme switch to the application’s actual light or dark preference.

Before you copy and paste

Match the imported component’s client or server rendering boundary before using the example. Copy components/magicui/animated-theme-toggler.tsx and its returned support files from the Code tab; preserve the project-relative paths. Include the returned styles: components/magicui/animated-theme-toggler.css.

Listed package dependencies: lucide-react.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Connect a theme switch to the application’s actual light or dark preference

// Usage adapted from Magic UI's pinned MIT source.
// Copyright (c) Magic UI. See ./LICENSES.md.
'use client';

import { AnimatedThemeToggler } from "@/components/magicui/animated-theme-toggler"

export function ComponentExample() {
  return (
    <AnimatedThemeToggler />
  );
}

Usage example adapted from Magic UI's pinned MIT source. Retain the source licence notices when copying.

Pair theme with onThemeChange when a theme provider owns persistence. Include the returned transition CSS and keep the root theme classes aligned with your design tokens.

Customization

AnimatedThemeTogglerProps.duration
Optional; number.
AnimatedThemeTogglerProps.variant
Optional; TransitionVariant.
AnimatedThemeTogglerProps.fromCenter
Optional; boolean. When true, the transition expands from the viewport center instead of the button center.
AnimatedThemeTogglerProps.theme
Optional; "light" | "dark". Controlled theme value. When provided, the parent owns persistence (e.g. `next-themes`) and this component will not write to localStorage.
AnimatedThemeTogglerProps.onThemeChange
Optional; (theme: "light" | "dark") => void. Called on toggle. Pair with `theme` for controlled usage.

Integration notes

  • Do not let the component and a separate provider compete to write different preferences.
  • Test initial hydration, unsupported transition APIs and reduced motion independently of the reveal.

Component source: Magic UI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP