Tailwind CSS is a CSS framework and design system based on utility class, which can quickly add common styles to components, and support flexible extension of theme styles.
You can integrate Tailwind CSS in Rsbuild via PostCSS plugins.
This document introduces the integration of Tailwind CSS v4.
Please note that Tailwind CSS v4 uses many modern CSS features, such as Cascade Layers, if your target browser does not support these features, please use Tailwind CSS v3 first, see Using Tailwind CSS v3 for more details.
More information can be found in Tailwind CSS - Compatibility.
Rsbuild has built-in support for PostCSS, you can install tailwindcss
and @tailwindcss/postcss
packages to integrate Tailwind CSS:
You can register the Tailwind CSS PostCSS plugin through postcss.config.cjs or tools.postcss.
Add an @import
to your CSS entry file that imports Tailwind CSS.
You have now completed all the steps to integrate Tailwind CSS in Rsbuild!
You can use Tailwind's utility classes in any component or HTML, such as:
For more usage details, refer to the Tailwind CSS documentation.
Tailwind CSS provides a Tailwind CSS IntelliSense plugin for VS Code to automatically complete Tailwind CSS class names, CSS functions, and directives.
You can install this plugin in VS Code to enable the autocompletion feature.