Content blocks

Heading

The Heading 1–3 blocks (plus Heading 4) at weight 600, sized in em of the 16px content. Any heading can be a toggle heading.

Heading 1
Heading 2
Heading 3
Heading 4

Usage

  • Use Heading 1–3 to structure a page into sections; keep levels in order without skipping.
  • Use a toggle heading when a long section should be collapsible.
  • Use Heading 4 sparingly for small sub-sections inside dense pages.
  • Don’t use headings for emphasis inside running text; use bold marks instead.
  • Don’t use a heading as the page title; use Page title.

Installation

Install the package (React 19):

terminal
npm install @krackedui/motion

Import the styles once, in your app entry or root layout:

/src/main.tsx
import '@krackedui/motion/styles.css';

Use it anywhere inside your app's <Theme> (see Installation):

/src/HeadingExample.tsx
import { BlockContent, Heading, rt } from '@krackedui/motion';

export function HeadingExample() {
  return (
    <BlockContent>
      <Heading level={1} text={rt('Heading 1')} />
      <Heading level={2} text={rt('Heading 2')} />
      <Heading level={3} text={rt('Heading 3')} />
      <Heading level={4} text={rt('Heading 4')} />
    </BlockContent>
  );
}

Examples

Toggle heading

With toggleable, a 24px disclosure triangle sits before the text and children show when open. An open toggle heading without children shows the “Empty toggle” hint, and its triangle is at 50% opacity.

Toggle heading 2
Content inside the heading.
Empty toggle heading

Color

Purple heading
Highlighted heading

API Reference

Heading

Based on <div> and supports its props. Adds:

PropTypeDefault
level
1234
1
text
RichText
renderLeaf
LeafRenderer
color
BlockColor
"default"
toggleable
boolean
false
open
boolean
onOpenChange
(open: boolean) => void
children
ReactNode
onEmptyClick
() => void

headingVariants

tv slots root, pad, leaf with variant level, for custom heading markup.

PropTypeDefault
level
1234
1

Accessibility

  • Each heading is a role="heading" with aria-level one below its block level (the page title is the h1): Heading 1 is level 2 … Heading 4 is level 5, so the page has a real heading outline.
  • The toggle triangle is the DisclosureToggle button with aria-expanded; Enter / Space toggle it.
© 2026 Motion. Internal documentation.