---
title: Heading
description: Anchored headings with hover copy-link buttons.
---

`heading()` renders an anchored heading: clicking the text jumps to the
anchor, a ghost copy button appears on hover/focus and copies the `#<id>`
link.

## Levels

```ts
heading(2, 'Installation', { id: 'installation' });
heading(3, 'From source', { id: 'from-source' });
heading(3, 'From registry', { id: 'from-registry' });
```

## Step headings

```ts
heading(2, 'Create the account', { id: 'create-account', step: true });
```

## Props

<PropsTable
  labels={{ prop: 'Option', type: 'Type' }}
  type={{
    level: { type: '1–6', description: 'Heading level (first argument).' },
    text: { type: 'string', description: 'Heading text (second argument).' },
    id: { type: 'string', description: 'Anchor id — also used by the copy-link button.' },
    step: { type: 'boolean', description: 'Marks the heading as a Plumest TOC step (<code>data-cpd-step</code>).' },
  }}
/>

## Notes

- The anchor link is `href="#<id>"`; the copy button copies the absolute
  `location.origin + pathname + #<id>` URL.
- `step` headings render with a step badge in the article and get a numbered
  badge in the Plumest TOC.
