Skip to Content

Component Props

The Theodore component requires an editorState prop. All other component-specific props are optional.

PropRequiredPurpose
editorStateYesHolds the editor content, selection, and undo history
theodoreRefNoExposes imperative editor methods
refNoReferences the editable div
renderEmojiNoRenders emoji with custom React elements
placeholderNoShows content while the editor is empty
suggestionNoDisplays inline ghost text
suggestionHintNoCustomizes or hides the suggestion hint
defaultDirectionNoSets the fallback text direction
maxLinesNoLimits the editor’s visible height
shouldSuppressFocusNoPrevents the native keyboard from opening
classNameNoStyles the editable element
wrapperClassNameNoStyles the outer wrapper
placeholderClassNameNoStyles a string placeholder

editorState

Type: EditorState · Required

The editor state created by useEditorState(). Theodore uses it to manage content, selection, and undo history.

Related: Editor State

theodoreRef

Type: React.Ref<TheodoreHandle> · Default: undefined

Exposes Theodore’s imperative methods, such as inserting emoji, replacing content, and resetting the editor.

Related: TheodoreRef

ref

Type: React.Ref<HTMLDivElement> · Default: undefined

A forwarded ref to the contentEditable element. Use it when you need direct access to the underlying DOM element.

renderEmoji

Type: (emoji: string) => ReactElement · Default: native emoji text

Called with each recognized emoji value. Return the React element Theodore should render, typically a single <img />. Without this prop, emoji remain native text.

Related: Rendering Custom Emojis

placeholder

Type: string | React.ReactNode · Default: undefined

Content shown while the editor is empty. A string receives Theodore’s default placeholder styling and animation. Other React nodes are rendered directly.

suggestion

Type: string · Default: undefined

Inline ghost text displayed at the current selection. The suggestion remains separate from the plain text content until it is accepted.

Related: Rendering Inline Suggestions

suggestionHint

Type: React.FC<SuggestionHintProps> | null · Default: Theodore’s built-in hint

A component rendered after an inline suggestion. It receives the text direction and an acceptSuggestion callback. Pass null to hide the hint.

Related: Suggestion Hint

defaultDirection

Type: 'ltr' | 'rtl' · Default: 'ltr'

The fallback text direction for an empty paragraph or one beginning with a non-text node. When a paragraph begins with text, Theodore infers its direction from the first character.

maxLines

Type: number · Default: unlimited

The maximum number of lines the editor can grow to. Additional content makes the editor scrollable. Values less than or equal to zero do not set a maximum height.

shouldSuppressFocus

Type: boolean · Default: false

When true, Theodore blurs the editor whenever it receives focus. Use this on mobile while a custom emoji picker is open to prevent the native keyboard from appearing at the same time.

className

Type: string · Default: undefined

Adds a CSS class to the contentEditable element.

wrapperClassName

Type: string · Default: undefined

Adds a CSS class to the outer wrapper around the contentEditable element.

placeholderClassName

Type: string · Default: undefined

Adds a CSS class to Theodore’s placeholder element when placeholder is a string. It does not apply when you provide a custom React node.

Native HTML Props

Most other div attributes and event props are forwarded to the contentEditable element, including aria-*, data-*, style, onFocus, and onBlur.

The contentEditable, onKeyDown, onPaste, and onCut props are not accepted because Theodore manages them internally.

Last updated on