There are conflicts when using the tailwindcss ‘base’ import and @studs/styles
or @studs/react/styles. Because of this we advise against loading the
tailwindcss base file and rely on theme and utilities only.
Step 1: Install the Required Packages
First, install both STUDS and Tailwind CSS in your project: Follow the necessary guide for getting setup using either @studs/styles or @studs/react Follow the tailwindcss guide for your framework of choiceStep 2: Import Styles
Order of Imports
When using STUDS with Tailwind, the import order is crucial:- Import STUDS styles first
- Import Tailwind styles second
- Import any additional app-specific styles last
- CSS Imports
- JS Imports
Since STUDS Styles provides basic preflight and theming. We can omit the
tailwindcss/theme
and tailwindcss/preflight
imports. If you need tailwind
in full, use @import “tailwindcss”styles.css
Step 5: Using STUDS with Tailwind Classes
You can now combine STUDS components with Tailwind utility classes:Step 6: Handling Conflicts
In case of styling conflicts between STUDS and Tailwind:- Adjust specificity in your CSS
- Consider using the CSS
@layer
directive to organize overrides (See our [Styles Foundations for Reference])(/foundations/styles#css-cascading-layers)