Skip to content

Commit 5e7beca

Browse files
committed
Document border/ring changes
1 parent ee0cb59 commit 5e7beca

File tree

1 file changed

+49
-5
lines changed

1 file changed

+49
-5
lines changed

src/docs/upgrade-guide.mdx

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,20 @@ To customize the `container` utility in v4, extend it using the `@utility` direc
379379
}
380380
```
381381

382-
### Preflight changes
382+
### Default border color
383383

384-
We've made a couple small changes to the base styles in Preflight in v4:
384+
In v3, the `border-*` and `divide-*` utilities used your configured `gray-200` color by default. We've changed this to `currentColor` in v4 to make Tailwind less opinionated and match browser defaults.
385385

386-
#### New default border color
386+
To update your project for this change, make sure you specify a color anywhere you're using a `border-*` or `divide-*` utility utility:
387387

388-
In v3, borders used your configured `gray-200` color by default. We've updated this in v4 to be just `currentColor`, which matches the default behavior of all browsers.
388+
```html
389+
<!-- [!code classes:border-gray-200] -->
390+
<div class="border border-gray-200 px-2 py-3 ...">
391+
<!-- ... -->
392+
</div>
393+
```
389394

390-
To update your project for this change, make sure you're using a border color utility anywhere you're using the `border` utility, or add these lines of CSS to your project to preserve the v3 behavior:
395+
Alternatively, add these base styles to your project to preserve the v3 behavior:
391396

392397
```css
393398
/* [!code filename:CSS] */
@@ -402,6 +407,45 @@ To update your project for this change, make sure you're using a border color ut
402407
}
403408
```
404409

410+
### Default ring width and color
411+
412+
We've changed the width of the `ring` utility from 3px to 1px and changed the default color from `blue-500` to `currentColor` to make things more consistent the `border-*`, `divide-*`, and `outline-*` utilities.
413+
414+
To update your project for these changes, replace any use of `ring` with `ring-3`:
415+
416+
```html
417+
<!-- prettier-ignore -->
418+
<button class="focus:ring ..."> <!-- [!code --] -->
419+
<button class="focus:ring-3 ..."> <!-- [!code ++] -->
420+
<!-- ... -->
421+
</button>
422+
```
423+
424+
Then make sure to add `ring-blue-500` anywhere you were depending on the default ring color:
425+
426+
```html
427+
<!-- [!code classes:focus:ring-blue-500] -->
428+
<button class="focus:ring-3 focus:ring-blue-500 ...">
429+
<!-- ... -->
430+
</button>
431+
```
432+
433+
Alternatively, add these theme variables to your CSS to preserve the v3 behavior:
434+
435+
```css
436+
/* [!code filename:CSS] */
437+
@theme {
438+
--default-ring-width: 3px;
439+
--default-ring-color: var(--color-blue-500);
440+
}
441+
```
442+
443+
Note though that these variables are only supported for compatibility reasons, and are not considered idiomatic usage of Tailwind CSS v4.0.
444+
445+
### Preflight changes
446+
447+
We've made a couple small changes to the base styles in Preflight in v4:
448+
405449
#### New default placeholder color
406450

407451
In v3, placeholder text used your configured `gray-400` color by default. We've simplified this in v4 to just use the current text color at 50% opacity.

0 commit comments

Comments
 (0)