Skip to content

Commit d360b10

Browse files
committed
Add basic @Variants docs
1 parent 858b725 commit d360b10

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

docs/source/docs/functions-and-directives.blade.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,51 @@ Note that `@@apply` **will not work** for mixing in hover or responsive variants
7878
}
7979
```
8080

81+
### `@variants`
82+
83+
You can generate `responsive`, `hover`, `focus`, and `group-hover` versions of your own utilities by wrapping their definitions in the `@variants` directive
84+
85+
```less
86+
@@variants hover, focus {
87+
.banana {
88+
color: yellow;
89+
}
90+
.chocolate {
91+
color: brown;
92+
}
93+
}
94+
```
95+
96+
This will generate the following CSS:
97+
98+
```less
99+
.banana {
100+
color: yellow;
101+
}
102+
.chocolate {
103+
color: brown;
104+
}
105+
.focus\:banana:focus {
106+
color: yellow;
107+
}
108+
.focus\:chocolate:focus {
109+
color: brown;
110+
}
111+
.hover\:banana:hover {
112+
color: yellow;
113+
}
114+
.hover\:chocolate:hover {
115+
color: brown;
116+
}
117+
```
118+
119+
The `@variants` at-rule supports all of the values that are supported in the `modules` section of your config file:
120+
121+
- `responsive`
122+
- `hover`
123+
- `focus`
124+
- `group-hover`
125+
81126
### `@@responsive`
82127

83128
You can generate responsive versions of your own classes by wrapping their definitions in the `@responsive` directive:

0 commit comments

Comments
 (0)