You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are multiple "versions" of `clsx` available, which allows you to bring only the functionality you need!
72
+
73
+
#### `clsx`
74
+
> **Size (gzip):** 239 bytes<br>
75
+
> **Availability:** CommonJS, ES Module, UMD
76
+
77
+
The default `clsx` module; see [API](#API) for info.
78
+
79
+
```js
80
+
import { clsx } from'clsx';
81
+
// or
82
+
importclsxfrom'clsx';
83
+
```
84
+
85
+
#### `clsx/lite`
86
+
> **Size (gzip):** 140 bytes<br>
87
+
> **Availability:** CommonJS, ES Module<br>
88
+
> **CAUTION:** Accepts **ONLY** string arguments!
89
+
90
+
Ideal for applications that ***only*** use the string-builder pattern.
91
+
92
+
Any non-string arguments are ignored!
93
+
94
+
```js
95
+
import { clsx } from'clsx/lite';
96
+
// or
97
+
importclsxfrom'clsx/lite';
98
+
99
+
// string
100
+
clsx('hello', true&&'foo', false&&'bar');
101
+
// => "hello foo"
102
+
103
+
// NOTE: Any non-string input(s) ignored
104
+
clsx({ foo:true });
105
+
//=> ""
106
+
```
107
+
69
108
## Benchmarks
70
109
71
110
For snapshots of cross-browser results, check out the [`bench`](bench) directory~!
@@ -81,8 +120,8 @@ All browsers that support [`Array.isArray`](https://developer.mozilla.org/en-US/
81
120
## Tailwind Support
82
121
83
122
Here some additional (optional) steps to enable classes autocompletion using `clsx` with Tailwind CSS.
84
-
<details>
85
123
124
+
<details>
86
125
<summary>
87
126
Visual Studio Code
88
127
</summary>
@@ -100,6 +139,12 @@ Here some additional (optional) steps to enable classes autocompletion using `cl
100
139
```
101
140
</details>
102
141
142
+
You may find the [`clsx/lite`](#clsxlite) module useful within Tailwind contexts. This is especially true if/when your application **only** composes classes in this pattern:
0 commit comments