0.0.15 • Published 3 years ago

notion-blocks-chakra-ui v0.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Parse Notion blocks into Chakra UI React components

Get started

npm install notion-blocks-chakra-ui

or

yarn add notion-blocks-chakra-ui

How to use

import { Stack } from '@chakra-ui/react';
import { NotionBlock } from 'notion-blocks-chakra-ui';

// fetch `blocks` from a Notion API call
<Stack>
  {blocks.map((block) => (
    <NotionBlock key={block.id} block={block} />
  ))}
</Stack>;

Images and video (unsupported by Notion API)

In order to parse images and video, because it is natively unsupported by Notion API, you need to add this kind of block in your Notion doc:

[image, <imageUrl>]
[video, <video>]
[youtube, <youtubeId>]

Custom image component

<NotionBlock
  block={block}
  customImage={{
    MyCustomComponent,
    props: {
      className: 'image',
    },
  }}
/>

Inspired by samuelkraft/notion-blog-nextjs

Here is my portofolio source code which uses this library

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.3

3 years ago

0.0.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago