API reference
Every prop on EditorProvider and ConfigurableEditorWithAuth, with the types you can rely on.
Last updated
EditorProvider
Provides context and configuration for the editor. Wrap EditorProvider around the editor component to enable all features.
| Prop | Type | Description |
|---|---|---|
| children | ReactNode | The wrapped content. |
| defaultFontFamilies | string[] | Override the default font list. |
| currentUser | CurrentUser | User info for comments. |
| apiKey | string | API key for read-only mode. |
ConfigurableEditorWithAuth
The core editor component with built-in subscription verification and AI service integration.
| Prop | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Required | Your Eddyter license key. Authenticates the editor against the server and unlocks tier-based features. |
| initialContent | string | Optional | Initial HTML loaded into the editor on first render. |
| onChange | (html: string) => void | Optional | Called ~300 ms after content changes (debounced). Receives the current HTML. |
| onAuthSuccess | () => void | Optional | Fires once the API key is verified and the editor is ready. |
| onAuthError | (error: string) => void | Optional | Fires when API key verification fails. Receives the error message. |
| customVerifyKey | (apiKey: string) => Promise<ApiResponse> | Optional | Provide your own verifier (e.g. proxy through your backend) instead of the default endpoint. |
| mode | "edit" | "preview" | Optional | Render the full editor ("edit", default) or a read-only preview with link previews ("preview"). |
| containerClassName | string | Optional | Class applied to the outer wrapper container. |
| contentClassName | string | Optional | Class applied specifically to the editor's writable content area. |
| onPreviewClick | () => void | Optional | Fires when the user clicks inside preview mode — typically used to switch to edit mode. |
| darkMode | boolean | undefined | Optional | true forces dark, false forces light, undefined (default) auto-detects from the host app's <html>/<body> dark class. |
| toolbar | { mode?: "sticky" | "static"; offset?: number; zIndex?: number } | Optional | Toolbar behaviour config. Defaults to { mode: "sticky", offset: 20, zIndex: 1000 }. |
| editor | { maxHeight?: string | number } | Optional | Container options. maxHeight only applies when toolbar.mode = "static" — caps the editable area's height. |
| defaultFontFamilies | string[] | Optional | Override the font picker list. Defaults to the 24 fonts in defaultEditorConfig.defaultFontFamilies. |
| uiFontFamily | string | Optional | Font for the editor's UI chrome — toolbar labels, menus, dialogs, sidebars — so it matches your app's typography. Does not change document content (that's the font picker). Google Fonts families are fetched automatically; a font your page already loads is used as-is. Defaults to Geist. |
| contentFontFamily | string | Optional | Starting font for the document text, shown as selected in the font picker. A default, not a lock — the user can pick another font and their choice wins. Applies to newly typed text; existing content without its own font stays on DM Sans. Not to be confused with defaultFontFamilies, which is the list of fonts offered. |
| mentionUserList | string[] | Optional | Usernames available to the @mentions autocomplete. |
| className | string | Optional | Class on the outer wrapper element. |
| fitToPage | boolean | Optional | Full-page layout. The toolbar sticks to the top of the window, the content is centred like a document page, and the word count floats in the bottom corner. Use this layout when the editor is the main content on the page. If used in a modal, the modal must contain only the editor, with no additional content. Defaults to false. |
| uiStyle | "default" | "compact" | Optional | Visual style of the editor. Omit it for the default style. Set "compact" to render the toolbar and content as one framed card; layout and behavior are unchanged. |
| documentId | string | Optional | Stable id that scopes version history to this document — pass your record's primary key and reuse it on reopen so history reconnects. If omitted, a best-effort id is derived from the URL (warns; breaks if the URL changes). |
| ref | React.Ref<EddyterEditorHandle> | Optional | Imperative handle for version history. Call ref.current.saveVersion({ label?, documentId? }) from your Save button to snapshot a version (server-backed, plan-gated). Call it while the editor is still mounted — it no-ops after unmount. |
Was this page useful?