# Heading

A page or section title on the type scale, with its HTML level separate from its size.

- Family: display
- Import: `import { Heading } from "@senvenli/react/display";`
- Page: https://design.senvenli.com/docs/components/heading
- JSON: https://design.senvenli.com/docs/components/heading.json

## Example: A section title

The level places it in the page outline and picks a matching size.

```tsx
import { Heading, Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Stack space="space-100">
      <Heading level={2}>Billing</Heading>
      <Text elementType="p" tone="subtle">
        Invoices are issued on the first day of each month and sent to the account owner.
      </Text>
    </Stack>
  );
}
```

## Examples

### Levels

Each level has its default size; follow the page structure and never skip a level.

```tsx
import { Heading } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Stack space="space-150">
      <Heading level={2}>Customers</Heading>
      <Heading level={3}>Recent orders</Heading>
      <Heading level={4}>Shipping address</Heading>
      <Heading level={5}>Delivery notes</Heading>
    </Stack>
  );
}
```

### Size apart from level

When the outline level looks too large or too small, change `size`, not the level.

```tsx
import { Heading } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Stack space="space-150">
      {/* A side panel's title is an h2 in the outline, but reads at card-title size. */}
      <Heading level={2} size="heading-small">
        Order summary
      </Heading>
      <Heading level={2} size="heading-xxlarge">
        $48,920 this month
      </Heading>
    </Stack>
  );
}
```

## Guidelines

### When to use it

- Naming a page, a section or a group of content.

### Use something else when

- [text](https://design.senvenli.com/docs/components/text.md): The words are body copy, labels or captions.

### Do and avoid

- One level-1 heading per page; never skip levels for looks, use `size` instead.

## Accessibility

Built in:

- Renders the real h1–h6 element for `level`, so the outline stays correct.

You provide:

- Levels that follow the page structure.

## API reference

### Heading

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| level | `HeadingLevel` |  | yes | The place in the document outline (h1–h6). |
| size | `HeadingSize` |  | no | The look, set apart from the level. `display-*` is for a marketing hero and section titles only. |
| children | `React.ReactNode` |  | yes |  |
| id | `string` |  | no |  |

### Tokens it reads

`--ds-background-neutral`, `--ds-border-bold`, `--ds-link`, `--ds-radius-xsmall`, `--ds-space-050`, `--ds-space-100`, `--ds-space-200`, `--ds-space-250`, `--ds-space-300`, `--ds-space-400`, `--ds-text`, `--ds-text-brand`, `--ds-text-danger`, `--ds-text-information`, `--ds-text-subtle`, `--ds-text-subtlest`, `--ds-text-success`, `--ds-text-warning`, `--font-ds-mono`

## Related

- [text](https://design.senvenli.com/docs/components/text.md)
