Skip to content

Commit fc3f7e6

Browse files
docs: update installation guide to add tailwind css v4 instructions while keeping v3 details (#180)
This PR updates the installation guide for this plugin, [@tailwindcss/forms](https://github.com/tailwindlabs/tailwindcss-forms), to include setup instructions for Tailwind CSS v4 using `@plugin` in the `style.css` file, while retaining the existing instructions for v3 users who are yet to upgrade. **Why this PR?** Based on my experience, I've had to refer to the typography plugin docs for setup instructions and adapt them for the forms plugin. This update ensures the guide is clear and useful for both Tailwind CSS v3 and v4 users. --------- Co-authored-by: Jordan Pittman <jordan@cryptica.me>
1 parent 071d1c0 commit fc3f7e6

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ Install the plugin from npm:
1010
npm install -D @tailwindcss/forms
1111
```
1212

13-
Then add the plugin to your `tailwind.config.js` file:
13+
Then, when using Tailwind CSS v4, add the plugin to your main stylesheet:
14+
15+
```css
16+
/* app.css */
17+
@import "tailwindcss";
18+
@plugin "@tailwindcss/forms";
19+
```
20+
21+
If you are still using **Tailwind CSS v3**, add the plugin to your `tailwind.config.js` file:
1422

1523
```js
1624
// tailwind.config.js
@@ -107,6 +115,18 @@ Although we recommend thinking of this plugin as a "form reset" rather than a co
107115

108116
If generating both the global (base) styles and classes doesn't work well with your project, you can use the `strategy` option to limit the plugin to just one of these approaches.
109117

118+
When using Tailwind CSS v4, configure the plugin in your main stylesheet:
119+
120+
```css
121+
/* app.css */
122+
@plugin "@tailwindcss/forms" {
123+
strategy: "base"; /* only generate global styles; or */
124+
strategy: "class"; /* only generate classes */
125+
}
126+
```
127+
128+
If you are still using **Tailwind CSS v3**, configure the plugin in your `tailwind.config.js` file:
129+
110130
```js
111131
// tailwind.config.js
112132
plugins: [

0 commit comments

Comments
 (0)