published fresh until

Tailwind v4 and shadcn: how do I add light, dark and system themes?

Summary When building a Tailwind v4 and shadcn/ui theme, use linked guidance for light, dark, and system modes, no-flash reloads, design tokens, and v4 syntax; per-brand theme packs have no tested answer yet.

Not for records table, see case-expense-table-nextjs-supabase-filters-sort-csv-export; admin screens, see case-admin-panel-roles-nextjs-supabase-who-can-see-what

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The case

You want the app to follow the user's light or dark setting, offer a manual toggle that remembers the choice, use one set of colour tokens everywhere, and not flash the wrong theme on reload. Stack: Tailwind v4 with shadcn/ui, Next.js for the reload fix.

This is a map, not new advice: linked rows point to existing WhatWorks threads. Nobody here ran this whole build; the Status column says what each linked thread rests on. "Tried" would need a linked trial report; the DESIGN.md thread now links a lab-tested package, which does not establish an end-to-end trial.

Parts, in the order people do them

PartWhat to useStatusLink
Light, dark and system toggleClass or data-theme approach in Tailwind v4Documented: vendor or primary source, not tried (no linked trial)How do I add a light, dark and system theme toggle with Tailwind v4?
No wrong-theme flash on reloadInline script before paint (next-themes pattern)Documented: vendor or primary source, not tried (no linked trial)Why does my Next.js site flash light before dark mode on reload?
Tokens from the design fileFigma MCP using your tokens, not hard-coded coloursDocumented: vendor or primary source, not tried (no linked trial)How do I make Figma MCP code use my design tokens?
Tokens written down for the agentDESIGN.md spec with lint and exportLab-tested package: clean-project checks passed; full build not triedHow do I give my agent a DESIGN.md so every screen matches?
Agent writes old Tailwind syntaxUpgrade-guide fix for v3 habitsDocumented: vendor or primary source, not tried (no linked trial)My agent keeps writing Tailwind v3 code in my v4 project: fix?
Component library choiceMUI or shadcn when the agent writes the UIUntried: community post or suggestion only, no linked trialMUI or shadcn for an internal dashboard when the agent writes it?
Several brand themes from one codebaseNo tested answer yetNo tested answer yetnone (see open request)

Where it breaks

Open questions

  • Parts marked "No tested answer yet" are gaps in WhatWorks; ask for them with the request tool so an editor can look: multiple brand themes (white-label) from one token set.

Sources

Each linked WhatWorks thread cites its own primary sources; this page adds none of its own. Status labels were checked against the linked thread pages on 15 November 2026.

As of October 2026. a records table, see case-expense-table-nextjs-supabase-filters-sort-csv-export; admin screens, see case-admin-panel-roles-nextjs-supabase-who-can-see-what.

Started from a post by @WhatWorks editors, packaged by the editor.

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Tailwind v4 and shadcn: how do I add light, dark and system themes?
Summary: When building a Tailwind v4 and shadcn/ui theme, use linked guidance for light, dark, and system modes, no-flash reloads, design tokens, and v4 syntax; per-brand theme packs have no tested answer yet.
Copy for agent
get the whatworks thread case-dark-light-system-theme-design-tokens-tailwind-v4-shadcn and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread case-dark-light-system-theme-design-tokens-tailwind-v4-shadcn
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp