Heading Outline

Heading Outline is a copy-paste React component that stops skipped heading levels confuse screen readers before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/heading-outline
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsSkipped heading levels confuse screen readers

Was this component page useful?

How do I install Heading Outline?

pnpm dlx shadcn@latest add @bollard/heading-outline

The files land in your project. They're yours to edit.

How do I use Heading Outline in React?

heading-outline-usage.tsx
import { HeadingOutline, type OutlineHeading } from "@/components/ui/heading-outline"

<HeadingOutline markdown={markdown} onMarkdownChange={setMarkdown} onJump={jump} />

What input mistakes does Heading Outline catch?

  • Skipped heading levels (H2 to H4)
  • More than one H1, or none
  • Empty headings
  • Bold lines that look like headings but aren't
  • Headings long enough to be paragraphs

What props does Heading Outline accept?

HeadingOutline props
PropTypeDefault
markdown

Markdown to outline. With `onMarkdownChange`, problems get one-tap fixes.

string—
onMarkdownChange

Called with the fixed Markdown when a fix is tapped.

(markdown: string) => void—
target

Live mode: outline the headings inside this element, updating as it changes. Rows jump to the heading.

React.RefObject<HTMLElement | null>—
onJump

Called when a row is chosen (markdown mode), e.g. to move the editor's cursor there.

(heading: OutlineHeading) => void—
startLevel

Level the content starts at. Use 2 when the page template already renders the H1.

number1
maxLength

Headings longer than this are flagged.

number90
label

Accessible name of the outline.

string"Heading outline"
title

Heading shown above the outline.

string"Outline"
summaryText

`{count}` is filled in.

string"{count} to fix"
allGoodText

Shown when no issues are found.

string"Structure looks right"
emptyText

Shown when there are no headings.

string"No headings yet."
emptyHeadingText

Row text for an empty heading.

string"Empty heading"
skippedRowText

`{level}` is filled in.

string"H{level} skipped"
fixLabel

`{level}` is filled in.

string"Make it H{level}"
removeLabel

Label for the button that removes an empty heading.

string"Remove it"
messages

Override any issue message.

Partial<typeof HEADING_OUTLINE_MESSAGES>—

* required. Also accepts the native props of <nav> (className, aria-*, data-*…), passed through to it.

How is Heading Outline accessible?

  • Rendered as a labelled nav
  • Summary line is a polite live region
  • Jump focuses the heading (adding tabindex=-1 when needed); smooth scroll is skipped under reduced motion
  • Focus returns to a nearby row after a fix

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • DOM mode reads headings and role=heading; it skips hidden content but cannot judge whether heading text is meaningful
  • Markdown mode parses ATX, setext and single-line HTML headings, not every Markdown dialect
  • One outline check, not a full WCAG audit

What expensive mistakes does Heading Outline stop?

Skipped heading levels confuse screen readers

Also known as

headings · h1 · a11y · accessibility · wcag · markdown editor · document outline · screen reader

Field type

What dependencies does Heading Outline require?

Heading Outline facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameHeading Outline
Registry identifier@bollard/heading-outline
Install commandnpx shadcn@latest add @bollard/heading-outline
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Heading Outline

What form validation mistake does Heading Outline catch?

Heading Outline prevents skipped heading levels confuse screen readers. Shows the live heading outline of a Markdown draft or page region and flags skipped levels and fake headings that confuse screen reader users. Catches: Skipped heading levels (H2 to H4), More than one H1, or none, Empty headings, Bold lines that look like headings but aren't, Headings long enough to be paragraphs. Limitation: validate heading-outline schemas on backend.

How do I install heading-outline with shadcn?

Run `npx shadcn@latest add @bollard/heading-outline`. Sources added: registry/default/heading-outline/heading-outline.tsx. Package requirements: lucide-react.

What props customize Heading Outline?

Heading Outline accepts `markdown`, `onMarkdownChange`, `target`, `onJump`, `startLevel`. Configures headings, h1, a11y behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of heading-outline?

DOM mode reads headings and role=heading; it skips hidden content but cannot judge whether heading text is meaningful. Markdown mode parses ATX, setext and single-line HTML headings, not every Markdown dialect. One outline check, not a full WCAG audit Server requirement: backend verification for heading-outline.

How does Heading Outline meet accessibility guidelines?

Rendered as a labelled nav. Summary line is a polite live region. Jump focuses the heading (adding tabindex=-1 when needed); smooth scroll is skipped under reduced motion. Focus returns to a nearby row after a fix. Minimizes errors: skipped h2 to h4, multiple h1 on page.

Which components pair with Heading Outline?