Is it possible to override Tailwind CSS theme variables per route or component? #18022
Unanswered
NafisMahmudAyon
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Tailwind CSS community 👋
I'm working on a Next.js App Router project and trying to achieve per-route or per-component theme overrides using CSS custom properties.
📁 File Structure:
app/globals.css
In this global file, I’ve defined my primary color palette like this:
Now, I want to override these colors on a specific route or for a specific component.
🧩 Example Component:
component/AnyComponent.tsx
component/style.css
❓ The Question:
Can I override the Tailwind CSS theme colors like this on a per-component or per-route basis?
If not, what would be the best practice or workaround to achieve route-specific theming with Tailwind?
Any suggestions or examples would be greatly appreciated! 🙏
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions