@ui-registries/pdf

Utility Classes

Complete reference of supported Tailwind-style utility classes.

@ui-registries/pdf supports a subset of Tailwind CSS utilities, adapted for @react-pdf/renderer's layout engine. All numeric values are in PDF points (pt) where 1 Tailwind unit = 3pt.

Arbitrary Values

Any utility that accepts a numeric value also supports arbitrary values with [...]:

tsx
<Block className="w-[210mm] h-[297mm]" />        {/* A4 page size */}<Block className="p-[20]" />                       {/* 20pt padding */}<Text className="text-[14]" />                     {/* 14pt font */}<Text className="text-[12px]" />                   {/* 12px → 9pt */}<Block className="aspect-[4/3]" />                 {/* 4:3 ratio */}

Plain numbers and pt values are points. px and rem are converted to points with the same ratio as the rest of the scale (1px = 0.75pt, 1rem = 12pt). Other units (mm, cm, in, %, vw, vh) are passed to react-pdf as-is.

Layout & Display

ClassStyle
flexdisplay: flex
hiddendisplay: none

Flex Direction & Wrap

ClassStyle
flex-rowflexDirection: row
flex-colflexDirection: column
flex-row-reverseflexDirection: row-reverse
flex-col-reverseflexDirection: column-reverse
flex-wrapflexWrap: wrap
flex-nowrapflexWrap: nowrap
flex-wrap-reverseflexWrap: wrap-reverse

Flex Grow & Shrink

ClassStyle
flex-1flex: 1
flex-autoflexGrow: 1, flexShrink: 1, flexBasis: auto
flex-initialflexGrow: 0, flexShrink: 1, flexBasis: auto
flex-noneflex: 0
growflexGrow: 1
grow-0flexGrow: 0
shrinkflexShrink: 1
shrink-0flexShrink: 0

Alignment

ClassStyle
items-startalignItems: flex-start
items-endalignItems: flex-end
items-centeralignItems: center
items-baselinealignItems: baseline
items-stretchalignItems: stretch
ClassStyle
self-autoalignSelf: auto
self-startalignSelf: flex-start
self-endalignSelf: flex-end
self-centeralignSelf: center
self-stretchalignSelf: stretch
self-baselinealignSelf: baseline
ClassStyle
justify-startjustifyContent: flex-start
justify-endjustifyContent: flex-end
justify-centerjustifyContent: center
justify-betweenjustifyContent: space-between
justify-aroundjustifyContent: space-around
justify-evenlyjustifyContent: space-evenly
ClassStyle
content-startalignContent: flex-start
content-endalignContent: flex-end
content-centeralignContent: center
content-betweenalignContent: space-between
content-aroundalignContent: space-around
content-stretchalignContent: stretch

Spacing

Padding and margin utilities follow the standard Tailwind pattern. Negative values are supported with the - prefix (e.g. -mt-2).

Padding

p-{n}, px-{n}, py-{n}, pt-{n}, pr-{n}, pb-{n}, pl-{n}

Margin

m-{n}, mx-{n}, my-{n}, mt-{n}, mr-{n}, mb-{n}, ml-{n}

Auto margins: m-auto, mx-auto (center horizontally), ml-auto (push to the right in a row), etc.

Gap

gap-{n}, gap-x-{n}, gap-y-{n}

Default Spacing Scale

KeyptKeyptKeypt
0082436108
px0.7592740120
0.51.5103044132
13113348144
1.54.5123652156
26144256168
2.57.5164860180
39206064192
3.510.5247272216
412288480240
515329696288
618
721

Sizing

Size (width + height)

size-{n}, size-full, size-auto, size-{fraction} — sets both width and height to the same value.

Width

w-{n}, w-full, w-auto, w-{fraction}

Height

h-{n}, h-full, h-auto, h-{fraction}

Min / Max

min-w-{n}, max-w-{n}, max-w-full, max-w-none, min-h-{n}, max-h-{n}

Fractions and full work with min/max variants too.

Fractions

ClassValueClassValue
w-1/250%w-1/520%
w-1/333.33%w-2/540%
w-2/366.67%w-3/560%
w-1/425%w-4/580%
w-3/475%w-1/616.67%
w-5/683.33%

Twelfths (1/12 through 11/12) are also supported. All fractions work with h-, basis-, min-w-, max-w-, etc.

Flex Basis

basis-auto, basis-full, basis-{n}, basis-{fraction}

Order

ClassValue
order-{1-12}1–12
order-first-9999
order-last9999
order-none0

Aspect Ratio

ClassValue
aspect-square1
aspect-video16/9
aspect-autoauto
aspect-[4/3]4/3

Position

ClassStyle
relativeposition: relative
absoluteposition: absolute
fixedposition: fixed

Insets

top-{n}, right-{n}, bottom-{n}, left-{n} — uses the spacing scale. Negative values supported (-top-2, etc.).

Inset Shorthands

ClassSets
inset-{n}top, right, bottom, left
inset-x-{n}left, right
inset-y-{n}top, bottom

Negative values supported: -inset-x-4, -inset-y-2, -inset-4.

Z-Index

z-{n} — any integer, or arbitrary z-[50].

Overflow

ClassStyle
overflow-hiddenoverflow: hidden
overflow-visibleoverflow: visible

Typography

Font Size

Classptpx equivalent
text-xs912px
text-sm10.514px
text-base1216px
text-lg13.518px
text-xl1520px
text-2xl1824px
text-3xl22.530px
text-4xl2736px
text-5xl3648px

Arbitrary: text-[14] for 14pt, text-[12px], text-[1rem].

Font size with line height: text-sm/6 (line height from the spacing scale), text-sm/[1.4] (multiplier).

Font Weight

ClassWeight
font-thin100
font-extralight200
font-light300
font-normal400
font-medium500
font-semibold600
font-bold700
font-extrabold800
font-black900

Font Family

ClassValue
font-sansHelvetica
font-serifTimes-Roman
font-monoCourier

Arbitrary: font-[Inter] for any registered font name. Custom families can be added via the theme (--font-{name}).

Font Style

ClassStyle
italicfontStyle: italic
not-italicfontStyle: normal

Text Alignment

text-left, text-center, text-right, text-justify

Text Transform

uppercase, lowercase, capitalize, normal-case

Text Decoration

ClassStyle
underlinetextDecoration: underline
line-throughtextDecoration: line-through
no-underlinetextDecoration: none

Decoration color: decoration-{color} (e.g. decoration-red-500)

Decoration style: decoration-solid, decoration-dashed, decoration-dotted, decoration-double, decoration-wavy

Text Overflow

ClassStyle
truncatemaxLines: 1, textOverflow: ellipsis
text-ellipsistextOverflow: ellipsis
text-cliptextOverflow: clip

Line Height

ClassValue
leading-none1
leading-tight1.25
leading-snug1.375
leading-normal1.5
leading-relaxed1.625
leading-loose2

Spacing scale (absolute, like Tailwind v4): leading-6 → 18pt.

Arbitrary: leading-[1.2] (multiplier of the font size), leading-[18px] (absolute).

Multipliers behave like in CSS: they apply to the element's own font size, inherited or not, and a child with a different text-* size gets the same multiplier against its own size. A text-2xl heading inside a text-sm leading-relaxed page gets 1.625 × 24pt, not the page's line height.

Letter Spacing

ClassValue
tracking-tighter-0.05em
tracking-tight-0.025em
tracking-normal0em
tracking-wide0.025em
tracking-wider0.05em
tracking-widest0.1em

em values are relative to the element's font size, like in Tailwind: tracking-widest on a text-xs label is narrower than on a heading.

Arbitrary: tracking-[0.2em], tracking-[2px], tracking-[1.5] (pt).

Text Indent

indent-{n} — uses the spacing scale.

Line Clamp

line-clamp-{n} — sets maxLines on the text element.

Colors

Besides the Tailwind palette, the default theme has the shadcn/ui semantic tokens (background, foreground, primary, muted, border, destructive…) and a chart palette: chart-1 to chart-5.

SVG fill & stroke

ClassOutput
fill-{color}fill (e.g. fill-primary, fill-chart-1/50)
fill-nonefill: none
stroke-{color}stroke
stroke-{n}, stroke-[1.5]strokeWidth
stroke-nonestroke: none

They work on SVG elements only.

Background

bg-{color}, bg-{color}/{opacity}

Text

text-{color}, text-{color}/{opacity}

Border

border-{color}, border-{color}/{opacity}

Alpha Modifier

Append /{0-100} to any color utility for alpha transparency:

tsx
<Block className="bg-blue-500/50" />   {/* 50% opacity blue */}<Text className="text-black/75" />     {/* 75% opacity black */}

Arbitrary Colors

Use [...] for any color value:

tsx
<Block className="bg-[#ff6600]" /><Text className="text-[rgb(100,200,50)]" />

Default Palette

The full Tailwind v4 color palette is included:

Grays: slate, gray, zinc, neutral, stone (50–950)

Colors: red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose (50–950)

Special: transparent, black, white

Semantic Tokens

Pre-configured shadcn/ui tokens (light theme):

TokenColorTokenColor
background#ffffffmuted#f5f5f5
foreground#0a0a0amuted-foreground#737373
primary#171717accent#f5f5f5
primary-foreground#fafafaaccent-foreground#171717
secondary#f5f5f5destructive#ef4444
secondary-foreground#171717destructive-foreground#fafafa
card#ffffffborder#e5e5e5
card-foreground#0a0a0ainput#e5e5e5
ring#a3a3a3

Usage: bg-primary, text-muted-foreground, border-border, etc.

Borders

Width

ClassValue
border1
border-00
border-{2-8}2–8
border-t, border-r, border-b, border-l1 (single side)
border-{t|r|b|l}-{n}n (single side)
border-x, border-y1 (two sides)
border-{x|y}-{n}n (two sides)

Style

border-solid, border-dashed, border-dotted

Per-side style: border-{t|r|b|l|x|y}-solid, border-{t|r|b|l}-dashed, border-{t|r|b|l}-dotted

Per-Side Color

border-{t|r|b|l|x|y}-{color} — applies color to one side (or two with x / y).

tsx
<Block className="border-t-red-500 border-b-blue-500" /><Block className="border-l-[#ff0000]" />

Radius

Classpt
rounded-none0
rounded-xs0.75
rounded-sm1.5
rounded3
rounded-md4.5
rounded-lg6
rounded-xl9
rounded-2xl12
rounded-3xl18
rounded-4xl24
rounded-full999

Side-specific: rounded-{t|b|l|r}-{size}, rounded-{tl|tr|bl|br}-{size}

Effects

Opacity

opacity-{0|5|10|15|...|95|100} — in 5% increments.

Object Fit & Position

For Image components:

Fit: object-contain, object-cover, object-fill, object-none, object-scale-down

Position: object-bottom, object-center, object-left, object-right, object-top

Transforms

Rotate

rotate-{deg} or rotate-[30] — value in degrees.

Scale

scale-{n}, scale-x-{n}, scale-y-{n} — value as percentage (e.g. scale-150 = 1.5x).

Translate

translate-x-{n}, translate-y-{n} — uses the spacing scale, output in pt.

Skew

skew-x-{deg}, skew-y-{deg} — value in degrees. Arbitrary: skew-x-[15].

Transform Origin

ClassValue
origin-centercenter center
origin-topcenter top
origin-top-rightright top
origin-rightright center
origin-bottom-rightright bottom
origin-bottomcenter bottom
origin-bottom-leftleft bottom
origin-leftleft center
origin-top-leftleft top

Transform Composition

Multiple transform utilities are automatically composed into a single transform string:

tsx
<Block className="rotate-45 scale-50" />{/* → transform: "rotate(45deg) scale(0.5)" */}
<Block className="rotate-45 scale-50 translate-x-4" />{/* → transform: "rotate(45deg) scale(0.5) translateX(12pt)" */}