There is no tailwind.config.js after installing Tailwind 4 and HeroUI in Next.js
tailwind.config.js not found in a new Next.js projectShort answer
Nothing is broken: Tailwind CSS 4 is configured in CSS and no longer creates tailwind.config.js. With HeroUI v3 you add two imports to globals.css, tailwindcss first and @heroui/styles second. If you still need a JS config, load it yourself with @config.
Fix it fast
1Find out which cause you have
Check which Tailwind version you have and what your global stylesheet imports. These two facts decide the cause.
npm ls tailwindcss head -5 app/globals.css2Match what you see, then jump to its fix
- 1
npm ls shows tailwindcss 4.x and the file was never generatedTailwind CSS 4 has no config file by designFix - 2
Tailwind classes work but HeroUI components look unstyledHeroUI styles are not imported, or are imported in the wrong orderFix - 3
You migrated from Tailwind 3 and custom colors or plugins from tailwind.config.js stopped workingAn old JS config is not loadedFix
- 1
What does the error look like?
tailwind.config.js not found in a new Next.js projectHeroUI components render unstyled
Cause 1 of 3
Tailwind CSS 4 has no config file by design
1Check
In version 4 configuration lives in CSS (@theme, @plugin, @source), and PostCSS uses the @tailwindcss/postcss plugin. A JS config is no longer detected automatically.
cat postcss.config.mjs
grep -n "@import" app/globals.css2Fix
Do not create the file. Use the Tailwind 4 setup: the PostCSS plugin and one import in the stylesheet.
npm install tailwindcss @tailwindcss/postcss postcss
// postcss.config.mjs
const config = { plugins: { "@tailwindcss/postcss": {} } };
export default config;
/* app/globals.css */
@import "tailwindcss";3Verify
Start the dev server and use a utility class such as text-3xl on a heading.
npm run devConfirmed by tailwindcss.com
Cause 2 of 3
HeroUI styles are not imported, or are imported in the wrong order
1Check
HeroUI v3 needs React 19 and Tailwind 4, and its setup is two CSS imports. It does not use a tailwind.config.js. The order matters: tailwindcss must come first.
head -5 app/globals.css2Fix
Install the packages and put both imports in your main stylesheet, in this order.
npm i @heroui/styles @heroui/react
/* app/globals.css */
@import "tailwindcss";
@import "@heroui/styles";3Verify
Reload the page and render a HeroUI button; it should have its theme styling.
npm run devConfirmed by heroui.com
Cause 3 of 3
An old JS config is not loaded
1Check
A config file is still supported for backward compatibility, but Tailwind 4 does not find it by itself.
ls tailwind.config.*2Fix
Load it from the stylesheet with @config, after the Tailwind import, or move its values into @theme over time.
@import "tailwindcss";
@config "../tailwind.config.js";3Verify
Rebuild and check that a custom value from the config applies.
npm run devConfirmed by tailwindcss.com
How do I stop it coming back?
- Read the HeroUI version you install: v3 steps differ from the v2 guides still found online.
- Keep Tailwind configuration in CSS for new code and avoid mixing both styles.
- Pin tailwindcss to a major version in package.json.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
Tailwind classes have no effect in a Next.js app
Styles from Tailwind never reach the page after install
The page loads but Tailwind classes do nothing when the generated CSS never reaches the page.
5 causes, each with a fixWeb apps
Hydration failed after adding next-themes dark mode
Console reports a server and client mismatch on the html element
next-themes changes the html element and knows the theme only in the browser, so server HTML and client HTML differ.
3 causes, each with a fixWeb apps
A shadcn/ui Dialog stays open after the form is submitted
Form submits and the data saves, but the modal remains on screen
A shadcn Dialog is a Radix dialog.
3 causes, each with a fixWeb apps
A Tailwind class does not override the class before it
A utility you added last has no effect on the element
Tailwind does not read your class attribute from left to right.
4 causes, each with a fixWeb apps
ESLint says an element in a list is missing its key prop
react/jsx-key
react/jsx-key fires when an element returned from map, Array.from or an array literal has no key.
3 causes, each with a fixWeb apps
react-i18next shows the wrong plural form for a count, or prints the key instead of the text
t('item') prints the key item instead of a translated sentence
i18next picks a plural from the count option and looks for keys ending in _one, _other and so on.
4 causes, each with a fix