Skip to contentnotionic
Docs menu

Reference

NotionRenderer

Props of the component that renders Notion blocks.

TypeScript
import { NotionRenderer } from "notionic"
PropTypeDescription
blocksNotionBlock[]Blocks from the Notion API, with nested blocks as children, as fetchBlocks returns them.
componentsBlockComponentsReplacement components, by block type, plus inline_equation, link (every link in text), demo (the frame around demos), footnotes (the footnote list) and resources (each run of resource rows).
pageHref(pageId: string) => string | nullWhere links to Notion pages point. Defaults to notion.so (opens in a new tab).
transformFileUrl(file: { blockId: string; url: string }) => stringRewrites URLs of files uploaded to Notion, which expire after an hour. External URLs aren't passed through it.
demosRecord<string, ComponentType<DemoProps>>Your demo components, by name. An embed of a URL ending in /demos/<name> renders one in its place.
embedsEmbedPolicy: boolean | string[] | ((url: string) => boolean)Which embeds load in a sandboxed iframe instead of a card: the listed hosts and their subdomains, every embed (true), or those the function accepts. Only http(s) URLs, and demos come first. Default off. See Untitled.
footnotes{ headings?, showTitle?, title? }Footnotes from a "Footnotes" section. See Footnotes (opens in a new tab).
resources{ headings? }A resources list from a "Resources" section. See Untitled.
linkFaviconsbooleanShow the site's favicon before each link to another site, from the icons fetchBlocks attached with linkFavicons: true. Default false. See Fetching pages (opens in a new tab).
classNamestringClasses for the root element.

It works as a Server Component and ships no client JavaScript of its own; demos ship theirs, and a page with live embeds ships a small listener that lets them report their height. Unsupported blocks render nothing, with a warning in development.