Table View

A composable, editable data table with multiple layouts.

Features

  • Controlled or uncontrolled resources for rows, properties, and view state
  • Create, edit, duplicate, reorder, hide, and resize properties and rows
  • Sort, group, calculate, and bulk-edit selected rows
  • Table, List, Board, and Timeline layouts
  • Open rows in a center dialog, side pane, or full page
  • Built-in plugins for title, text, number, checkbox, select, multi-select, links, and dates

Installation

pnpm add @notion-kit/table-view

Requirements

TableView uses DEFAULT_PLUGINS when no plugins prop is supplied. When you provide plugins, include the plugin factories your properties use. Every table needs exactly one title property so rows have a label in every layout.

Examples

Uncontrolled Table

Use defaultData, defaultProperties, and defaultView when the table owns its state. These defaults are read once when the component mounts; remount with a different key to reset the table.

Controlled Table

Pass a resource and apply each callback's next value to keep it authoritative. Rows, properties, and view state can be controlled independently.

Do not switch a resource between controlled and uncontrolled during one mount.

Timeline layout

Set the layout to "timeline" and select a Date property for the timeline. The range can be daily, monthly, or quarterly.

const view = {
  layout: "timeline",
  timeline: {
    range: "monthly",
    datePropertyId: "due-date",
  },
};

<TableView
  defaultProperties={properties}
  defaultData={data}
  defaultView={view}
/>;

Custom cell plugins

Create a custom plugin when a property needs its own value display, editor, or configuration. A plugin that provides renderCellEditor also participates in bulk editing by default.

API Reference

TableView

PropTypeDescription
pluginsCellPlugin[]Plugin factories available to the table. Defaults to DEFAULT_PLUGINS.
dataRow[]Controlled rows resource.
defaultDataRow[]Initial rows for an uncontrolled table.
propertiesColumnDefsControlled properties resource.
defaultPropertiesColumnDefsInitial properties for an uncontrolled table.
viewPartialTableViewStateControlled layout and presentation state.
defaultViewPartialTableViewStateInitial view state for an uncontrolled table.
onDataChange(change) => voidReceives the next rows resource and its action.
onPropertiesChange(change) => voidReceives the next properties resource and its action.
onViewChange(change) => voidReceives the next view resource and its action.
getRowUrl(rowId: string) => stringReturns the URL used when opening a row in a new tab.
weekStartsOnWeekdaySets the first day of the week for date-based features.
defaultColumnPartial<ColumnDef>Overrides the default TanStack Table column options.
childrenReactNodeContent rendered inside the Table View provider.

TableViewState

FieldDescription
layoutThe active layout. Table, List, Board, and Timeline have dedicated renderers; other layout values currently use the table renderer.
lockedPrevents table edits while leaving existing rows navigable.
rowViewWhere an opened row appears: center, side, or full.
openedRowIdThe currently opened row, or null.
timelineOptional Timeline configuration containing range and datePropertyId.
pluginMethodsPersisted sorting, grouping, and group-sort choices for plugins.