Skip to content
TrademarkTrademark
Docs
Modules

Workspace

Updated: November 14, 2026
View on GitHub
Soon
Not released yet. The published package does not include this yet, so it will not install today.

An assistant that does work answers with cards, not paragraphs. A card opens what it is about beside the conversation, where the person watches it change and can take over in the real editor at any point. ActionCard is the card, useWorkspace holds the open tabs, and WorkspacePanel draws them.

The workspace never knows what a tab holds: each tab carries your own data, and you draw its preview and its editor.

ActionCard

One frame for every result: an icon for the kind of thing, a title, a status on the right, a body and a footer of actions. When the assistant proposes a write (publish, send, schedule), put it in the footer as the one primary button, so nothing happens until the person presses it. With onPreview, the header gets an eye button that opens the card's subject in the workspace.

Type
Default
icon
The kind of thing the card is about.
IconName—
titlerequired
What the card is about, in one line.
ReactNode—
meta
Right of the title: a status Tag or a count.
ReactNode—
children
The card's body.
React.ReactNode—
footer
Buttons, right-aligned. A proposed write is its one primary button.
ReactNode—
onPreview
Opens the card's subject in the workspace; shows an eye button.
() => void—
previewLabel
The preview button's name.
stringPreview
…and every FlexProps propinherited—

useWorkspace

The open tabs as state. A tab is keyed by what it shows (site:42), so opening the same thing twice refreshes one tab instead of adding a second. Each tab's version goes up on every refresh and whenever it leaves its editor, and WorkspacePanel remounts the preview with it. An open editor keeps its version, so a refresh never throws away unsaved edits. Past maxTabs (8), the oldest tab that is not in front closes.

The reducer, workspaceReducer, is exported too, for an app that keeps the tabs in its own store or on the server.

WorkspacePanel

The tab strip, a header with the active tab's title and status, a Preview / Edit switch for tabs with editable, a Full editor link from editorHref, and the tab itself from children. Switching to Edit expands the workspace, so the editor gets the room; on a phone, the expand button shows one panel at a time. Arrow keys move between tabs and Delete closes the one in focus.

Type
Default
workspacerequired
From useWorkspace().
WorkspaceController<T>—
childrenrequired
Draws the active tab: its preview, or with mode "edit" its editor.
React.ReactNode—
tabIcon
The icon in front of each tab's title.
(tab: WorkspaceTab<T>) => IconName | undefined—
meta
Beside the title in the header: a status tag.
(tab: WorkspaceTab<T>) => ReactNode—
tools
More header controls, before the Preview / Edit switch.
(tab: WorkspaceTab<T>, mode: WorkspaceTabMode) => ReactNode—
editorHref
Where the tab's full editor lives. Left out, no Full editor link.
(tab: WorkspaceTab<T>) => string | undefined—
expandToggle
The expand button: on phones only (the default), always, or never.
booleanphone
phone
expandOnEdit
Switching to Edit expands the workspace.
booleantrue
labels
Replaces the panel's words, for another language.
Partial<WorkspacePanelLabels>—
empty
Drawn when no tab is open.
ReactNode—
…and every FlexProps propinherited—

useElementPicker

Lets the person point at part of a preview so the next message is about it: "make this shorter" then knows what "this" is. Arm it with setPicking(true) from a pointer button: the cursor turns into the select cursor (an arrow with a dashed box, selectCursor(accent), or any CSS cursor through cursor) over the whole page, links included, blocks outline under the pointer, a click picks one, Escape cancels. On a page built from <section> elements it picks the outermost section and reports its position (index of total) and heading; on a page without sections it picks a single heading, paragraph, image or link. The picked block stays outlined until clear().

The frame must be same-origin. A cross-origin frame cannot be reached, and arming does nothing there. Without React, armElementPicker(document, options) arms one pick on any document and returns the cleanup.

Edit this page on GitHub