TL;DR: Use @config directive.

From v4 onwards, the use of the tailwind.config.js file has been removed, and CSS-first directives are provided for configuration. The init process, which previously generated this config file by default, has also been discontinued. If you want to use a JS-based config file from v4 onwards, you must create it manually and specify its location in CSS using the @config directive so that v4 can find the configuration.

  • Changed npx tailwindcss to npx @tailwindcss/cli - TailwindCSS v4 Docs
  • Removed npx tailwindcss init process - StackOverflow
  • Deprecated: Sass, Less and Stylus preprocessors support - StackOverflow
  • CSS-first configuration instead of tailwind.config.js - TailwindCSS v4 Docs
  • Use @config directive to legacy JavaScript-config - StackOverflow
  • Automatic Source Detection - StackOverflow

TailwindCSS v4 is backwards compatible with v3

I see that you've created the old v3 legacy JavaScript-based configuration. In v4, this is no longer necessary due to the new CSS-first configuration, but you can still use it by adding an extra @config directive if needed.

Using a JavaScript config file

JavaScript config files are still supported for backward compatibility, but they are no longer detected automatically in v4.

If you still need to use a JavaScript config file, you can load it explicitly using the @config directive:

@config "../../tailwind.config.js";
  • Using a JavaScript config file - TailwindCSS v4 Update Guide

The configuration setting has changed by default. However, you have the option to declare the location of your tailwind.config.js file using a relative path in your default CSS file so you can use it again.

New configuration option in v4

CSS-First Configuration: Customize and extend the framework directly in CSS instead of JavaScript.

With TailwindCSS v4, you have the option to omit the tailwind.config.js file. You can find many new directives, such as @theme, which allows you to declare your custom settings directly in your CSS file, or @plugin, which lets you import TailwindCSS v4-compatible plugins directly in your CSS file.

I won't list all the new directives, but you can check them out here:

  • Functions and directives - TailwindCSS v4 Docs
Answer from rozsazoltan on Stack Overflow
🌐
Tailwind CSS
tailwindcss.com › blog › tailwindcss-v4
Tailwind CSS v4.0 - Tailwind CSS
With the improvements we've made to this process for v4.0, Tailwind feels more light-weight than ever: Just one-line of CSS — no more @tailwind directives, just add @import "tailwindcss" and start building. Zero configuration — you can start using the framework without configuring anything, not even the paths to your template files.
🌐
GitHub
github.com › tailwindlabs › tailwindcss › discussions › 16803
[v4] Docs on tailwind.config.js and @config · tailwindlabs/tailwindcss · Discussion #16803
You only need tailwind.config.js for advanced customization (plugins, themes, content paths, etc.). If you want one generated for you, downgrade to v3, run npx tailwindcss init -p, then upgrade back to v4.
Author   tailwindlabs
Discussions

(Solution) Tailwind V4 Missing tailwind.config.js
congratulations for finding you need to read the docs. More on reddit.com
🌐 r/tailwindcss
49
123
January 25, 2025
How can I setup tailwind.config.js with Angular & TailwindCSS v4 application - Stack Overflow
TL;DR: Use @config directive. From v4 onwards, the use of the tailwind.config.js file has been removed, and CSS-first directives are provided for configuration. The init process, which previously generated this config file by default, has also been discontinued. More on stackoverflow.com
🌐 stackoverflow.com
How to create config in Tailwind CSS v4 - Stack Overflow
Context I am trying to create custom animation in Tailwind CSS v4. I am stuck because the tailwind.config.js file is deprecated by this tailwind version and I don't find out an alternative. For ex... More on stackoverflow.com
🌐 stackoverflow.com
How to set Tailwind CSS v4 global class? - Stack Overflow
CSS-First Configuration: Customize and extend the framework directly in CSS instead of JavaScript. Which TailwindCSS v4 namespace matches a given TailwindCSS v3's theme keys? More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › tailwindlabs › tailwindcss › discussions › 15855
Beginner tutorial for setting up tailwind v 4 using the standalone CLI (no node.js) · tailwindlabs/tailwindcss · Discussion #15855
This is the only documentation out there that explains how to configure the Standalone CLI for Tailwind v4. Thank you so much. @tailwindlabs can you guys please update your documentation and properly support Standalone CLI?
Author   tailwindlabs
🌐
Reddit
reddit.com › r/tailwindcss › (solution) tailwind v4 missing tailwind.config.js
r/tailwindcss on Reddit: (Solution) Tailwind V4 Missing tailwind.config.js
January 25, 2025 -

So I was starting a new vite-react tailwind project and tailwind has been updated to v4 just recently. Was gonna create some new themes config but no `tailwind.config.js` files were being generated.

After some research and experimentation, finally made it work!

Update from Tailwind Docs:

Instead of a tailwind.config.js file, you can configure all of your customizations directly in the CSS file where you import Tailwind, giving you one less file to worry about in your project:

Also, if you aren't sure how to initialize the project or make a new tailwind css project, you can follow this guide: https://drive.google.com/file/d/1mlmO0e479nASrxJ-YLImHoxpmwCymLHs/view , credits to: https://www.youtube.com/watch?v=-JDCFN0Znj8

Hope this helps ya'll! I couldn't post it on StackOverflow cuz I only recently made a new account.

Mar 17, 2025 Edit: this guy has a more in-depth explanation and fix to this new update. Including the content, plugins, etc:

New CSS-First configuration

🌐
Bryan Anthonio
bryananthonio.com › blog › configuring-tailwind-css-v4
A First Look at Setting Up Tailwind CSS v4.0
In this post, I’ll share my experience migrating to TailwindCSS v4, focusing on the new @theme directive and how it simplifies design token management. You’ll see how the new approach eliminates the need for a separate JavaScript configuration file and makes working with CSS variables more ...
Top answer
1 of 1
11

TL;DR: Use @config directive.

From v4 onwards, the use of the tailwind.config.js file has been removed, and CSS-first directives are provided for configuration. The init process, which previously generated this config file by default, has also been discontinued. If you want to use a JS-based config file from v4 onwards, you must create it manually and specify its location in CSS using the @config directive so that v4 can find the configuration.

  • Changed npx tailwindcss to npx @tailwindcss/cli - TailwindCSS v4 Docs
  • Removed npx tailwindcss init process - StackOverflow
  • Deprecated: Sass, Less and Stylus preprocessors support - StackOverflow
  • CSS-first configuration instead of tailwind.config.js - TailwindCSS v4 Docs
  • Use @config directive to legacy JavaScript-config - StackOverflow
  • Automatic Source Detection - StackOverflow

TailwindCSS v4 is backwards compatible with v3

I see that you've created the old v3 legacy JavaScript-based configuration. In v4, this is no longer necessary due to the new CSS-first configuration, but you can still use it by adding an extra @config directive if needed.

Using a JavaScript config file

JavaScript config files are still supported for backward compatibility, but they are no longer detected automatically in v4.

If you still need to use a JavaScript config file, you can load it explicitly using the @config directive:

@config "../../tailwind.config.js";
  • Using a JavaScript config file - TailwindCSS v4 Update Guide

The configuration setting has changed by default. However, you have the option to declare the location of your tailwind.config.js file using a relative path in your default CSS file so you can use it again.

New configuration option in v4

CSS-First Configuration: Customize and extend the framework directly in CSS instead of JavaScript.

With TailwindCSS v4, you have the option to omit the tailwind.config.js file. You can find many new directives, such as @theme, which allows you to declare your custom settings directly in your CSS file, or @plugin, which lets you import TailwindCSS v4-compatible plugins directly in your CSS file.

I won't list all the new directives, but you can check them out here:

  • Functions and directives - TailwindCSS v4 Docs
🌐
Tailwind CSS
tailwindcss.com › docs › upgrade-guide
Upgrade guide - Getting started - Tailwind CSS
In v4, these values are preserved which is more consistent with how other utilities in Tailwind work. This means you may need to explicitly use via-none if you want to "unset" a three-stop gradient back to a two-stop gradient in a specific state: ... <div class="bg-linear-to-r from-red-500 via-orange-400 to-yellow-400 dark:via-none dark:from-blue-500 dark:to-teal-400"> <!-- ... --></div> In v3, the container utility had several configuration options like center and padding that no longer exist in v4.
Find elsewhere
🌐
Alex Vipond
alexvipond.dev › blog › configuring-tailwind-4-0
Configuring Tailwind 4.0 - Alex Vipond
I'm into web development and social impact. I write code and create content for these topics, and I share it on my website.
Top answer
1 of 1
31

New "CSS-first" configuration from v4 (instead of tailwind.config.js)

CSS-First Configuration: Customize and extend the framework directly in CSS instead of JavaScript.

  • Which TailwindCSS v4 namespace matches a given TailwindCSS v3's theme keys?

With TailwindCSS v4, you have the option to omit the tailwind.config.js file. You can find many new directives, such as @theme, which allows you to declare your custom settings directly in your CSS file, or @plugin, which lets you import TailwindCSS v4-compatible plugins directly in your CSS file.

I won't list all the new directives, but you can check them out here:

  • Functions and directives - TailwindCSS v4 Docs

Customizing your theme

If you want to change things like your color palette, spacing scale, typography scale, or breakpoints, add your customizations using the @theme directive in your CSS:

@theme {
  --font-display: "Satoshi", "sans-serif";
  --breakpoint-3xl: 1920px;
  --color-avocado-100: oklch(0.99 0 0);
  --color-avocado-200: oklch(0.98 0.04 113.22);
  --color-avocado-300: oklch(0.94 0.11 115.03);
  --color-avocado-400: oklch(0.92 0.19 114.08);
  --color-avocado-500: oklch(0.84 0.18 117.33);
  --color-avocado-600: oklch(0.53 0.12 118.34);
  --ease-fluid: cubic-bezier(0.3, 0, 0, 1);
  --ease-snappy: cubic-bezier(0.2, 0, 0, 1);
  /* ... */
}

Learn more about customizing your theme in the theme variables documentation.

  • Which TailwindCSS v4 namespace matches a given TailwindCSS v3's theme keys?
  • Adding Custom Styles: Customizing your theme - TailwindCSS v4 Docs

@plugin

Use the @plugin directive to load a legacy JavaScript-based plugin:

@plugin "@tailwindcss/typography";

The @plugin directive accepts either a package name or a local path.

  • @plugin directive - TailwindCSS v4 Docs

Related questions/answers for new CSS-first theme handling:

  • How to use custom color themes in TailwindCSS v4
  • How to override theme variables in TailwindCSS v4 - @theme vs @layer theme vs :root
  • When should I use * and when should I use :root, :host as the parent selector?
  • Should I use @theme or @theme inline?
  • How to switch to a CSS-first configuration in Tailwind CSS v4 and above

TailwindCSS v4 is backwards compatible with v3

Using a JavaScript config file

JavaScript config files are still supported for backward compatibility, but they are no longer detected automatically in v4.

If you still need to use a JavaScript config file, you can load it explicitly using the @config directive:

@config "../../tailwind.config.js";
  • Using a JavaScript config file - TailwindCSS v4 Update Guide

The configuration setting has changed by default. However, you have the option to declare the location of your tailwind.config.js file using a relative path in your default CSS file so you can use it again.

🌐
Flowbite
flowbite.com › blog › tailwind-v4
Tailwind v4 is here! Learn how to upgrade your current ...
November 24, 2024 - We cannot provide a description for this page right now
🌐
Tailwind CSS
tailwindcss.com › blog › tailwindcss-v4-alpha
Open-sourcing our progress on Tailwind CSS v4.0 - Tailwind CSS
We put an enormous amount of value in backwards compatibility, and that's where the bulk of the work lies before we can tag a stable v4.0 release later this year. Support for JavaScript configuration files — reintroducing compatibility with the classic tailwind.config.js file to make migrating to v4 easy.
🌐
DEV Community
dev.to › plainsailing › getting-started-with-tailwind-v4-3cip
Getting started with Tailwind v4 - DEV Community
March 4, 2025 - The major user-facing change in Tailwind v4 is that there is no longer a tailwind.config.js file with which to configure your theme and any other customisations.
🌐
Medium
medium.com › @aqib-2 › tailwind-css-4-1-say-goodbye-to-config-files-hello-to-css-first-configuration-a068b3a25c76
Tailwind CSS 4.1: Say Goodbye to Config Files, Hello to CSS-First Configuration | by Mohammed Aqib | Medium
June 11, 2025 - Gone are the days of wrestling with JavaScript config files — welcome to the era of CSS-first customization. If you’ve been using Tailwind CSS for a while, you’re probably familiar with the traditional tailwind.config.js file where you'd define your custom colors, spacing, breakpoints, and other design tokens.
🌐
LogRocket
blog.logrocket.com › home › getting ready for tailwind v4.0
Getting ready for Tailwind v4.0 - LogRocket Blog
January 13, 2025 - After setting up the config file, the next step involved adding the Tailwind directives to the index.css file. ... In Tailwind v4, you don’t need a tailwind.config.js file and @tailwind directives.
🌐
shadcn/ui
ui.shadcn.com › docs › tailwind-v4
Tailwind v4 - shadcn/ui
Upgrade to Tailwind v4 by following the official upgrade guide: https://tailwindcss.com/docs/upgrade-guide · Use the @tailwindcss/upgrade@next codemod to remove deprecated utility classes and update tailwind config.
🌐
Rsbuild
rsbuild.rs › guide › styling › tailwindcss
Tailwind CSS v4 - Rsbuild
This document introduces the integration of Tailwind CSS v4.
Top answer
1 of 3
3

Install TailwindCSS with Aceternity UI

Unfortunately, after reviewing the Aceternity UI documentation, I see that they do not yet have an official guide for v4 support. Until the official version is released, you can experiment on your own. In the meantime, you can install TailwindCSS v3 by specifying the version like this:

npm install tailwindcss@3
  • Install TailwindCSS v3 with Next.js - TailwindCSS v3 Docs

The documentation still incorrectly lists npm install tailwindcss, which has been installing v4 instead of v3 since January.

  • Install Aceternity UI with TailwindCSS v3 - Aceternity UI Docs

TailwindCSS v4 with Next.js

Specifically for Next.js, the TailwindCSS team has published v4-compatible steps. I believe following these will help you achieve your goal:

  • Install TailwindCSS v4 with Next.js - TailwindCSS v4 Docs

TailwindCSS v4 Configuration

From TailwindCSS v4 onwards, a CSS-first configuration has been introduced, and the legacy JavaScript-based tailwind.config.js configuration has been removed.

  • CSS-first configuration - TailwindCSS v4 Blog
  • Deprecated: Sass, Less and Stylus preprocessors support - StackOverflow
  • Automatic Source Detection from TailwindCSS v4 - StackOverflow
  • Removed @tailwind directives - StackOverflow

CSS-First Configuration: Customize and extend the framework directly in CSS instead of JavaScript.

With TailwindCSS v4, you have the option to omit the tailwind.config.js file. You can find many new directives, such as @theme, which allows you to declare your custom settings directly in your CSS file, or @plugin, which lets you import TailwindCSS v4-compatible plugins directly in your CSS file.

I won't list all the new directives, but you can check them out here:

  • Functions and directives - TailwindCSS v4 Docs

However, it is still possible to use the legacy JavaScript-based configuration with the @config directive, like this:

  • @config directive - TailwindCSS v4 Docs
  • TailwindCSS v4 is backwards compatible with v3 - StackOverflow

./src/style.css

@import "tailwindcss";
@config "./../tailwind.config.js";
2 of 3
2

I managed to make this work using the @plugin directive. In the src folder, I created a plugins folder and added two files: "add-var-color.ts" and "create-grid.ts".

create-grid.ts

import svgToTinyDataUri from 'mini-svg-data-uri'
import flattenColorPalette from 'tailwindcss/lib/util/flattenColorPalette'

export default function createGrid({ matchUtilities, theme }: any) {
    matchUtilities(
      {
        'bg-grid': (value: any) => ({
          backgroundImage: `url("${svgToTinyDataUri(
            `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" fill="none" stroke="${value}"><path d="M0 .5H31.5V32"/></svg>`
          )}")`,
        }),
        'bg-grid-small': (value: any) => ({
          backgroundImage: `url("${svgToTinyDataUri(
            `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="8" height="8" fill="none" stroke="${value}"><path d="M0 .5H31.5V32"/></svg>`
          )}")`,
        }),
        'bg-dot': (value: any) => ({
          backgroundImage: `url("${svgToTinyDataUri(
            `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16" fill="none"><circle fill="${value}" id="pattern-circle" cx="10" cy="10" r="1.6257413380501518"></circle></svg>`
          )}")`,
        }),
      },
      { values: flattenColorPalette(theme('backgroundColor')), type: 'color' }
    )
 }

add-var-color.ts

export default function addVariablesForColors({ addBase, theme }: any) {
  let allColors = flattenColorPalette(theme('colors'))
  let newVars = Object.fromEntries(
    Object.entries(allColors).map(([key, val]) => [`--${key}`, val])
  )

  addBase({
    ':root': newVars,
  })
}

now in your globals.css you can add that as plugin

@plugin "../plugins/add-var-color.ts";
@plugin "../plugins/create-grid.ts";

after the @import 'tailwindcss';

🌐
Flowbite
flowbite.com › docs › customize › configuration
Tailwind CSS Configuration - Flowbite
Since the release of Tailwind v4, the configuration file that you’ve previously used to set options has now been moved to your main CSS file where you can import modules, plugins, set new variables like colors and fonts, set the custom source files, and more.