Skip to content

Heading

Display, section and card headings with optional fit-to-width and reveal.

level picks the size and as picks the element, so the look and the outline are chosen apart: level="h1" as="h3" is a display heading that is a third-level heading. size overrides the size of the level.

Levels

level="h1"

Ship the release

level="h2"

Ship the release

level="h3"

Ship the release

level="h4"

Ship the release

Sizes

size="display"

Invoices this month

size="section"

Invoices this month

size="card"

Invoices this month

size="inline"

Invoices this month

Fit to width

Release 4.2

Fourteen changes, shipped on Tuesday

Reveal

Every task closed, two days ahead of the release

Weight and colour

Medium, the default

Normal weight

Muted colour

Installation

npx shadcn@latest add @khaeli/heading

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

npm packages
  • class-variance-authority ^0.7.1

Accessible name

  • A plain-text heading is revealed line by line. The full text stays in the heading for assistive technology and the animated lines are hidden from it. With reduced motion the text is shown at once.
  • Pass animated={false} for a heading that should not move.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/heading.json