I'm using the latest versions of Tailwind CSS and Next.js 14.
I noticed that the tailwind.config.ts file was not generated automatically, so I created it manually:
In my global.css, I only have this line:
@import "tailwindcss";
The Tailwind styles work fine, but DaisyUI styles are not applied at all.
Here is my package.json dependencies related to Tailwind and DaisyUi:
{
"devDependencies": {
"daisyui": "^5.0.43",
"tailwindcss": "^4.1.8",
"@tailwindcss/postcss": "^4",
"autoprefixer": "^10.4.21"
}
}
I'm not sure why DaisyUI is not working. What could be missing in my setup?
What I've done:
tailwind.config.ts with DaisyUI included in the plugins arraypackage.jsonWhat's not working:
Expected behavior:
I noticed that the tailwind.config.ts file was not generated automatically, so I created it manually
Good catch, but the solution was wrong. It's important to check the breaking changes before manually intervening. Since v4, Tailwind no longer uses tailwind.config.js. And there are many other breaking changes compared to v3 - here are some useful links:
It looks like you did everything right, except you didn't add the DaisyUI plugin in v4.
global.css
@import "tailwindcss";
@plugin "daisyui";
Besides, I see you're loading TailwindCSS with PostCSS - make sure you've added the Tailwind PostCSS plugin to the postcss.config.mjs file (important: it has an .mjs extension).
postcss.config.mjs
export default {
plugins: {
"@tailwindcss/postcss": {},
}
}
If you want to use TailwindCSS v3, only DaisyUI v4 is compatible with it, and they will no longer receive future support. These need to be installed with specific versions, and you'll have to rely on older documentation.