Handwritten reference for the controller surface. Mirrors the page order above.Documentation Index
Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
Use this file to discover all available pages before exploring further.
Provider and hooks
Imported fromsuperdoc/ui/react.
<SuperDocUIProvider>
Holds one controller per editor mount. Wrap your app once.
useSetSuperDoc()
Returns the setter the editor mount component calls in onReady. Most components don’t use this directly.
useSuperDocUI()
Returns the controller, or null until ready.
useSuperDocCommand(id)
Subscribes to one command’s state. See Toolbar and commands.
useSuperDocSelection()
Returns the live selection slice. See Selection and viewport.
useSuperDocComments()
Returns the comments slice. See Comments.
useSuperDocTrackChanges()
Returns the tracked-changes slice. See Track changes.
useSuperDocDocument()
Returns the document slice. See Document control.
useSuperDocToolbar()
Returns the full toolbar snapshot. Re-renders on any command change. Prefer useSuperDocCommand per button when possible.
useSuperDocSlice(picker, initial)
Subscribe to any slice from ui.select(...). Use when the typed hooks above don’t cover what you need.
useSuperDocHost()
Returns the host SuperDoc instance. Reserved for operations the controller doesn’t bridge yet.
Controller handles
Imported fromsuperdoc/ui. The provider handles construction; you typically reach these through useSuperDocUI() + the typed hooks.
ui.commands
Built-in dispatch and custom-command registration.
ui.comments
Live snapshot, mutations, navigation.
ui.trackChanges
Live list, accept / reject, navigation.
ui.document
Mode, export, replace.
ui.selection
Live slice and capture.
ui.viewport
Geometry. Browser-only.
ui.toolbar
Aggregate toolbar surface. Mirrors the headless-toolbar shape.
payload is optional. Pass it for built-ins like font-size, font-family, and link that accept a value; omit it for togglable built-ins like bold or italic.
ui.select(selector, equality?)
Raw selector substrate underlying every domain handle.
ui.destroy()
Tears down every subscription. The provider calls this on unmount.
Types
Imported fromsuperdoc/ui.
| Type | Shape |
|---|---|
SuperDocUI | The controller. |
SuperDocUIState | The unified state model. |
SelectionSlice | useSuperDocSelection() return shape. |
SelectionCapture | Output of ui.selection.capture(). |
CommentsSlice | useSuperDocComments() return shape. |
TrackChangesSlice | useSuperDocTrackChanges() return shape. |
TrackChangesItem | { id, change }. |
DocumentSlice | useSuperDocDocument() return shape. |
ToolbarSnapshotSlice | useSuperDocToolbar() return shape. |
UIToolbarCommandState | Per-command state shape. |
CustomCommandRegistration | Input to ui.commands.register. |
CustomCommandRegistrationResult | Return from ui.commands.register. |
ScrollIntoViewInput | Input to ui.viewport.scrollIntoView. |
ViewportRect | Plain value rectangle returned by ui.viewport.getRect. |
superdoc package and are exported alongside the runtime values.
