TailwindCSS
Edit this pageTailwind CSS is an on-demand utility CSS library that integrates seamlessly with Solid as a built-in PostCSS plugin.
Installation
- Install Tailwind CSS as a development dependency:
- Next, run the init command to generate both
tailwind.config.js
andpostcss.config.js
.
- Since TailwindCSS is configuration-driven, after initializing, a
tailwind.config.js
file will be created at the root of your project directory:
For a deeper dive into configuration, you can check out the Tailwind Official Documentation.
Add Tailwind directives
In your src/index.css
file, add the following Tailwind directives:
These directives inform PostCSS that you're using Tailwind and establish the order of the directives. You can append custom CSS below these directives.
Import TailwindCSS
Import your index.css
file into the root index.jsx
or index.tsx
file:
Usage
With Tailwind CSS set up, you can now utilize its utility classes.
For instance, if you previously had a Card.css
file, you can replace or remove it:
Update your components to use Tailwind's utility classes:
Support
For additional assistance, refer to the Tailwind CSS/Vite integration guide.