Docs menu
Reference
NotionRenderer
Props of the component that renders Notion blocks.
TypeScript
import { NotionRenderer } from "notionic"| Prop | Type | Description |
|---|---|---|
blocks | NotionBlock[] | Blocks from the Notion API, with nested blocks as children, as fetchBlocks returns them. |
components | BlockComponents | Replacement 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 | null | Where links to Notion pages point. Defaults to notion.so (opens in a new tab). |
transformFileUrl | (file: { blockId: string; url: string }) => string | Rewrites URLs of files uploaded to Notion, which expire after an hour. External URLs aren't passed through it. |
demos | Record<string, ComponentType<DemoProps>> | Your demo components, by name. An embed of a URL ending in /demos/<name> renders one in its place. |
embeds | EmbedPolicy: 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. |
linkFavicons | boolean | Show 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). |
className | string | Classes 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.