Rendyn

Component library

189 components

Product blocks

Theme Switcher

Theme Switcher exposes a selected theme value and a change callback.

Interactive exampleReact Tailwind CSS

Practical React example

Choose light, dark or system appearance through the application’s theme provider.

Before you copy and paste

Use the composed primitives together under their required provider, where one is present. Copy components/kibo-ui/theme-switcher/index.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: @radix-ui/react-use-controllable-state, lucide-react, motion.

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

Choose light, dark or system appearance through the application’s theme provider

// Usage adapted from Kibo UI's pinned MIT source.
// Copyright (c) 2023 — Present shadcnblocks. See ./LICENSES.md.
"use client";

import { ThemeSwitcher } from "@/components/kibo-ui/theme-switcher";
import { useState } from "react";

const Example = () => {
  const [theme, setTheme] = useState<"light" | "dark" | "system">("system");

  return (
    <ThemeSwitcher defaultValue="system" onChange={setTheme} value={theme} />
  );
};

export default Example;

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

Pair value and onChange when another provider owns the preference. Treat system as a preference that can resolve differently as operating-system settings change.

Customization

ThemeSwitcherProps.value
Optional; "light" | "dark" | "system".
ThemeSwitcherProps.onChange
Optional; (theme: "light" | "dark" | "system") => void.
ThemeSwitcherProps.defaultValue
Optional; "light" | "dark" | "system".
ThemeSwitcherProps.className
Optional; string.

Integration notes

  • The control does not by itself apply every theme token or persist a preference.
  • Check initial hydration, persisted state and the actual resolved theme after changing the selection.

Component source: Kibo 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