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
Stack(gap: .xs) {
Heading("Pricing").h1
Heading("Plans for every team").h2.muted
Heading("What every plan has").h3
}
Centred, over a section
Heading("Frequently asked questions").h2.center
The deeper levels
Stack {
Heading("Settings").h2
Heading("Notifications").h3
Heading("Email").h4
Heading("Weekly digest").h5
Heading("Footnote").h6
}
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
content | String or Number or Bool (positional) | none | The heading text: a string, a number or a boolean |
level: | one of its cases |
| The tag (
|
align: | one of its cases | none: the start, as inherited | Where its lines sit. Written as a flag,
|
muted: | Bool | false | In |
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.