Patterns · Layout
Section heading
Title and supporting text at the top of a Section or page. It sets the heading level and the type scale in one place.
import { SectionHeading } from '@statix/ui/section-heading';Playground
Pricing
Per website, no hidden costs. Pay yearly and get three months free.
<SectionHeading
title="Pricing"
description="Per website, no hidden costs. Pay yearly and get three months free."
spacing="none"
/>Examples
Basic
An h2 at section size with a lead paragraph.
Updates tested on a copy first
Every week we update WordPress, themes and plugins on a staging copy. Only when everything works do we update your live website.
<script lang="ts">
import { SectionHeading } from '@statix/ui/section-heading';
</script>
<SectionHeading
title="Updates tested on a copy first"
description="Every week we update WordPress, themes and plugins on a staging copy. Only when everything works do we update your live website."
spacing="none"
/>Page title with eyebrow
The customer area opens each page with an eyebrow and an h1. Use size="sm" there, display is for marketing heroes.
Your customer area
Welcome back, Ms Berger.
Your products, invoices and contracts in one place.
<script lang="ts">
import { SectionHeading } from '@statix/ui/section-heading';
</script>
<SectionHeading
eyebrow="Your customer area"
title="Welcome back, Ms Berger."
description="Your products, invoices and contracts in one place."
level={1}
size="sm"
spacing="none"
class="w-full"
/>Customer area with an action
size="title" is the 24px heading over lists in the customer area. action puts a link at the end of the row.
Your websites
What we did last and what you can do yourself.
<script lang="ts">
import { SectionHeading } from '@statix/ui/section-heading';
import { Button } from '@statix/ui/button';
import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
</script>
<div class="px-6 py-10 tablet:px-10">
<SectionHeading
title="Your websites"
description="What we did last and what you can do yourself."
size="title"
spacing="none"
>
{#snippet action()}
<Button href="#websites" variant="ghost" size="sm">
Show all
<ArrowRightIcon data-icon="inline-end" />
</Button>
{/snippet}
</SectionHeading>
</div>Split
From tablet on the description moves to the right and aligns with the bottom of the title.
Pricing
Per website, no hidden costs. Pay yearly and get three months free.
<script lang="ts">
import { SectionHeading } from '@statix/ui/section-heading';
</script>
<div class="px-6 py-10 tablet:px-10">
<SectionHeading
title="Pricing"
description="Per website, no hidden costs. Pay yearly and get three months free."
split
spacing="none"
/>
</div>Centered
For short closing sections and calls to action.
Moving to Statix?
We do the work.
We move your website for free and keep it running while we do.
<script lang="ts">
import { SectionHeading } from '@statix/ui/section-heading';
import { Button } from '@statix/ui/button';
</script>
<div class="flex flex-col items-center gap-8">
<SectionHeading
centered
spacing="none"
description="We move your website for free and keep it running while we do."
>
{#snippet title()}
Moving to Statix?<br />We do the work.
{/snippet}
</SectionHeading>
<Button variant="dark">Book a call</Button>
</div>Guidelines
Do
- Keep titles to one idea and one line on desktop where you can.
- Pick the level from the document outline, then the size from the design. They are independent.
- Use a title snippet when you need a line break.
Don't
- Don’t use display below the hero. One display heading per page.
- Don’t write the eyebrow as a second title. Two to four words.
Accessibility
- level sets the real heading element (h1 to h3). Keep one h1 per page.
- The eyebrow is a plain paragraph before the heading, so screen readers read it first.
API reference
SectionHeading
renders<div> and accepts its attributes| Prop | Type | Default |
|---|---|---|
title | string | Snippet Heading text. Falls back to children. | – |
description | string | Snippet Supporting paragraph. | – |
eyebrow | string Short uppercase label above the title. | – |
action | Snippet Link or button at the end of the row, bottom-aligned. | – |
level | 1 | 2 | 3 Heading element. | 2 |
size | 'display' | 'section' | 'sm' | 'title' display 52/62px, section 36/52px, sm 24/36px (phone/tablet and up). title: 24px with a 15px description. | 'section' |
spacing | 'none' | 'xs' | 'sm' | 'md' | 'lg' Margin below the block: 0, 24, 32, 48 or 64px. | 'lg' |
centered | boolean Centre the block and its text. | false |
split | boolean Tablet and up: description sits right of the title. | false |
titleClass | ClassValue Classes for the heading element. | – |
ref bind | HTMLDivElement | null The wrapper element. | – |
class | ClassValue Merged with the wrapper classes; yours win. | – |
| Data attribute | Meaning |
|---|---|
data-slot="section-heading" | The wrapper. |
data-slot="section-heading-title" | The heading element. |
data-slot="section-heading-description" | The paragraph. |
data-slot="section-heading-eyebrow" | The eyebrow. |
data-slot="section-heading-action" | Wrapper around the action. |
sectionHeadingVariants
The tailwind-variants function (slots base, eyebrow, title, description).