Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

Tailwind CSS IntelliSense gives no class suggestions in a React project

ErrorNo class name completions while typing inside className

Short answer

The extension needs to find your Tailwind setup first. For Tailwind 4 it looks for a CSS file that imports tailwindcss; for Tailwind 3 it needs a tailwind.config file. If it cannot find one, it stays silent. Open its output log, then fix detection, exclusions or the editor settings.

  • Applies to Tailwind CSS 4, VS Code, Tailwind CSS IntelliSense extension
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open the command palette and run Tailwind CSS: Show Output. The language server prints what it found and what failed.

    Tailwind CSS: Show Output
  2. 2Match what you see, then jump to its fix

    1. 1The output log shows no project or config foundtailwindcss is not installed in the workspace, or the CSS entry file is missingFix
    2. 2Several stylesheets or several Tailwind installs in a monorepoAuto-detection picked the wrong CSS file or configFix
    3. 3The entry file exists but the output log never mentions itVS Code hides the stylesheet or config from the extensionFix
    4. 4Completions work in className but not in a helper call or a custom propThe class is not in an attribute or language the extension watches, or string suggestions are offFix

What does the error look like?

  • No class name completions while typing inside className
  • No hover preview on Tailwind classes

Cause 1 of 4

tailwindcss is not installed in the workspace, or the CSS entry file is missing

1Check

Version 4 needs a .css file containing an import of tailwindcss, and the package in the folder you opened. Sass, Less and Stylus entry files are not supported.

npm ls tailwindcss
grep -rn "@import \"tailwindcss\"" src/

2Fix

Install the package where you opened VS Code, and import it from a plain CSS file.

npm install tailwindcss
/* src/index.css */
@import "tailwindcss";

3Verify

Reload the window and type a class in className.

Developer: Reload Window

Confirmed by github.com

Did this fix it?

Cause 2 of 4

Auto-detection picked the wrong CSS file or config

1Check

With multiple installs, config files or stylesheets importing tailwindcss, the extension cannot tell which one belongs to your app.

grep -rln "tailwindcss" --include=*.css . --exclude-dir=node_modules

2Fix

Point the extension at the entry stylesheet with the experimental config file setting.

// .vscode/settings.json
{
  "tailwindCSS.experimental.configFile": "src/index.css"
}

3Verify

Reload the window and check the output log for the chosen file.

Tailwind CSS: Show Output

Confirmed by github.com

Did this fix it?

Cause 3 of 4

VS Code hides the stylesheet or config from the extension

1Check

files.exclude, files.watcherExclude and tailwindCSS.files.exclude can all hide it.

grep -n "exclude" .vscode/settings.json

2Fix

Remove the entry file's folder from those exclude lists.

// .vscode/settings.json: make sure src/ is not listed
{ "files.exclude": {} }

3Verify

Reload and look for the file in the output log.

Developer: Reload Window

Confirmed by github.com

Did this fix it?

Cause 4 of 4

The class is not in an attribute or language the extension watches, or string suggestions are off

1Check

Only attributes listed in tailwindCSS.classAttributes get completions; the default list is class, className, ngClass and class:list. Completions inside strings also need editor.quickSuggestions to allow strings.

grep -n "classAttributes\|quickSuggestions" .vscode/settings.json

2Fix

Add your attribute name, and turn on quick suggestions for strings.

{
  "tailwindCSS.classAttributes": ["class", "className", "containerClassName"],
  "editor.quickSuggestions": { "strings": "on" }
}

3Verify

Type inside the custom attribute.

Developer: Reload Window

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Open VS Code on the folder that holds package.json and the Tailwind CSS entry file.
  • Keep the Tailwind entry file a plain .css file.
  • Set tailwindCSS.experimental.configFile in monorepos.

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:

Related fixes

Web 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 fix

Web apps

shadcn/ui setup fails in a Vite React project using Tailwind v4

Imports from @/components/ui do not resolve in the editor or the build

shadcn init needs three things in a Vite project: Tailwind v4 installed with the @tailwindcss/vite plugin and a single @import "tailwindcss" line in your CSS, the @/* path alias in both tsconfig.json and tsconfig.app.json, and the same alias in vite.config.ts, with @types/node installed so path resolves.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.