Reference

Heading

Heading; level picks the tag (h2 when none is given).

Heading(_ content: String or Number or Bool, level: Enum, align: Enum, muted: Bool)

Before 5.0

level

h1

h2

h3

h4

h5

align

Pricing

Plans for every team

What every plan has

Example

wf

Stack(gap: .xs) { Heading("Pricing").h1 Heading("Plans for every team").h2.muted Heading("What every plan has").h3 }

Centred, over a section

wf

Heading("Frequently asked questions").h2.center

The deeper levels

wf

Stack { Heading("Settings").h2 Heading("Notifications").h3 Heading("Email").h4 Heading("Weekly digest").h5 Heading("Footnote").h6 }

Props

Props of Heading
PropTypeUnsetMeaning

content

String or Number or Bool (positional)

none

The heading text: a string, a number or a boolean

level:

one of its cases

h2

The tag (<h1> … <h6>), its place in the outline, and its size. Written as a flag, .h1, or by name, level: .h1.

  • .h1: The page's one top heading, font-size-3xl
  • .h2 (the default): A section heading, font-size-2xl (the default)
  • .h3: A sub-section, font-size-xl
  • .h4: font-size-lg
  • .h5: font-size-base
  • .h6: font-size-sm

align:

one of its cases

none: the start, as inherited

Where its lines sit. Written as a flag, .left, or by name, align: .left.

  • .left: To the start of the line (text-align: start; the right in a right-to-left page)
  • .center: Centred
  • .right: To the end of the line (text-align: end; the left in a right-to-left page)

muted:

Bool

false

In color-text-muted. Written as a flag, .muted, or muted: true.

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.

.h1

.h2

.h3

.h4

.h5

.h6

.left

.center

.right

.muted

Events

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

Slots

It takes no slots.

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