<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# 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.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

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

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { SectionHeader } from "@/components/ouro/section-header/section-header";
```

## Example

```tsx
<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`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `actions` | `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` | `string` |  | Layout only: margins, width (`mt-8`). Appearance classes warn in development. |
| `divider` | `boolean` | `true` | The hairline under the row, between the header and the section's content. |
| `level` | `2 \| 3` | `2` | The title's heading level: `2` under the page's `<h1>`, `3` for a section inside one. |
| `meta` | `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` | `Ref<HTMLDivElement>` |  | Reaches the rendered element. |
| `title` (required) | `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.
