Skip to content

Commit 00ec267

Browse files
authored
feat: support tailwindcss v4 (#245)
* feat: support tailwindcss v4 * feat: support tailwindcss v4 * fix: pkg
1 parent f363575 commit 00ec267

16 files changed

+63
-2283
lines changed

README.md

+5-41
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@
2020
## Features
2121

2222
- First-class variant API
23-
- Responsive variants
2423
- Slots support
2524
- Composition support
2625
- Fully typed
2726
- Framework agnostic
2827
- Automatic conflict resolution
28+
- Tailwindcss V4 support
2929

3030
## Documentation
3131

3232
For full documentation, visit [tailwind-variants.org](https://tailwind-variants.org)
3333

34+
> ❕ Note: `Tailwindcss V4` no longer supports the `config.content.transform` so we remove the `responsive variants` feature
35+
>
36+
> If you want to use `responsive variants`, you need to add it manually to your classname.
37+
3438
## Quick Start
3539

3640
1. Installation:
@@ -75,46 +79,6 @@ const button = tv({
7579
return <button className={button({size: "sm", color: "secondary"})}>Click me</button>;
7680
```
7781

78-
3. Responsive variants configuration (optional): If you want to use responsive variants
79-
you need to add the Tailwind Variants `wrapper` to your TailwindCSS config file `tailwind.config.js`.
80-
81-
```js
82-
// tailwind.config.js
83-
84-
const {withTV} = require("tailwind-variants/transformer");
85-
86-
/** @type {import('tailwindcss').Config} */
87-
module.exports = withTV({
88-
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
89-
theme: {
90-
extend: {},
91-
},
92-
plugins: [],
93-
});
94-
```
95-
96-
If you're using a custom path to import Tailwind variants, such as creating a custom tv instance with `createTV`, it's recommended to include this path in the transformer configuration:
97-
98-
```js
99-
// tailwind.config.js
100-
101-
const {withTV} = require("tailwind-variants/transformer");
102-
103-
/** @type {import('tailwindcss').Config} */
104-
module.exports = withTV(
105-
{
106-
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
107-
theme: {
108-
extend: {},
109-
},
110-
plugins: [],
111-
},
112-
{
113-
aliases: ["@/lib/tv"],
114-
},
115-
);
116-
```
117-
11882
## Acknowledgements
11983

12084
- [**cva**](https://github.com/joe-bell/cva) ([Joe Bell](https://github.com/joe-bell))

clean-package.config.json

-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
"types": "./dist/index.d.ts"
1212
},
1313
"./dist/*": "./dist/*",
14-
"./transformer": {
15-
"require": "./dist/transformer.cjs",
16-
"types": "./dist/transformer.d.ts",
17-
"default": "./dist/transformer.js"
18-
},
1914
"./package.json": "./package.json"
2015
}
2116
}

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@
2020
"sideEffects": false,
2121
"files": [
2222
"dist",
23-
"transformer.js",
24-
"transformer.d.ts",
2523
"README.md",
2624
"LICENSE"
2725
],
2826
"scripts": {
27+
"dev": "tsup --watch",
2928
"build": "tsup && node copy-types.cjs",
3029
"typecheck": "tsc --noEmit",
3130
"prepack": "clean-package",
@@ -37,7 +36,7 @@
3736
"test:watch": "jest --watch --no-verbose"
3837
},
3938
"dependencies": {
40-
"tailwind-merge": "2.5.4"
39+
"tailwind-merge": "3.0.2"
4140
},
4241
"devDependencies": {
4342
"@commitlint/cli": "19.5.0",
@@ -66,10 +65,11 @@
6665
"eslint-plugin-promise": "7.1.0",
6766
"expect": "29.7.0",
6867
"jest": "29.7.0",
68+
"postcss": "8.5.3",
6969
"prettier": "3.3.3",
7070
"prettier-eslint": "16.3.0",
7171
"prettier-eslint-cli": "8.0.1",
72-
"tailwindcss": "3.4.14",
72+
"tailwindcss": "4.0.12",
7373
"ts-node": "10.9.2",
7474
"tsup": "8.3.5",
7575
"typescript": "5.6.3"

0 commit comments

Comments
 (0)