Skip to main content
Handwritten reference for the controller surface. Mirrors the page order above.

Provider and hooks

Imported from superdoc/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 from superdoc/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, capture, restore, painted geometry.

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 from superdoc/ui. For the source of truth, the types ship with the superdoc package and are exported alongside the runtime values.