Skip to content

Getting Started

BlockNote Databases is a front-end library for building Notion-like databases. A “database” is a collection of structured document metadata — rows with typed properties — displayed as a table, kanban, gallery, or other view. You bring your own data layer; the library handles rendering, editing, filtering, sorting, pagination, and undo/redo.

Terminal window
npm install @blocknote/block-view

The package ships multiple entry points. Import what you need:

Entry pointWhat it provides
@blocknote/block-view/coreData model, transactions, collection manager, property definitions
@blocknote/block-view/core/sources/in-memoryIn-memory data sources (no backend)
@blocknote/block-view/core/sources/restREST API data sources
@blocknote/block-view/reactReact hooks, cell adapters, TableView component
@blocknote/block-view/tableFramework-agnostic table abstraction
@blocknote/block-view/blocknoteBlockNote editor integration

A minimal table needs three things: data sources, a collection manager, and a table view.

import {
InMemoryCollectionSource,
InMemoryDocumentSource,
} from "@blocknote/block-view/core/sources/in-memory";
import {
defaultPropertyDefinitions,
TableView,
useCollectionManager,
useCollectionTableView,
} from "@blocknote/block-view/react";
import "@blocknote/block-view/react/styles.css";
import "@blocknote/block-view/react/adapters/styles.css";
// Your collection schema and documents (see Data Sources guide)
import { collectionData, documentsData } from "./my-data";
function MyTable({ manager, viewId }) {
const { table } = useCollectionTableView({
collectionManager: manager,
viewId,
propertyDefinitions: defaultPropertyDefinitions,
});
return <TableView table={table} editable />;
}
export default function App() {
const state = useCollectionManager({
collectionId: "my-collection",
user: "user-1",
initialize: async () => ({
collectionSource: new InMemoryCollectionSource(collectionData),
documentSource: new InMemoryDocumentSource(documentsData),
}),
});
if (state.status === "loading") return <p>Loading...</p>;
if (state.status === "error") return <p>Error: {state.error.message}</p>;
return <MyTable manager={state.manager} viewId={state.manager.views[0].id} />;
}

The key pattern: useCollectionManager returns a three-state result (loading | error | success). Once loaded, pass the CollectionManager to useCollectionTableView to get a table object, then render it with <TableView>.

Collection — The schema definition. Defines what properties (columns) exist, their types, and validation rules. One collection can have multiple views.

CollectionView — A presentation layer over a collection. Controls which columns are visible, their widths, filters, sorts, and manual row ordering.

Document — A single row. Contains property values as key-value pairs where every value is stored as a string (parsed at display time for CRDT compatibility).

Data Sources — Pluggable interfaces for loading and persisting data. Swap between in-memory, REST, Yjs (CRDT), or your own implementation without changing component code.

Transactions — All mutations go through a transaction system that enables undo/redo, debounced persistence, and automatic rollback on failure.