The provider holds one controller per editor mount. Components read it throughDocumentation Index
Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
Use this file to discover all available pages before exploring further.
useSuperDocUI() and the per-domain hooks. Drop your toolbar, sidebar, and review components anywhere inside the provider.
Install
Wire the provider
Wrap your app in<SuperDocUIProvider>. Mount <SuperDocEditor> somewhere inside. Hand the SuperDoc instance to the provider on onReady.
hideToolbar and contained keep <SuperDocEditor> from rendering its built-in toolbar or claiming the page. Your components own the layout.
Read state from a hook
Hooks return live state. The component re-renders only when the slice it subscribed to changes.What’s available
| Hook | Returns | Use it for |
|---|---|---|
useSuperDocUI() | The controller, or null until ready | Calling ui.commands.get(id)?.execute() and other actions |
useSuperDocCommand(id) | { active, disabled, value, source } | Binding one toolbar button to one command |
useSuperDocComments() | The live comments feed | Building a comments sidebar |
useSuperDocTrackChanges() | The live tracked-changes feed | Building a track-changes review panel |
useSuperDocSelection() | The current selection slice | Enabling/disabling buttons, building bubble menus |
useSuperDocDocument() | { ready, mode } | Mode toggles, “ready” guards |
useSuperDocSlice(picker, initial) | Any slice from ui.select(...) | Custom subscriptions the typed hooks don’t cover |
useSuperDocHost() | The host SuperDoc instance | Operations the controller doesn’t bridge yet |
useSetSuperDoc() | The setter the editor mount calls in onReady | Only the editor mount component |
What the provider does
createSuperDocUI({ superdoc }) runs once when the editor reports ready. It tears down on unmount. You don’t manage the lifecycle.
Common pitfalls
Built-in UI overlapping with yours
Built-in UI overlapping with yours
Set
modules: { comments: false } on <SuperDocEditor> to disable SuperDoc’s built-in comment bubble. Same pattern for modules: { trackChanges: { ... } } if you want the engine without rendering. The Document API and exports keep working either way.Ready vs not-ready states
Ready vs not-ready states
useSuperDocUI() returns null between mount and onReady. Hooks downstream (useSuperDocCommand, useSuperDocComments, etc.) return their fallback states during that window. Your buttons render disabled, your sidebar shows empty. No flicker, no errors.Multiple editors
Multiple editors
One
<SuperDocUIProvider> holds one controller. If you render two editors on a page, give each its own provider.
