@superdoc-dev/react includes full TypeScript support.
TypeScript usage
Exported types
| Type | Description |
|---|---|
SuperDocEditorProps | All props accepted by <SuperDocEditor> |
SuperDocRef | Ref type — use with useRef<SuperDocRef> |
CallbackProps | Callback props interface (onReady, onEditorCreate, etc.) |
DocumentMode | 'editing' | 'viewing' | 'suggesting' |
UserRole | 'editor' | 'viewer' | 'suggester' |
SuperDocUser | { name: string, email: string, image?: string } |
SuperDocModules | Module configuration object |
SuperDocConfig | Full SuperDoc configuration |
SuperDocInstance | The SuperDoc instance type |
Editor | ProseMirror editor instance type |
SuperDocReadyEvent | { superdoc: SuperDocInstance } |
SuperDocEditorCreateEvent | { editor: Editor } |
SuperDocEditorUpdateEvent | { editor: Editor } |
SuperDocContentErrorEvent | { error: Error, editor: Editor, documentId: string, file: File } |
SuperDocExceptionEvent | { error: Error } |
Framework integration
Next.js (App Router)
The wrapper handles SSR automatically. For additional control, usedynamic with ssr: false:
Next.js (Pages Router)
Vite / Create React App
Works out of the box:Troubleshooting
”document is not defined” (SSR)
The component handles SSR internally, but if you still see errors, use dynamic import:React Strict Mode double-mount
The component handles React 18 Strict Mode correctly. The internal cleanup flag prevents issues from double-invocation during development.Document not loading
- Verify the file is a valid
.docxdocument - Check that
documentprop is aFile,Blob, URL string, or config object - Listen for
onContentErrorevents for parsing errors
Changing document mode
The component handlesdocumentMode prop changes efficiently without rebuilding:

