Skip to content

Commit a1f81eb

Browse files
Merge pull request #139 from 1mohammad/patch-1
Update usage of variants when prefix is enabled in tailwind config
2 parents 4e261f2 + 90e4208 commit a1f81eb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,20 @@ The theme variant generated for the default theme is `defaultTheme` (e.g. `defau
683683
</html>
684684
```
685685

686+
If you've opted to use a prefix in your Tailwind CSS setup, it's essential to include `<prefix><theme name>` alongside the theme class. This ensures proper application of variants. For instance, if your prefix is `tw-` and your theme name is `dark-theme`, you'd use `dark-theme tw-dark-theme` together.
687+
688+
```html
689+
<!doctype html>
690+
<html lang="en">
691+
<head>
692+
<!-- ... -->
693+
</head>
694+
<body class="dark-theme tw-dark-theme">
695+
<!-- Properly utilize prefixes and themes -->
696+
<h1 class="dark-theme:font-bold">Hello world!</h1>
697+
</body>
698+
</html>
699+
```
686700
### Naming
687701

688702
As you probably could tell from above, the names of the generated css variables are the [kebab-cased](https://www.theserverside.com/definition/Kebab-case) version of the variable's path on the config object.

0 commit comments

Comments
 (0)