# Section heading

> Heading group for a page section: an optional uppercase eyebrow, a large title and a muted description, left or centered.

- Kind: ui · Category: Layout and media · Interactivity: none
- Install: `npx shadcn@latest add @haze/section-heading`
- File: `src/components/haze/ui/section-heading.astro`
- npm dependencies: none
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/ui/section-heading

## Use when
- Opening a landing-page section such as features, pricing or FAQ
- A title with a one-line intro that needs the same type scale on every section
- Pointing a <section aria-labelledby> at its heading through the id prop

## Avoid when
- A heading inside a card or a dialog; those components take their own title prop
- Body-size subheadings in running text; use a plain heading with prose classes

## Alternatives
- [card](https://hazeui.com/ui/card.md)
- [separator](https://hazeui.com/ui/separator.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| title | `string` |  | yes | The heading text. |
| eyebrow | `string` |  | no | Short label above the title, drawn as a muted uppercase micro-label. |
| description | `string` |  | no | Muted paragraph under the title, at most 42 rem wide. |
| align | `"left" \| "center"` | "left" | no | Text alignment; center also centers the box and the description in the parent. |
| headingLevel | `1 \| 2 \| 3` | 2 | no | Tag of the title. Visual size stays the same at every level. |
| id | `string` |  | no | Set on the heading element, for aria-labelledby on the surrounding section. |
| class | `string` |  | no | Extra classes on the wrapper. |

## Accessibility
- The title level is a prop, so the size you see is decoupled from the outline; a section under an h2 page title should use 3.
- The eyebrow is a paragraph outside the heading, so screen reader heading lists show only the title.
- Use headingLevel 1 once per page; the default 2 assumes the page already has its h1.

## Agent prompts

### Install and use

Install the Haze UI component "Section heading" with `npx shadcn@latest add @haze/section-heading`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import SectionHeading from "@/components/haze/ui/section-heading.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/ui/section-heading.md

### Customize with real content

Adapt the Haze section-heading ui for our product. Replace the demo values of these props with our real content: title, eyebrow, description, align, headingLevel, id, class. Keep the layout, the heading level rules and these accessibility details: The title level is a prop, so the size you see is decoupled from the outline; a section under an h2 page title should use 3. The eyebrow is a paragraph outside the heading, so screen reader heading lists show only the title. Use headingLevel 1 once per page; the default 2 assumes the page already has its h1. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using section-heading, check it fits: use it when opening a landing-page section such as features, pricing or faq; a title with a one-line intro that needs the same type scale on every section; pointing a <section aria-labelledby> at its heading through the id prop. Avoid it when a heading inside a card or a dialog; those components take their own title prop; body-size subheadings in running text; use a plain heading with prose classes. Alternatives: @haze/card, @haze/separator.

## Example requests that should lead here
- Add a centered heading with the eyebrow Pricing above the plans
- Give the FAQ section a title and a one-line description

## Source

```astro
---
import { cn } from "../../../lib/haze/utils";

interface Props {
  title: string;
  /** Short label above the title. */
  eyebrow?: string;
  description?: string;
  align?: "left" | "center";
  /** Heading level of the title. Use 1 only once per page. */
  headingLevel?: 1 | 2 | 3;
  /** Put on the heading so a <section aria-labelledby> can point at it. */
  id?: string;
  class?: string;
}

const { title, eyebrow, description, align = "left", headingLevel = 2, id, class: className } = Astro.props;
const Heading = ({ 1: "h1", 2: "h2", 3: "h3" } as const)[headingLevel];
const aligns = { left: "text-left", center: "mx-auto text-center" };
const descriptionAligns = { left: "", center: "mx-auto" };
---

<div class={cn("grid max-w-2xl gap-3", aligns[align], className)}>
  {eyebrow && <p class="text-xs/4 font-medium text-muted-foreground">{eyebrow}</p>}
  <Heading id={id} class="text-3xl/9 font-medium tracking-tight text-balance text-foreground sm:text-4xl/11">{title}</Heading>
  {description && <p class={cn("max-w-2xl text-base/7 text-pretty text-muted-foreground", descriptionAligns[align])}>{description}</p>}
</div>
```
