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
Closestailwindlabs/tailwindcss#16372Closestailwindlabs/tailwindcss#16395
- Adds a section about the changes to how prefixes work
- Adds a section about `space-x-*` and `space-y-*` utility changes
- Adds a section about dialogs now having margins in preflight
---------
Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Copy file name to clipboardExpand all lines: src/docs/upgrade-guide.mdx
+91Lines changed: 91 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -365,6 +365,37 @@ To update your project for this change, replace any usage of `ring` with `ring-3
365
365
<inputclass="ring-3 ring-blue-500" />
366
366
```
367
367
368
+
### Space-between selector
369
+
370
+
We've changed the selector used by the [`space-x-*` and `space-y-*` utilities](/docs/margin#adding-space-between-children) to address serious performance issues on large pages:
371
+
372
+
```css
373
+
/* [!code filename:CSS] */
374
+
/* Before */
375
+
.space-y-4>:not([hidden]) ~:not([hidden]) {
376
+
margin-top: 1rem;
377
+
}
378
+
379
+
/* Now */
380
+
.space-y-4>:not(:last-child) {
381
+
margin-bottom: 1rem;
382
+
}
383
+
```
384
+
385
+
You might see changes in your project if you were ever using these utilities with inline elements, or if you were adding other margins to child elements to tweak their spacing.
386
+
387
+
If this change causes any issues in your project, we recommend migrating to a flex or grid layout and using `gap` instead:
When using a prefix, you should still configure your theme variables as if you aren't using a prefix:
539
+
540
+
```css {{ filename: "app.css" }}
541
+
@import"tailwindcss" prefix(tw);
542
+
543
+
@theme {
544
+
--font-display: "Satoshi", "sans-serif";
545
+
546
+
--breakpoint-3xl: 1920px;
547
+
548
+
--color-avocado-100: oklch(0.99 0 0);
549
+
--color-avocado-200: oklch(0.98 0.04 113.22);
550
+
--color-avocado-300: oklch(0.94 0.11 115.03);
551
+
552
+
/* ... */
553
+
}
554
+
```
555
+
556
+
The generated CSS variables _will_ include a prefix to avoid conflicts with any existing variables in your project:
557
+
558
+
```css {{ filename: "dist.css" }}
559
+
:root {
560
+
--tw-font-display: "Satoshi", "sans-serif";
561
+
562
+
--tw-breakpoint-3xl: 1920px;
563
+
564
+
--tw-color-avocado-100: oklch(0.9900);
565
+
--tw-color-avocado-200: oklch(0.980.04113.22);
566
+
--tw-color-avocado-300: oklch(0.940.11115.03);
567
+
568
+
/* ... */
569
+
}
570
+
```
571
+
481
572
### Adding custom utilities
482
573
483
574
In v3, any custom classes you defined within `@layer utilities` would get picked up by Tailwind as a true utility class and would automatically work with variants like `hover`, `focus`, or `lg`.
0 commit comments