notionic
Write in Notion. Ship it as React Server Components, styled with your shadcn/ui theme.
- Server-first. Every block renders on the server, with no client JavaScript.
- Follows your theme. Styled with Tailwind CSS and shadcn/ui tokens, so pages match your app, dark mode included.
- Yours to change. Replace the component for any block type, or install shadcn/ui versions from the registry.
- Light. React is the only runtime dependency.
pnpm add notionic @notionhq/clientImport notionic after Tailwind CSS, in your global stylesheet:
@import "tailwindcss";@import "notionic/styles.css";import { Client } from "@notionhq/client"import { NotionRenderer } from "notionic"import { fetchBlocks } from "notionic/fetch"
const notion = new Client({ auth: process.env.NOTION_TOKEN })
export default async function Page() { const blocks = await fetchBlocks(notion, "your-page-id") return <NotionRenderer blocks={blocks} />}fetchBlocks gets every block of the page with its nested blocks. Cache it with your framework, for example Next.js's "use cache".
graph TD
A["Notion page"] --> B["fetchBlocks"]
B --> C["NotionRenderer"]
C --> D["HTML from the server"]Pass your own component for any block type. It gets the block and its rendered children.
<NotionRenderer blocks={blocks} components={{ callout: MyCallout }} />Install shadcn/ui versions of blocks with the shadcn CLI. They're copied into your project, so you can edit them.
npx shadcn@latest add @notionic/notion-codePoint links between Notion pages to your own URLs.
<NotionRenderer blocks={blocks} pageHref={(id) => routes.get(id) ?? null} />| Component | Built on |
|---|---|
notion-code | Code Block and Shiki |
notion-callout | Alert |
notion-table | Table |
notion-toggle | Collapsible |
notion-tabs | Tabs |
notion-equation | KaTeX |
notion-mermaid | Mermaid |
notion-equation renders math on the server, the way Notion shows it:
Paragraphs, headings, lists, to-dos, quotes, callouts, toggles, dividers, code, equations, tables, columns, tabs, synced blocks, table of contents, images, video, audio, files, PDFs, bookmarks, link previews, embeds, child pages and links to pages. Unsupported blocks render nothing.
No. notionic is React, and works anywhere React Server Components or server rendering do. fetchBlocks works with any framework.
notionic is in early development, and its API may change before 1.0. This page is rendered with it.