Cell plugins
API reference for custom Table View property types.
A property type pairs a data plugin with a React adapter. For a working example, see Create a cell plugin.
Registration
Register both parts with the same ID. Keep DEFAULT_PLUGINS to use the
built-in property types alongside your own.
const plugins = {
data: [...DEFAULT_PLUGINS.data, effort],
ui: [...DEFAULT_PLUGINS.ui, effortUi],
};
<TableView plugins={plugins} />;Each ID must occur once in each list.
API reference
Data plugin definition
Import CellPlugin<Key, Data, Config> from @notion-kit/table-hook/plugins.
Prop
Type
UI adapter definition
Import TableUiPlugin<TPlugin> from @notion-kit/table-view.
Prop
Type
Use cell.getInfo(), cell.getData(), and cell.update() in a cell
renderer. In a bulk editor, pass column.getSelectedRowIds() to
column.updateCells(ids, value). In a configuration menu, use
column.updateConfig().
Read-only history renderers
renderReadOnlyValue receives the stored value and config as unknown,
the historical property snapshot, and a textValue string. Validate the
snapshot before rendering. The edit log shows textValue when the adapter
has no renderer or rendering fails.
import { z } from "zod";
import type { ReadOnlyValueProps } from "@notion-kit/table-view";
const effortValue = z.enum(["Small", "Large"]);
function renderReadOnlyValue({ value, textValue }: ReadOnlyValueProps) {
const result = effortValue.safeParse(value);
return result.success ? result.data : textValue;
}Add the renderer to the UI adapter to use it in edit logs.