Heading
A semantic heading component with auto-sizing, accent colors, and tracking control. Renders h1–h6 based on the level prop with appropriate sizing.
Live Sandbox
This is a hydrated playground for the component. Toggle "Live preview" on the block below to swap the static HTML render for a real Livewire instance — every prop in the component's sandbox schema becomes an editable form field inside the iframe, so you can try different prop combinations live without writing any local code.
Section title
Basic Usage
Heading 1 (2xl)
Heading 2 (xl)
Heading 3 (lg)
Heading 4 (base)
Heading 5 (sm)
Explicit Sizing
Override the auto-size with the size prop.
Large heading 2
Small heading 3
Accent Color
Use the accent prop to apply the primary theme color.
Accent Heading
Accent Subheading
Both colors are made for the page. On a filled surface, a filled
announcement banner, a
CTA or hero on the accent, or a
section on the accent or the inverse background, a
heading takes the surface's own text color instead, with or without accent. A heading inside a
card keeps the page's colors, because the card has a surface of its own.
Tracking
Control letter spacing with the tracking prop.
Tight Tracking
Long Names
A heading often carries a name somebody chose, such as a template, a repository or a channel, and a name like that may have no space or hyphen to wrap at. It then runs out of its heading, and on a phone the whole page slides sideways. Set break="anywhere" and the name wraps only where the line would otherwise overflow, so ordinary titles still wrap between words.
Template
release_announcement_with_highlights_contributors_and_upgrade_notes
The prop takes the same three values as on text, with the same meaning: anywhere breaks only where a line would overflow, all between any two characters, and normal restores the browser's default rules.
Balanced Lines
A heading that wraps evens out its lines, so its last line does not hold a single word. This is progressive enhancement: it needs text-wrap-style, which is newer than the browser baseline, and a browser without it breaks the lines of the heading as it breaks any text.
Everything your team needs to ship the next release
A text-wrap utility on the heading takes the place of the balanced lines: text-pretty for the rules of running text, or text-wrap for the browser's default breaks. A utility behind a variant counts as well, so with md:text-pretty the heading breaks as any text below md. A heading kept on one line, by truncate or by a row that does not wrap, stays on one line.
Fitting the Line
A heading that breaks after its first word on a phone can shrink instead, down to a floor, with fit. It then takes the fewest lines the floor needs, at the largest size that keeps them. fit alone uses the --text-wk-fit-floor token, three quarters of the heading's size, and a length such as fit="0.6em" sets a floor of its own. How the fitting works and what it costs is on the Fit Text page.
Your order is on its way
Your order is on its way
Help for a Page or a Section
A page or a section whose purpose needs explaining takes help on its heading: the question mark a field shows beside its label, with the text in a tooltip on hover and on keyboard focus. It stands beside the heading element, never inside it, so the heading's name stays its text. A click on it dispatches wirekit:field-help with the heading's id as name and its text as label, as a field's help does; see Explaining a Field at Length.
Billing
Classes given to the heading then go on the row that holds the heading and its question mark, as they do on a label with help. A heading with fit takes the rest of that row, and the question mark stands at its end.
Page Layout Example
Welcome to WireKit
A component library for Laravel Livewire.
Auto-Sizing
When size is not provided, the heading auto-sizes based on level:
| Level | Auto Size |
|---|---|
| 1 | 2xl |
| 2 | xl |
| 3 | lg |
| 4 | base |
| 5, 6 | sm |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
level |
int|null | null |
Heading level 1–6 (renders h1–h6). Defaults to 2 |
size |
string|null | null |
Font size: sm, md, base, lg, xl, 2xl, 3xl, 4xl, 5xl. Auto-sized from level when null |
accent |
bool | false |
Use primary color |
tracking |
string | 'normal' |
Letter spacing: normal, tight, tighter |
break |
string|null | null |
Where an unbroken name may wrap: anywhere only where the line would overflow, all between any two characters, address at the seams of an email address, a host or a URL first, normal the browser default. The same values as on text |
fit |
bool|string|null | null |
Shrinks the heading down to a floor so it takes the fewest lines the floor needs: true for the --text-wk-fit-floor token, or a length such as 0.75em. See Fitting the Line |
as |
string|null | null |
Override element (defaults to h1–h6 based on level) |
scope |
string|null | null |
Scoped personalization name |
help |
string|null | null |
An explanation shown in a tooltip from a question mark beside the heading, outside the heading element. Classes given to the heading then go on the row that holds both. See Help for a Page or a Section |
Keyboard Interaction
Without help the heading is presentational and responds to no key. With help, Tab reaches its question mark, which shows the text in a tooltip while it has the focus, and Enter or Space dispatches wirekit:field-help, as a click does.
Design Tokens
| Token | Used for |
|---|---|
--font-wk-sans |
Font family |
--font-wk-heading-weight |
Font weight |
--font-wk-heading-line-height |
Line height (fallback: 1.25) |
--text-wk-sm through --text-wk-3xl |
Font sizes |
--color-wk-text |
Default color |
--color-wk-accent-text |
Accent color |
--text-wk-fit-floor |
The floor of a heading with fit and no floor of its own, 0.75em |