Skip to main content

Layout

SectionHeader

The head of a section inside a page: its title in the theme's heading font, a short count in small capitals at the end of the row (meta), an optional text action such as a link to the whole list, and a hairline under it. The action stays on the title's row on phones.

Your recipes

2 recipes · 2 cookbooks

Install

Hand it to your agent
Add SectionHeader from Ouro UI to this app. Read https://ui.ouroboros.bot/docs/section-header.md first and follow it.

Or by hand. Once per app, with Tailwind CSS v4 and an @/* path alias (Ouro HX is built on Base UI, so --base base; skip -t in an existing app):

npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.344

Then the component. From v0.8.0 it installs only the helpers it imports and never touches your stylesheet (Installing):

npx shadcn@latest add ourostack/ouro-ui/section-header#v1.3.344

Or, with the @ouro namespace set up:

npx shadcn@latest add @ouro/ouro-base @ouro/section-header

Its tests, stories and Playwright spec are optional. They need Vitest 4.1.11 or later, and from v0.8.0 never change a version your app has (Testing):

npx shadcn@latest add ourostack/ouro-ui/section-header#v1.3.344 ourostack/ouro-ui/section-header-tests#v1.3.344
import { SectionHeader } from "@/components/ouro/section-header/section-header";

Paths use shadcn's default @/ alias; the CLI rewrites them to yours.

Example

<SectionHeader
  title="Your recipes"
  meta="2 recipes · 2 cookbooks"
  actions={<Link href="/recipes">See all</Link>}
/>

Use instead when

  • Use PageHeader instead for the top of the page, with its eyebrow, description and buttons, and Heading instead for a title with nothing around it.

Props

Type: SectionHeaderProps.

actions
Type: ReactNode
A text action at the end of the row, such as a Link to the whole list. It stays on the title's row at every width.
className
Type: string
Layout only: margins, width (mt-8). Appearance classes warn in development.
divider
Type: boolean
Default: true
The hairline under the row, between the header and the section's content.
level
Type: 2 | 3
Default: 2
The title's heading level: 2 under the page's <h1>, 3 for a section inside one.
meta
Type: ReactNode
A short count or status at the end of the row, in small tracked capitals: "2 recipes · 2 cookbooks". It wraps under the title when the row is too narrow for both.
ref
Type: Ref<HTMLDivElement>
Reaches the rendered element.
title (required)
Type: ReactNode
The section's title, its <h2> (or <h3> with level={3}), in the theme's heading font.

Native attributes

Also accepts the attributes in React's HTMLAttributes (id, aria-*, event handlers), passed to the rendered element, except those named on this page.

Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

  • action: Not a prop. The link is actions: <SectionHeader actions={<Link href="/recipes">See all</Link>} />.
  • count: Not a prop. The count is meta: <SectionHeader title="Recipes" meta="12 recipes" />.
  • description: Not a prop. The text beside the title is meta: <SectionHeader meta="2 shelves" />.
  • heading: Not a prop. The title is title: <SectionHeader title="Recipes" />.

className is for layout only

Pass margins, width and grid placement (mt-4, w-full, col-span-2).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (hover:, sm:) and any ! are removed, it starts with bg-, text-, border-, rounded-, shadow-, font-, ring-, from-, via-, to-, fill- or stroke-, or is border, rounded, shadow or ring, or has a dark: variant. Text wrapping, overflow and table layout classes (text-wrap, text-ellipsis, border-collapse) are layout and do not warn.

Alignment classes (text-center) warn too: set alignment on a parent element.