Heading

Accessible document title headings with automated slug anchors.

The Heading primitive is a wrapper element that renders HTML title headings (<h1> through <h6>) and automatically attaches anchor copy-to-clipboard links when an id is provided.

Quick StartLink

Render a heading with automated anchor link wrapping:

tsx
import { Heading } from 'boltdocs/primitives'

export default function SectionHeader() {
  return (
    <Heading
      level={2}
      id="project-architecture"
      className="text-2xl font-bold text-body border-b border-subtle pb-2"
    >
      Project Architecture
    </Heading>
  )
}

Anchor PositionsLink

You can customize where the Lucide anchor link icon appears:

Wrap Position (Default)Link

Wraps the entire text content inside a local router hyperlink, rendering the link icon at the trailing edge on hover.

Before / After PositionsLink

Renders the link icon as a standalone prefix or suffix:

tsx
<Heading level={3} id="options" anchorPosition="before">
  Configuration Options
</Heading>

Component PropsLink

The Heading component accepts standard HTML heading attributes plus:

PropertyTypeDefaultDescription
level1 | 2 | 3 | 4 | 5 | 6RequiredRenders the corresponding HTML heading element (e.g., 1 outputs <h1>).
idstringundefinedUnique section slug identifier. Required to enable the anchor link.
showAnchorbooleantrueToggles whether anchor glyphs should be displayed on hover/click.
anchorPosition'wrap' | 'before' | 'after''wrap'Determines the layout orientation of the link icons.
anchorIconReactNodeLucideLinkCustom SVG graphic component to override the default link glyphs.
anchorClassNamestringundefinedCustom style overrides for the wrapping anchor link element.
classNamestringundefinedCSS class style override for the heading.
styleCSSPropertiesundefinedInline style settings.

Customization & statesLink

Heading renders a semantic heading tag (h1–h6) and, when an id is present, wraps the content in an anchor link. It has no interactive state of its own — typography, spacing, and borders come from the theme through className (the heading) and anchorClassName (the anchor link wrapper).

State / SlotMechanism
classNamePassthrough to the rendered <h1>–<h6>; theme controls type, size, spacing, borders
anchorClassNamePassthrough to the anchor link wrapper (defaults to a link icon shown on hover)
level1–6, structural only — no visual state
id + showAnchorEnables the anchor link; anchorPosition picks wrap / before / after
No stateNo data-* attributes or interaction states

Tailwind v4:

tsx
<Heading
  level={2}
  id="overview"
  className="group text-2xl font-bold text-body border-b border-subtle pb-2"
  anchorClassName="text-muted/50 hover:text-primary-500"
>
  Overview
</Heading>
Last updated on October 18, 2026

Was this page helpful?