🚀 BlockNote AI is here! Access the early preview.
BlockNote Docs/React/Overview

Overview

Quick Start

The fastest way to get started with the React bindings is by using the useCreateBlockNote hook and BlockNoteView component:

import React from "react";
import {  } from "@blocknote/react";
import {  } from "@blocknote/mantine";
// Or ariakit, shadcn, etc.

function () {
  const  = ();

  return < ={} />;
}

That's it! You now have a fully functional editor with all the basic features like:

  • Text editing and formatting
  • Block types (paragraphs, headings, lists, etc.)
  • Toolbar for formatting options
  • Side menu for block operations

Examples

Adding Initial Content

You can start your editor with some predefined content:

function () {
  const  = ({
    : [
      {
        : "heading",
        : "Welcome to BlockNote",
        : { : 1 },
      },
      {
        : "paragraph",
        : "This is a paragraph with some text.",
      },
      {
        : "bulletListItem",
        : "This is a bullet point",
      },
    ],
  });

  return < ={} />;
}

Handling Changes

You can listen for changes in your editor content:

function () {
  const  = ();

  const  = (: <any, any, any>) => {
    // Get the current content as JSON
    const  = .;
    .("Content changed:", );
  };

  return < ={} ={} />;
}

Customizing the Appearance

You can customize the editor's appearance with themes and styling:

function () {
  const  = ();

  return (
    <
      ={{ : "1px solid #ccc", : "8px", : "16px" }}
    >
      <
        ={}
        ="dark"
        ={{ : "300px" }}
      />
    </>
  );
}

Next Steps

Now that you have a basic editor working, you can explore:

The editor is now ready to use! Start typing and explore the various block types and formatting options available in the toolbar.