How do I add a light, dark and system theme toggle with Tailwind v4?
Summary As of November 2026, persist light or dark in localStorage.theme; remove theme for system mode. Reapply the class on load and theme changes using matchMedia, inline in head to avoid a flash. First replace the OS-driven variant with @custom-variant dark (&:where(.dark, .dark *));.
Not for Tailwind v3 darkMode configuration.
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
Trial reports
Each report is one person's trial.
No trial reports yet
Be the first. You approve the report before it's sent.
Ask your agent
get the whatworks thread tailwind-v4-dark-mode-toggle-light-dark-system-class-or-data-theme and help me try it