tailwindcss upgrade

v0.1, v1, v2, v3 to v4

2025-04-09

Written by: tdtc

prefix

myprefix:text-red-500
myprefix:hover:text-red-500
myprefix-text-red-500
hover:myprefix-text-red-500

utilities

v3v4
shadow-smshadow-xs
shadowshadow-sm
drop-shadow-smdrop-shadow-xs
drop-shadowdrop-shadow-sm
blur-smblur-xs
blurblur-sm
backdrop-blur-smbackdrop-blur-xs
backdrop-blurbackdrop-blur-sm
rounded-smrounded-xs
roundedrounded-sm
outline-noneoutline-hidden
ringring-3
oldnew
overflow-cliptext-clip
overflow-ellipsistext-ellipsis
flex-grow-0grow-0
flex-shrinkshrink

flex-grow

grow-*
flex-grow-*

flex no wrap

flex-nowrap
flex-no-wrap

flex no shrink

shrink-0
flex-shrink-0
flex-no-shrink

whitespace

whitespace-nowrap
whitespace-no-wrap

rounded

rounded-sm
rounded

list none

list-none
list-reset

line height

leading-[1.5]
leading-normal line-height: 1.5;

leading tight

leading-[1.25]
leading-tight

aspect ratio - v4

            //https://getbootstrap.com/docs/4.6/utilities/embed/
            'embed-responsive'       => 'relative block w-full p-0 overflow-hidden',
            'embed-responsive-item'  => 'absolute top-0 bottom-0 left-0 w-full h-full border-0',
            'embed-responsive-21by9' => 'aspect-21/9',
            'embed-responsive-16by9' => 'aspect-16/9',
            'embed-responsive-4by3'  => 'aspect-4/3',
            'embed-responsive-1by1'  => 'aspect-square',

v2 and v3

position

sticky

position: sticky;
none

scrolling touch

we’ve removed these two utilities from v2.0.

Class name changes - v2

Update renamed utility classes :

oldnew
whitespace-no-wrapwhitespace-nowrap
flex-no-wrapflex-nowrap
col-gap-{n}gap-x-{n}
row-gap-{n}gap-y-{n}

Replace shadow-outline and shadow-xs with ring utilities

oldnew
focus:shadow-outlinefocus:ring
shadow-xsring-1 ring-black ring-opacity-5

Replace clearfix with flow-root

oldnew
clearfixflow-root

Update font-weight class names for 100 and 200 weights

Font weightoldnew
100font-hairlinefont-thin
200font-thinfont-extralight

bs2tw

text

initialism

  font-size: 90%;
  text-transform: uppercase;
text-xs
uppercase

Ref