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
@@ -8,7 +7,9 @@ export const description = "A reference for the custom functions and directives
8
7
9
8
Directives are custom Tailwind-specific [at-rules](https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule) you can use in your CSS that offer special functionality for Tailwind CSS projects.
10
9
11
-
<H3id="import-directive">@import</H3>
10
+
<h3id="import-directive">
11
+
<ahref="#import-directive">@import</a>
12
+
</h3>
12
13
13
14
Use the `@import` directive to inline import CSS files, including Tailwind itself:
14
15
@@ -17,7 +18,9 @@ Use the `@import` directive to inline import CSS files, including Tailwind itsel
17
18
@import"tailwindcss";
18
19
```
19
20
20
-
<H3id="theme-directive">@theme</H3>
21
+
<h3id="theme-directive">
22
+
<ahref="#theme-directive">@theme</a>
23
+
</h3>
21
24
22
25
Use the `@theme` directive to define your project's custom design tokens, like fonts, colors, and breakpoints:
23
26
@@ -44,7 +47,9 @@ Use the `@theme` directive to define your project's custom design tokens, like f
44
47
45
48
Learn more about customizing your theme in the [theme variables documentation](/docs/theme).
46
49
47
-
<H3id="source-directive">@source</H3>
50
+
<h3id="source-directive">
51
+
<ahref="#source-directive">@source</a>
52
+
</h3>
48
53
49
54
Use the `@source` directive to explicitly specify source files that aren't picked up by Tailwind's automatic content detection:
50
55
@@ -55,7 +60,9 @@ Use the `@source` directive to explicitly specify source files that aren't picke
55
60
56
61
Learn more about automatic content detection in the [detecting classes in source files documentation](/docs/detecting-classes-in-source-files).
57
62
58
-
<H3id="utility-directive">@utility</H3>
63
+
<h3id="utility-directive">
64
+
<ahref="#utility-directive">@utility</a>
65
+
</h3>
59
66
60
67
Use the `@utility` directive to add custom utilities to your project that work with variants like `hover`, `focus` and `lg`:
61
68
@@ -68,7 +75,9 @@ Use the `@utility` directive to add custom utilities to your project that work w
68
75
69
76
Learn more about registering custom utilities in the [adding custom utilities documentation](/docs/adding-custom-styles#adding-custom-utilities).
70
77
71
-
<H3 id="variant-directive">@variant</H3>
78
+
<h3 id="variant-directive">
79
+
<a href="#variant-directive">@variant</a>
80
+
</h3>
72
81
73
82
Use the `@variant` directive to apply a Tailwind variant to styles in your CSS:
74
83
@@ -86,7 +95,9 @@ Use the `@variant` directive to apply a Tailwind variant to styles in your CSS:
86
95
87
96
Learn more using variants in the [using variants documentation](/docs/adding-custom-styles#using-variants).
Use the `@custom-variant` directive to add a custom variant in your project:
92
103
@@ -99,7 +110,9 @@ This lets you write utilities `theme-midnight:bg-black` and `theme-midnight:text
99
110
100
111
Learn more about adding custom variants in the [adding custom variants documentation](/docs/adding-custom-styles#adding-custom-variants).
101
112
102
-
<H3id="apply-directive">@apply</H3>
113
+
<h3id="apply-directive">
114
+
<ahref="#apply-directive">@apply</a>
115
+
</h3>
103
116
104
117
Use the `@apply` directive to inline any existing utility classes into your own custom CSS:
105
118
@@ -123,7 +136,9 @@ Use the `@apply` directive to inline any existing utility classes into your own
123
136
124
137
This is useful when you need to write custom CSS (like to override the styles in a third-party library) but still want to work with your design tokens and use the same syntax you’re used to using in your HTML.
125
138
126
-
<H3id="reference-directive">@reference</H3>
139
+
<h3id="reference-directive">
140
+
<ahref="#reference-directive">@reference</a>
141
+
</h3>
127
142
128
143
If you want to use `@apply` or `@variant` in the `<style>` block of a Vue or Svelte component, or within CSS modules, you will need to import your theme variables, custom utilities, and custom variants to make those values available in that context.
129
144
@@ -167,7 +182,9 @@ If you’re just using the default theme with no customizations, you can import
167
182
168
183
Tailwind provides the following build-time functions to make working with colors and the spacing scale easier.
169
184
170
-
<H3id="alpha-function">--alpha()</H3>
185
+
<h3id="alpha-function">
186
+
<ahref="#alpha-function">--alpha()</a>
187
+
</h3>
171
188
172
189
Use the `--alpha()` function to adjust the opacity of a color:
173
190
@@ -190,7 +207,9 @@ Use the `--alpha()` function to adjust the opacity of a color:
190
207
191
208
</CodeExampleStack>
192
209
193
-
<H3id="spacing-function">--spacing()</H3>
210
+
<h3id="spacing-function">
211
+
<ahref="#spacing-function">--spacing()</a>
212
+
</h3>
194
213
195
214
Use the `--spacing()` function to generate a spacing value based on your theme:
196
215
@@ -227,7 +246,9 @@ This can also be useful in arbitrary values, especially in combination with `cal
227
246
228
247
The following directives and functions exist solely for compatibility with Tailwind CSS v3.x.
229
248
230
-
<H3id="config-directive">@config</H3>
249
+
<h3id="config-directive">
250
+
<ahref="#config-directive">@config</a>
251
+
</h3>
231
252
232
253
Use the `@config` directive to load a legacy JavaScript-based configuration file:
233
254
@@ -238,7 +259,9 @@ Use the `@config` directive to load a legacy JavaScript-based configuration file
238
259
239
260
The `corePlugins`, `safelist`, and `separator` options from the JavaScript-based config are not supported in v4.0.
240
261
241
-
<H3id="plugin-directive">@plugin</H3>
262
+
<h3id="plugin-directive">
263
+
<ahref="#plugin-directive">@plugin</a>
264
+
</h3>
242
265
243
266
Use the `@plugin` directive to load a legacy JavaScript-based plugin:
244
267
@@ -249,7 +272,9 @@ Use the `@plugin` directive to load a legacy JavaScript-based plugin:
249
272
250
273
The `@plugin` directive accepts either a package name or a local path.
251
274
252
-
<H3id="theme-function">theme()</H3>
275
+
<h3id="theme-function">
276
+
<ahref="#theme-function">theme()</a>
277
+
</h3>
253
278
254
279
Use the `theme()` function to access your Tailwind theme values using dot notation:
0 commit comments