Notebook
Full notebook with markdown and code blocks.
On this page
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | None | Stable ID for the notebook, so the host can address it |
title required | string | None | Notebook title |
description | string | None | Subtitle |
blocks required | readonly NotebookBlock[] | None | Content blocks |
notebooks | readonly { id: string; title: string }[] | None | Notebook list sidebar |
openTabs | readonly { id: string; title: string }[] | None | Open tab indicators |
metadata | {
environment?: string;
location?: string;
updatedAt?: string;
lastViewedAt?: string;
} | None | Metadata display |
actions | {
save?: ActionTarget | string;
select?: ActionTarget | string;
create?: ActionTarget | string;
delete?: ActionTarget | string;
duplicate?: ActionTarget | string;
import?: ActionTarget | string;
close?: ActionTarget | string;
} | None | Lifecycle 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;
};
};