Skip to main content
Every Forme component accepts a style prop with CSS-like properties. Styles are passed as a JavaScript object.
Prefer Tailwind syntax? Use @formepdf/tailwind to write tw("flex-row gap-3 p-4 bg-slate-50") instead of style objects.

Layout

Layout examples

Spacing

Margins in Forme are always additive (like flexbox gap). There is no CSS margin collapsing.

Spacing examples

Typography

Typography examples

fontVariantNumeric and fontFeatureSettings apply OpenType features, so they need a font that has them: a registered font, or the builtin Noto Sans. The standard PDF fonts (Helvetica, Times, Courier) have no OpenType features and ignore both. A feature the font doesn’t have is skipped. Measurement uses the same features as drawing, so a line is broken at the widths it is drawn with, and the text still copies as the characters you wrote.

Background and Border

Background and border examples

Positioning

Positioning examples

Page Behavior

Page behavior examples

Style Inheritance

Some properties are inherited from parent elements, matching CSS behavior: Inherited: color, fontFamily, fontSize, fontWeight, fontStyle, lineHeight, textAlign, letterSpacing, fontFeatureSettings / fontVariantNumeric (one combined value: setting either on a child replaces what it inherits) Not inherited: width, height, padding, margin, backgroundColor, borderWidth, borderColor, borderRadius, flexDirection, gap, opacity