Skip to contentnotionic
Docs menu

Reference

Utilities

Helpers for your own components and layouts.

All from notionic.

collectHeadings(blocks)

The page's headings in reading order, with the same anchor ids the rendered headings get. Use it for a sidebar outline:

TypeScript
const outline = collectHeadings(blocks)// [{ id: "install", text: "Install", level: 1, blockId: "…" }]

RichText

Renders a Notion rich text array, with annotations, colors and links: <RichText text={block.callout.rich_text} context={context} />.

plainText(richText) and pageTitle(page)

The text of a rich text array without formatting, and a page's title from its properties.

How a link renders, after pageHref and safety checks: { href, external }, or null.

defaultComponents

The built-in component for each block type.