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
@@ -730,7 +730,7 @@ We've finally added APIs for doing 3D transforms, like `rotate-x-*`, `rotate-y-*
730
730
Use the `transform-3d` utility to enable 3D transforms by setting the right `transform-style`
731
731
732
732
733
-
#### Rotate
733
+
#### Rotate
734
734
Use the `rotate-x-*`, `rotate-y-*` and `rotate-z-*` utilities to rotate elements in 3D space.
735
735
736
736
@@ -780,7 +780,7 @@ Use the `scale-z-*` utilities to scale elements on the z-axis.
780
780
'scale-z-125': {'--tw-scale-z': '125%'},
781
781
'scale-z-150': {'--tw-scale-z': '150%'},
782
782
'scale-z-200': {'--tw-scale-z': '200%'},
783
-
783
+
784
784
}}/>
785
785
786
786
#### Translate
@@ -1239,7 +1239,7 @@ Since we've dramatically [simplified theme configuration](#simplified-theme-conf
1239
1239
| `--tracking-*` | Letter spacing utilities like `tracking-tight` |
1240
1240
| `--leading-*` | Line height utilities like `leading-relaxed` |
1241
1241
| `--breakpoint-*` | Breakpoint variants like `md:*` and `lg:*` |
1242
-
| `--container-*` | Container query variants like `@sm:*` and `@lg:*`\nmax-width utilities like `max-w-lg` |
1242
+
| `--container-*` | Container query variants like `@sm:*` and `@lg:*` and max-width utilities like `max-w-lg` |
1243
1243
| `--radius-*` | Border radius utilities like `rounded-md` |
1244
1244
| `--shadow-*` | Box shadow utilities like `shadow-lg` |
1245
1245
| `--inset-shadow-*` | Inset box shadow utilities like `inset-shadow-sm` |
@@ -1251,11 +1251,12 @@ If you need more fine-grained control, most utilities can also be configured und
1251
1251
1252
1252
### Configuring dark mode
1253
1253
1254
-
By default, the `dark` variant in Tailwind CSS v4.0 uses the `prefers-color-scheme` media query. If you want to useaselector-based strategy in your project for dark mode, override the `dark` variant with the selector you want to use:
1254
+
By default, the `dark` variant in Tailwind CSS v4.0 uses the `prefers-color-scheme` media query.
1255
+
1256
+
If you want to useaselector-based strategy in your project for dark mode, override the `dark` variant with the selector you want to use:
1255
1257
1256
1258
```css
1257
1259
@import"tailwindcss";
1258
-
1259
1260
>@variant dark (&:where(.dark, .dark *));
1260
1261
```
1261
1262
@@ -1320,16 +1321,141 @@ If you need to disable Tailwind's base styles, you can import the pieces of Tail
1320
1321
1321
1322
### Using a prefix
1322
1323
1324
+
To prefix your utilities and theme variables to avoid conflicts with existing CSS, use the `prefix(…)` function when importing Tailwind:
1325
+
1326
+
```css
1327
+
@import"tailwindcss" prefix(tw);
1328
+
```
1329
+
1330
+
Prefixes work a little differently than in v3 — now they look like variants and are always at the beginning of the class name:
This lets you write utilities like `pointer-coarse:size-48` and `theme-midnight:bg-slate-900`.
1398
+
1327
1399
### Using plugins
1328
1400
1401
+
To load a plugin in v4.0, use the the new `@plugin` directive:
1402
+
1403
+
```css
1404
+
@import"tailwindcss";
1405
+
1406
+
@plugin "@tailwindcss/typography";
1407
+
```
1408
+
1409
+
The `@plugin` directive takes either a package name or a local path.
1410
+
1329
1411
### Using legacy configuration files
1330
1412
1413
+
To use an existing JS configuration file in v4.0, load it with the `@config` directive:
1414
+
1415
+
```css
1416
+
@import"tailwindcss";
1417
+
1418
+
@config "../../tailwind.config.js";
1419
+
```
1420
+
1421
+
Note that not every feature of the JS config is supported in v4.0. Options like `corePlugins`, `important`, and `separator` will likely not be supported at all in the stable v4.0 release, and options like `safelist` may return but with differences in behavior.
1422
+
1331
1423
### Using \`@apply\` in Vue/Svelte
1332
1424
1425
+
If you want to use `@apply` in the `<style>` block of a Vue or Svelte component, you will need to import your theme configuration to make those values available in that context.
1426
+
1427
+
To do this without duplicating the CSS variables in your CSS output, use `theme(reference)` when importing your theme:
1428
+
1429
+
```html
1430
+
<template>
1431
+
<h1>Hello world!</h1>
1432
+
</template>
1433
+
1434
+
<style>
1435
+
>@import"../../my-theme.css" theme(reference);
1436
+
1437
+
h1 {
1438
+
@applyfont-boldtext-2xltext-red-500;
1439
+
}
1440
+
</style>
1441
+
```
1442
+
1443
+
If you're just using the default theme, you can import `"tailwindcss/theme"` directly:
1444
+
1445
+
```html
1446
+
<template>
1447
+
<h1>Hello world!</h1>
1448
+
</template>
1449
+
1450
+
<style>
1451
+
>@import"tailwindcss/theme" theme(reference);
1452
+
1453
+
h1 {
1454
+
@applyfont-boldtext-2xltext-red-500;
1455
+
}
1456
+
</style>
1457
+
```
1458
+
1333
1459
---
1334
1460
1335
1461
## Breaking changes
@@ -1370,6 +1496,8 @@ If you need to disable Tailwind's base styles, you can import the pieces of Tail
0 commit comments