Reference

Header

Repeated at the top of every PDF page (or those on: names), where page and pages are the page's number and the count; a <header> on the web.

Header(on: Enum) { … }

Before 5.0

PDF

on

all

first

rest

odd

even

No preview for this one: the example below shows how it is written.

Example

wf

Document(title: "Annual report 2026") { Header(on: .rest) { Row(justify: .between) { Text("Northwind Ltd").bold.sm Text("Annual report 2026").muted.sm } } Heading("Annual report 2026").h1 PageBreak Heading("The year").h2 }

Different on left and right pages

wf

Document(title: "Handbook") { Header(on: .odd) { Text("Handbook").muted.sm.right } Header(on: .even) { Text("Northwind Ltd").muted.sm.left } Heading("Handbook").h1 }

Props

Props of Header
PropTypeUnsetMeaning

on:

one of its cases

all

Which pages it is drawn on, in the top margin. Written as a flag, .all, or by name, on: .all.

  • .all (the default): Every page
  • .first: The first page only
  • .rest: Every page but the first
  • .odd: Odd pages (1, 3, 5 …)
  • .even: Even pages

Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

.all

.first

.rest

.odd

.even

Events

Every element also takes the props, the events and the attribute families listed on every element.

Slots

children

Renders with the class wf-header, stable across releases, so a stylesheet may target it.

These controls list the props' cases; the example below shows them written.