Does Tailwind CSS v4 have a config file?
Not by default: v4 is configured in CSS with @theme. Where every v3 setting went, how to load an old tailwind.config.js with @config, and when to keep it.
- Tailwind CSS 4.3.5
No, not by default. A new Tailwind CSS v4 project has no tailwind.config.js. Your configuration lives in the CSS file that imports Tailwind, under @theme and a few other directives. If you have an old config file you still need, one line loads it: @config "./tailwind.config.js";.
That's the short answer. The rest of this page shows where each v3 setting went, and the two cases where keeping the JavaScript file still makes sense.
Where the configuration lives now
Everything starts with one import in your main stylesheet:
@import "tailwindcss"; @theme { --color-brand: oklch(0.55 0.2 260); --font-display: "Inter Tight", sans-serif; --breakpoint-3xl: 120rem;}Each variable in @theme creates utilities. --color-brand gives you bg-brand, text-brand, border-brand and the rest. --font-display gives you font-display. --breakpoint-3xl adds a 3xl: variant. The prefix of the variable name (the namespace) decides which utilities you get, so the name matters more than it did in a JavaScript object.
Here is how the v3 keys map:
v3 tailwind.config.js | v4 CSS |
|---|---|
theme.extend.colors | @theme { --color-*: … } |
theme.extend.fontFamily | @theme { --font-*: … } |
theme.extend.screens | @theme { --breakpoint-*: … } |
theme.extend.spacing | @theme { --spacing: … } (one base value) or --spacing-* |
darkMode: 'class' | @custom-variant dark (&:where(.dark, .dark *)); |
content: [...] | Automatic. Add paths with @source "…"; |
plugins: [require('@tailwindcss/typography')] | @plugin "@tailwindcss/typography"; |
safelist | @source inline("bg-red-{500,600}"); |
A custom utility in @layer utilities | @utility name { … } |
To replace a whole default scale instead of extending it, reset the namespace first. This removes every built-in colour and leaves only yours:
@theme { --color-*: initial; --color-ink: oklch(0.15 0 0); --color-brand: oklch(0.55 0.2 260);}We checked this on Tailwind 4.3.5: with the reset, bg-red-500 is no longer generated.
Using an old tailwind.config.js anyway
Tailwind v4 ignores a tailwind.config.js that sits in the project unless you point to it. We tested it: a config that adds colors.brand.500 produced no bg-brand-500 class at all until we added the @config line.
@import "tailwindcss";@config "../../tailwind.config.js";The path is relative to the CSS file. With that line, the colour from the JavaScript file is back:
npx @tailwindcss/cli -i src/styles/global.css | grep -A2 bg-brand-500 .bg-brand-500 { background-color: #3b82f6; }Not every v3 option survives this route. The Tailwind docs list corePlugins, safelist and separator as unsupported in a v4 config file; use @source inline() for the safelist.
When keeping the JavaScript file makes sense
We'd keep @config in two situations:
- You're migrating a large v3 project and want it building on v4 before you move the theme over piece by piece.
- A plugin you depend on reads options from the config object and has no CSS-first version yet.
For everything else, move the values into @theme. It's one less file, the values are real CSS variables you can read with var(--color-brand) anywhere, and editors pick them up without a plugin. Our config to v4 converter turns a v3 theme object into the matching @theme block, and the official upgrade tool (npx @tailwindcss/upgrade) does the same for a whole project.
Questions
Where do I put the content paths in Tailwind v4?
Nowhere, usually. v4 scans your project on its own and skips files in .gitignore, which includes node_modules. If classes live in a package outside your project, add it with @source "../node_modules/your-ui-package";.
Is there still a tailwind.config.ts in shadcn/ui projects?
No. A project made with shadcn init on Tailwind v4 leaves "config": "" empty in components.json and puts its theme in the CSS file under @theme inline.
Does @config work with the Vite plugin and PostCSS?
Yes. @config is read by Tailwind itself, so it works the same with @tailwindcss/vite, @tailwindcss/postcss and the CLI.
Related articles
- Tailwind CSS v4Tailwind v4 custom colors: how to add them, and why they don’t workAdd a --color-* variable in @theme and every colour utility follows. The four reasons a custom colour silently does nothing, each reproduced.
- Tailwind CSS v4Tailwind v4 @apply not working: "Cannot apply unknown utility class"Style blocks in Astro, Vue and Svelte and CSS modules need @reference in v4. Custom classes need @utility. The error, the fix and the other causes.
- shadcn/uishadcn/ui not working with Tailwind v4: six causes and fixesUnstyled or transparent shadcn components on Tailwind v4 come from v3 leftovers: the old PostCSS plugin, @tailwind directives, hsl() wrappers, missing imports.
Still stuck? We answer every message ourselves. Write to us