> Every Taji docs page as Markdown: https://docs.taji.is/llms.txt

# Write a pane

You build `memo`, a plugin whose pane shows a node its Python process writes, place the pane right of a desk's chart, and see it in Taji's window. You need a checkout [built from source](https://docs.taji.is/guide/install.md), whose `make setup` lays Taji's Python in `.python`, and the page, the window and the kernel built in this order (the kernel embeds `ui/dist`):

```sh
pnpm --filter @taji/ui build
pnpm --filter @taji/window build
cargo build -p taji-open
```

A pane is a React component that a plugin's `<dir>/ui/plugin.tsx` default-exports through `definePlugin` from `@taji/plugin`. Taji's window draws it in a frame, a page of its own. What the package exports, the frame's rules and the theme's tokens are [the window reference](https://docs.taji.is/plugins/window.md).

## 1. Declare the pane

Make a directory named for the plugin's id and write its manifest:

```toml file="examples/pane/memo/taji-plugin.toml" title="taji-plugin.toml"
id = "memo"
name = "Memo"
version = "0.1.0"
taji = ">=0.7, <0.8"

[process]
run = ["memo.py"]
python = {}

[[kernel.verbs]]
route = "memo/write"
name = "memo_write"
description = "Write the memo the Memo pane shows."
schema = { type = "object", properties = { text = { type = "string" } }, required = ["text"] }
scopes = ["local", "agent", "page"]

[[kernel.nodes]]
path = "memo"
description = "the memo the Memo pane shows"

[[ui.panes]]
kind = "memo.view"
label = "Memo"
reads = ["/read/memo"]
```

1. **`[process]`** runs `memo.py` on Taji's Python ([Build your first plugin](https://docs.taji.is/plugins/first-plugin.md)).
2. **`[[kernel.verbs]]`** declares `memo/write`, which sets the memo.
3. **`[[kernel.nodes]]`** declares `memo`, which anyone reads at `GET /read/memo`.
4. **`[[ui.panes]]`** declares the pane: its `kind`, `<plugin id>.<word>`, its title, and `reads`, the routes it reads. Every key: [the manifest reference](https://docs.taji.is/plugins/manifest.md).

## 2. Write the program

```python file="examples/pane/memo/memo.py" title="memo.py"
import taji

p = taji.plugin()


@p.verb("memo/write")
def write(args, bindings):
    p.set("memo", {"text": args["text"]})
    return {"wrote": args["text"]}


p.run()
```

1. **`@p.verb("memo/write")`** handles the verb the manifest declares.
2. **`p.set("memo", …)`** sets the node the pane reads, and the return value is the verb's answer.

## 3. Write the pane

Put it in the plugin's directory as `plugin.tsx` in a `ui/` of its own:

```tsx file="examples/pane/memo/ui/plugin.tsx" title="ui/plugin.tsx"
import { definePlugin, useNode } from "@taji/plugin";

function Memo() {
  const memo = useNode<{ text: string }>("memo");
  return <p style={{ padding: 12 }}>{memo.data?.text ?? "No memo yet"}</p>;
}

export default definePlugin({ id: "memo", panes: [{ kind: "memo.view", label: "Memo", Icon: () => <i />, Body: Memo }] });
```

1. **`useNode("memo")`** reads `GET /read/memo`, and reads it again each time the node changes. Until the first answer, `data` is `undefined`.
2. **`definePlugin`** names the plugin and its panes. Its `id` and its panes say what `[ui]` of `taji-plugin.toml` says, or the window refuses the frame.

## 4. Pack the pane

Copy the plugin into a plugins directory and pack its window half:

```sh
W=$(mktemp -d)
mkdir -p "$W/plugins" && cp -R docs/plugins/examples/pane/memo "$W/plugins/"
bun run ui/pack.ts "$W/plugins/memo"
```

`index.js` appears beside `plugin.tsx`: `ui/pack.ts` bundles the pane with React and `@taji/plugin` into the one file the kernel serves the frame from. `--watch` repacks on each change, so reopening the pane loads the new bundle. A pane that imports `@taji/plugin/window` or `@taji/plugin/host` does not pack.

## 5. Write the memo and place the pane

Define `boot`, `get` and `v` as in [Build your first plugin](https://docs.taji.is/plugins/first-plugin.md#4-boot-a-kernel-with-your-plugin), run `boot`, then write the memo:

```sh
v memo/write '{"text":"hello from the wire"}'
```

```json file="examples/pane/write.json"
{
  "wrote": "hello from the wire"
}
```

Place the pane right of the desk's chart:

```sh
DESK=$(get "" | jq -r .active)
CHART=$(get read/desk/$DESK/layout | jq .chart_pane_id)
v desk/$DESK/layout/add_pane "{\"anchor_pane_id\": $CHART, \"position\": \"right\", \"kind\": \"memo.view\"}"
```

You see the new pane's id in `pane_ids`:

```json file="examples/pane/pane.json"
{
  "node": "desk/01a23da4-24cb-755e-9414-21efcd6c19d6/layout",
  "pane_ids": [
    8
  ]
}
```

- `position` is `left`, `right` (the default), `above` or `below`, each halving the anchor's stack, or `tab`, joining it.
- The kernel takes `memo.view` because an enabled plugin declares it.

## 6. Open the window

```sh
TAJI_WIRE=$PORT target/debug/taji ui
```

A first run opens on the welcome: press Continue. The desk shows the Memo pane right of the chart:

![The Memo pane in Taji's window, headed Memo, saying hello from the wire](https://raw.githubusercontent.com/TajiAI/Taji/main/docs/plugins/examples/pane/shot.png)

*Captured 2026-12-03 on a keyless headless kernel, in Taji's window.*

- Write the memo again with `v memo/write`, and the pane redraws with the new text.
- `engine/crates/taji/scripts/frame_gate.sh` holds installed panes' frames to the floor in Taji's window.

Stop the kernel, which closes the window:

```sh
v ui/quit '{}'
wait
rm -rf "$W"
```

## Draw a chart with no backend

A pane that draws rows Taji already serves needs no process. `plugin new --pane` writes a window-only plugin, and `plugin check` draws its pane from `fixtures/` with no kernel. Run these from your checkout, since `check`'s `pane` step says `SKIP` anywhere else:

```sh
target/debug/taji plugin new toy --pane
target/debug/taji plugin check toy --bless
target/debug/taji plugin check toy
```

You see `PASS manifest` and `PASS pane (blessed map)`, then `PASS manifest` and `PASS pane`, each run exiting 0. `toy/golden/pane.map.png` is the pane as `check` drew it in a 960 by 600 window: open it before you commit it, since `--bless` accepts whatever the pane drew. `toy` holds `taji-plugin.toml`, `plugin.tsx` under `ui/`, `fixtures/screener.jsonl`, `AGENTS.md`, `README.md` and `.gitignore`, and no `[process]`: `taji plugin dev` refuses it, and a kernel refuses it under `TAJI_PLUGINS`, where a plugin runs as a process. The manifest grants the `screener` product and declares one pane that reads it:

<!-- scaffold: pane/taji-plugin.toml.tmpl -->
```toml
id = "toy"
name = "toy"
version = "0.1.0"
taji = ">=0.7, <0.8"

[grants]
reads = ["screener"]

[[ui.panes]]
kind = "toy.map"
label = "Map"
reads = ["/get/screener"]
```

The pane reads the screener, turns its rows into columns and hands `Chart` a function that draws them as a treemap:

<!-- scaffold: pane/plugin.tsx.tmpl -->
```tsx
// `toy.map`: the screener's most active equities as a treemap, sized by volume and coloured by the day's change.
import { useMemo } from "react";
import { definePlugin, useRows } from "@taji/plugin";
import { Chart, treemap, type Units } from "@taji/plugin/chart";
import { columnsOf } from "@taji/plugin/layer";

type Row = { symbol: string; volume: number; change_pct: number };
const UNITS: Units<Row> = { volume: "shares", change_pct: { unit: "percent", signed: true } };

function Map() {
  const { data, error } = useRows("screener", "class=equity&list=share_volume_leaders");
  const rows = useMemo(() => columnsOf(data?.rows ?? [], ["volume", "change_pct"], [], ["symbol"]), [data]);
  if (error) return <p data-eid="toy.map.error">{error.message}</p>;
  return (
    <Chart
      label="Most active equities"
      rows={rows}
      shapes={(size, tokens) => treemap(rows, { size: "volume", colour: "change_pct", labels: ["symbol", "change_pct"] }, size, tokens)}
      tip={["symbol", "volume", "change_pct"]}
      units={UNITS}
    />
  );
}

export default definePlugin({
  id: "toy",
  panes: [{ kind: "toy.map", label: "Map", Icon: () => <i />, Body: Map }],
});
```

`fixtures/screener.jsonl` is what `check` serves in place of the screener: line 1 is `{"item": "<class>:<symbol>"}`, then a batch `{"knowable_utc", "rows"}` a line, the rows as `GET /get/<product>` answers them. That route's columns are `paths./get/<product>.get.x-taji.columns` in `schema/wire.json`; a Decimal cell is a string of digits and a List cell a JSON array. `check` draws the newest batch.

What `Chart` draws and gives you, how `shapes`, `treemap`, `units` and `columnsOf` work: [Draw with `Chart`](https://docs.taji.is/plugins/window.md#draw-with-chart).

### What `check` says

`FAIL pane: <what> — <fix>` names its fix. Each is one of these:

- The pack failed: `packing ui/plugin.tsx failed: <line>`. Run the `bun run ui/pack.ts` it prints and read the error. A pane that imports `@taji/plugin/window` or `@taji/plugin/host` does not pack.
- `<word>: the host refused its frame`: `definePlugin`'s `id`, `panes` or `items` disagree with `[ui]` of `taji-plugin.toml`.
- `fixtures/<product>.jsonl: …`: a product in `[grants] reads` has no fixture, or it is not in the form above.
- `<kind>'s frame did not greet its host in 12 s`: the pane threw before it said hello, or the window compiles in a pane of this kind ([Compiled-in panes](#compiled-in-panes)) and drew it in the page, so no frame mounted. The saved picture may still look right.
- `<word>'s Chart states "rects": 0`: no row has a size above 0. Fix the fixture or `shapes`.
- `<word> has no golden/pane.<word>.png`, or it differs: look at `target/check/pane/<word>.png`, and if the picture is meant, run `check --bless` and commit `golden/`.

`PASS pane` holds the pane's frame, its rects and its picture, not a run on a kernel.

## Compiled-in panes

The window's own panes (`chart`, `ladder`, `book` and `watchlist`, and those of the options, reference, screener and calendar plugins) are compiled into its build instead: `ui/plugins.vite.ts` imports every `plugins/*/ui/plugin.tsx` with no `taji-plugin.toml` beside `ui/` (and each repo path `TAJI_UI_PLUGINS` names, colon-separated); a plugin with a manifest, in `plugins/` or not, draws in a frame. Such a pane draws in the page itself, with no frame and no floor, and may import `@taji/plugin/window` and `@taji/kit`.

A compiled-in plugin adds a kind through its manifest: `[[ui.panes]]` rows of `kind` (`<plugin id>.<word>`) and `label`, and a `Pane` of that kind in its `plugin.tsx`. Its row then carries no `ui` and no frame is served; an `icon`, `reads` or `[[ui.items]]` fails the boot, since the rest is compiled into the window. The kernel takes the kind while the plugin is enabled. A bare word is still the kernel's own (`PaneKindRecord` in `engine/crates/taji-pane-layout/src/persist.rs`). A `Page` with `pane` set opens that kind from the left bar ([the window reference](https://docs.taji.is/plugins/window.md#panes-and-slots)); `ui/mock/app/page.tsx` is the example, and `engine/crates/taji/scripts/plugin_gate.sh` builds `ui/walk/hello.tsx`, a page that is a view, with `TAJI_UI_PLUGINS`.

## On a phone

A paired phone draws the one pane in front, as wide as the screen. An installed frame is told nothing more: size its targets under `@media (pointer: coarse)` at 44px and 8px apart, and its inputs at 16px or more, or Safari zooms in. A compiled-in pane reads the phone with `useCompact` (`packages/kit/shell/compact.ts`) and puts a menu of many acts, a form or a confirm in the kit's `PhoneSheet` (`packages/kit/ui/Sheet.tsx`); [the UI rules](https://docs.taji.is/contribute/ui.md) hold the touch rules.

## If it fails

- **The plugin's row in `GET /read/plugins` says `its [ui] is declared and ui/index.js is missing`.** The pane is not packed: run the `bun run ui/pack.ts` it names, then boot again.
- **`add_pane` answers `409` `declined`, `memo.view is not a pane kind of an enabled plugin`.** No enabled plugin declares the kind: read the plugin's row in `GET /read/plugins` for its `reason`.
- **`add_pane` answers `404` `unknown_pane`.** The anchor is not a pane of that desk: read its `chart_pane_id` again.
- **`add_pane` answers `409` `no_room`.** A half of the anchor's stack would fall under its panes' least size in the canvas's 24 lines: anchor on a larger pane, or use `tab`.

## Next

- [The window reference](https://docs.taji.is/plugins/window.md): every export, the slots, the frame's floor and the theme's tokens.
- [The manifest reference](https://docs.taji.is/plugins/manifest.md): `[ui]` and its rows.
- [Pack and install a plugin](https://docs.taji.is/plugins/publish.md) from a signed registry.
