slash-editor
Components

Pages

Node views, header, tree, breadcrumb and backlinks for host-owned sub-pages.

These components render a PageStore. All except the node views work with no editor mounted. There is no isolated preview; see them together in the playground.

Node views

bunx --bun shadcn@latest add @slash-editor/page-node-views

SubPageNodeView and PageLinkNodeView render the subPage block and pageLink inline node. They read { store, onNavigate } from the kit's pages option, show the live title, and display a skeleton while loading and a "missing / in trash" state otherwise. Attach them with the nodeViews option:

pages: {
  store,
  currentPageId: pageId,
  onNavigate,
  nodeViews: {
    subPage: ReactNodeViewRenderer(SubPageNodeView),
    pageLink: ReactNodeViewRenderer(PageLinkNodeView),
  },
}
bunx --bun shadcn@latest add @slash-editor/page-header

Icon, cover and title for one page, rendered outside EditorContent. Edits go to store.update. Enter or ArrowDown in the title moves focus to the document start; ArrowUp at the document start moves it back.

PropTypeDescription
storePageStoreSource of the title, icon and cover.
pageIdstringPage to edit.
editorEditor | nullReceives focus on Enter/ArrowDown.
classNamestringMerged onto the root.

focusPageTitle() focuses the title input — call it after creating a page to start typing.

Page tree

bunx --bun shadcn@latest add @slash-editor/page-tree

A lazily expanded tree built on usePageTree; children load through store.listChildren on first expand and refresh when the store notifies.

PropTypeDescription
storePageStorePage directory.
activePageIdstring | nullHighlighted row.
rootIdstring | nullParent whose children are the top rows. Default null.
onNavigate(pageId: string) => voidCalled when a row is chosen.
onCreate() => voidCalled from the header's New page button.
defaultExpandedstring[]Ids expanded on first render.
classNamestringMerged onto the root.
bunx --bun shadcn@latest add @slash-editor/page-breadcrumb

Ancestors of a page, root first, built on useBreadcrumb.

PropTypeDescription
storePageStorePage directory.
pageIdstringLast crumb.
onNavigate(pageId: string) => voidCalled when a crumb is chosen.
classNamestringMerged onto the root.
bunx --bun shadcn@latest add @slash-editor/page-backlinks

Pages that reference this one, built on useBacklinks. Needs store.backlinks; renders nothing useful without it. See Backlinks for the index recipe.

PropTypeDescription
storePageStorePage directory.
pageIdstringPage whose referrers are listed.
onNavigate(pageId: string) => voidCalled when an entry is chosen.
classNamestringMerged onto the root.

On this page