# Theme Switcher Controlled 1 - Controlled switcher

> ThemeSwitcher controlled with React state.

A shadcn/ui block from the [@shadcnblocks](https://shadcnblocks.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/shadcnblocks/theme-switcher-theme-switcher-controlled-1).

- Page, with a live preview: https://shadcn.exchange/r/shadcnblocks/theme-switcher-theme-switcher-controlled-1
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/shadcnblocks/theme-switcher-theme-switcher-controlled-1-light-418ebb0e92c759d4.png
- Registry item: https://shadcnblocks.com/r/theme-switcher-theme-switcher-controlled-1.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://shadcnblocks.com/r/theme-switcher-theme-switcher-controlled-1.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `https://www.kibo-ui.com/r/theme-switcher.json`

## Files

### `example/theme-switcher/theme-switcher-controlled-1.tsx`

```tsx
"use client";

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

export const title = "Controlled switcher";

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

  return (
    <div className="flex flex-col items-start gap-2">
      <ThemeSwitcher onChange={setTheme} value={theme} />
      <p className="text-sm text-muted-foreground">Selected theme: {theme}</p>
    </div>
  );
};

export default Example;
```
