Esc
Documentation
On this page

Props

PropTypeDefaultDescription
idstringNoneStable ID for the notebook, so the host can address it
title requiredstringNoneNotebook title
descriptionstringNoneSubtitle
blocks requiredreadonly NotebookBlock[]NoneContent blocks
notebooksreadonly { id: string; title: string }[]NoneNotebook list sidebar
openTabsreadonly { id: string; title: string }[]NoneOpen tab indicators
metadata{ environment?: string; location?: string; updatedAt?: string; lastViewedAt?: string; }NoneMetadata display
actions{ save?: ActionTarget | string; select?: ActionTarget | string; create?: ActionTarget | string; delete?: ActionTarget | string; duplicate?: ActionTarget | string; import?: ActionTarget | string; close?: ActionTarget | string; }NoneLifecycle actions

Example

ts
Notebook({
  title: "Analysis",
  blocks: [
    { id: "b1", kind: "markdown", content: "# Revenue Analysis" },
    { id: "b2", kind: "code", language: "sql", content: "SELECT 1", action: run() },
  ],
  actions: { save: saveNotebook(), create: createNotebook() },
})

Supporting types

NotebookBlock
export type NotebookBlock =
  | { id: string; kind: "markdown"; content: string }
  | {
      id: string;
      kind: "code";
      language: string;
      content: string;
      action: ActionTarget | string;
      result?: {
        columns: { name: string; type?: string }[];
        rows: Record<string, unknown>[];
        elapsedMs?: number;
        rowsChanged?: number;
      };
    };

View the source on GitHub