Skip to main content

Shape Utils

Single-purpose, consistent, and predictable classes for styling/modifying an element's shape.

Widths

Syntax: w-[size]

.w-none { width: 0; }
.w-quarter { width: 25%; }
.w-third { width: 33.333333%; }
.w-half { width: 50%; }
.w-full { width: 100%; }
.w-screen { width: 100vw; }

Heights

Syntax: h-[size]

.h-none { height: 0; }
.h-quarter { height: 25%; }
.h-third { height: 33.333333%; }
.h-half { height: 50%; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }

Radius

Syntax: r[direction]-[size]

.r-[size] { ... } // All sides
.rt-[size] { ... } // Top
.rb-[size] { ... } // Bottom
.rl-[size] { ... } // Left
.rr-[size] { ... } // Right
.rtl-[size] { ... } // Top Left
.rtr-[size] { ... } // Top Right
.rbl-[size] { ... } // Bottom Left
.rbr-[size] { ... } // Bottom Right
SizeValue
none0
xs0.1rem
sm0.3rem
md0.5rem
lg0.7rem
xl1.2rem
2xl2.3rem
3xl3.4rem
4xl4.5rem
5xl6.1rem
6xl8.2rem
pill5000px
circle50%

Margin

Syntax: m[direction]-[size]

.m-[size] { ... } // All sides
.mt-[size] { ... } // Top
.mb-[size] { ... } // Bottom
.ml-[size] { ... } // Left
.mr-[size] { ... } // Right
.mx-[size] { ... } // Left & Right
.my-[size] { ... } // Top & Bottom
SizeValue
none0
xsto-rem(4px)
smto-rem(8px)
mdto-rem(16px)
lgto-rem(24px)
xlto-rem(32px)
2xlto-rem(48px)
3xlto-rem(64px)
4xlto-rem(80px)
5xlto-rem(96px)
6xlto-rem(112px)
autoauto

Padding

Syntax: p[direction]-[size]

.p-[size] { ... } // All sides
.pt-[size] { ... } // Top
.pb-[size] { ... } // Bottom
.pl-[size] { ... } // Left
.pr-[size] { ... } // Right
.px-[size] { ... } // Left & Right
.py-[size] { ... } // Top & Bottom
SizeValue
none0
xs0.1rem
sm0.3rem
md0.7rem
lg1.2rem
xl2.3rem
2xl3.4rem
3xl4.5rem
4xl6.1rem
5xl8.2rem
6xl12.3rem
autoauto

Elevation

Syntax: raise[-][level]

.raise-none { box-shadow: none; }
.raise-low { box-shadow: 0 3px 4px 1px rgba(#000, 15%); }
.raise { box-shadow: 0 6px 10px 2px rgba(#000, 15%); }
.raise-high { box-shadow: 0 10px 15px 3px rgba(#000, 15%); }
.raise-highest { box-shadow: 0 15px 20px 4px rgba(#000, 15%); }