---
site: ui.zyx.tw
url: https://ui.zyx.tw/theme-toggle
title: Theme Toggle
description: "Icon button that switches light and dark (next-themes)."
---

# Theme Toggle

Icon button that switches light and dark (next-themes).

Group: zyx.

## Install

```bash
bunx shadcn@latest init https://ui.zyx.tw/r/base.json
bunx shadcn@latest add @zyx1121/theme-toggle
```

The first line sets a project up on the base; skip it if the project already has it.

## Item

### Theme Toggle (`theme-toggle`)

Icon button that switches light and dark (next-themes).

- Install: `bunx shadcn@latest add https://ui.zyx.tw/r/theme-toggle.json`
- JSON: [theme-toggle.json](https://ui.zyx.tw/r/theme-toggle.json)
- Page: [https://ui.zyx.tw/theme-toggle](https://ui.zyx.tw/theme-toggle) ([Markdown](https://ui.zyx.tw/theme-toggle.md))
- npm dependencies: `lucide-react`, `next-themes`
- Registry dependencies: `https://ui.zyx.tw/r/button.json`

## More

- [Index](https://ui.zyx.tw/index.md): every item
- [Agent instructions](https://ui.zyx.tw/agent-instructions.md): the call order and the rules
- [DESIGN.md](https://github.com/zyx1121/www.zyx.tw/blob/main/apps/ui/DESIGN.md): the design contract
