This page as markdown: /section-header.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

SectionHeader

Status: stable

The heading block for one section of a page: a title (h2 by default), an optional line of description, and actions on the title row — a "View all" link or a couple of buttons — that drop beneath the title only when the row runs out of room.

Keywords: section header, section heading, section title, shelf, view all, see all, show all, h2, subsection, optical alignment, bleed, editorial section, large section title

Usage

Use SectionHeader to head each section below the page title — a home-page shelf with View all, a settings group, a list with its own actions. PageHeader is the route's single h1; every section under it takes a SectionHeader, with titleId wired to the section's aria-labelledby.

Best practices

Anatomy

Part Required Description
Title yes The section's heading (h2 by default), wrapping rather than truncating. Its id names the section.
Description no One line of supporting copy under the title, capped at the prose measure.
Actions no Buttons or links at the title row's end; they move beneath the title when the row is too narrow for both. A borderless (ghost/link) Button at either end of the group is optically aligned: its label, not its invisible padding, meets the content edge.

Props

Name Type Default Description
title ReactNode — The section's title.
description ReactNode — One line of supporting copy beneath the title, capped at the prose measure.
actions ReactNode — Trailing actions on the title row — a View all link or a couple of buttons, size="sm". They stay on the title's row and drop beneath it only when the row runs out of room; the title wraps rather than truncating. A ghost or link Button that ends the group bleeds by its padding at the end (and one that starts it, at the start — the edge once wrapped), so its label lines up with the content below; Button bleed="none" opts out. Direct children only.
titleAs "h2" | "h3" | "h4" "h2" The heading element, chosen by the document outline: h2 for a section under the page's h1, h3 for a subsection inside one.
titleId string — The title's id, so the section it heads can point at it:
. Generated when omitted.
size "lg" | "md" | "sm" "md" Visual weight, independent of the heading level: lg (text-heading-2 over a text-body-md description) for an editorial page's sections, under a PageHeader size="lg"; md (text-heading-3) for a page's sections and shelves; sm (text-heading-4) for denser sets — settings groups, subsections. lg stops at heading-2: heading-1 is the page title's, one per route. The actions stay centred on the title's first line at every size.

Variants

Tokens used

foreground, muted-foreground

Motion

Accessibility

Related

Examples

A shelf with View all

import { Button, Card, CardDescription, CardHeader, CardTitle, Grid, SectionHeader } from "@sableui/react"

<section aria-labelledby="new-releases" className="flex flex-col gap-4">
	<SectionHeader
		titleId="new-releases"
		title="New releases"
		description="Fresh from artists you follow."
		actions={
			<Button variant="ghost" size="sm" render={<a href="/new" />} aria-label="View all new releases">
				View all
			</Button>
		}
	/>
	<Grid minItemWidth="10rem" gap={2}>
		<Card><CardHeader><CardTitle>Night Swim</CardTitle><CardDescription>Lena Vale</CardDescription></CardHeader></Card>
		<Card><CardHeader><CardTitle>Low Tide</CardTitle><CardDescription>Harbour Lights</CardDescription></CardHeader></Card>
	</Grid>
</section>

A settings section

import { Field, SectionHeader, Switch } from "@sableui/react"

<section aria-labelledby="playback" className="flex flex-col gap-4">
	<SectionHeader
		titleId="playback"
		size="sm"
		title="Playback"
		description="How tracks start, end and blend into each other."
	/>
	<Field label="Crossfade" orientation="horizontal">
		<Switch defaultChecked />
	</Field>
	<Field label="Normalize volume" orientation="horizontal">
		<Switch />
	</Field>
</section>

A section with two actions

import { Button, Entity, Icon, SectionHeader, Stack } from "@sableui/react"

<section aria-labelledby="playlists" className="flex flex-col gap-4">
	<SectionHeader
		titleId="playlists"
		title="Your playlists"
		actions={
			<>
				<Button variant="ghost" size="sm" iconStart={<Icon name="filter" />}>Filter</Button>
				<Button size="sm" iconStart={<Icon name="plus" />}>New playlist</Button>
			</>
		}
	/>
	<Stack gap={1}>
		<Entity className="[--entity-px:0]" title="Late drives" subtitle="42 tracks" />
		<Entity className="[--entity-px:0]" title="Focus" subtitle="18 tracks" />
	</Stack>
</section>

An editorial section (size lg)

import { Button, Card, CardDescription, CardHeader, CardTitle, Grid, SectionHeader } from "@sableui/react"

<section aria-labelledby="selected-work" className="flex flex-col gap-6">
	<SectionHeader
		titleId="selected-work"
		size="lg"
		title="Selected work"
		description="Five projects from the last two years."
		actions={
			<Button variant="ghost" size="sm" render={<a href="/work" />} aria-label="View all work">
				View all
			</Button>
		}
	/>
	<Grid minItemWidth="16rem" gap={3}>
		<Card><CardHeader><CardTitle>Tidewater</CardTitle><CardDescription>Brand identity</CardDescription></CardHeader></Card>
		<Card><CardHeader><CardTitle>Northlight</CardTitle><CardDescription>Product design</CardDescription></CardHeader></Card>
	</Grid>
</section>

A subsection inside a section

import { SectionHeader } from "@sableui/react"

<SectionHeader titleAs="h3" size="sm" title="Appears on" />