Installation
Basic Usage
Vanilla JavaScript
React
Vue
Configuration Options
HTMLElement
required
The DOM element that contains your menu.Default:
nullPluginKey | string
The plugin key for the floating menu.Default:
'floatingMenu'number
The delay in milliseconds before the menu position should be updated. This can be useful to prevent performance issues.Default:
250number
The delay in milliseconds before the menu position should be updated on window resize.Default:
60function
A function that determines whether the menu should be shown or not. The default implementation shows the menu when the cursor is in an empty text block at the root level.Parameters:
editor: The editor instanceview: The ProseMirror EditorViewstate: The current editor stateoldState: The previous editor state (optional)from: Selection start positionto: Selection end position
- Shows when editor has focus
- Selection is empty (cursor, not range)
- Cursor is at root depth (depth === 1)
- Current block is empty text block
- Editor is editable
HTMLElement | (() => HTMLElement)
The DOM element to append your menu to. Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.Default: Editor’s parent element
object
Configuration options passed to Floating UI for positioning. See Floating UI documentation for full details.Properties:
'absolute' | 'fixed'
Positioning strategy.Default:
'absolute'string
Menu placement relative to cursor. Options:
'top', 'right', 'bottom', 'left', 'top-start', 'top-end', 'right-start', 'right-end', 'bottom-start', 'bottom-end', 'left-start', 'left-end'Default: 'right'number | object | boolean
Distance in pixels from the cursor.Default:
8object | boolean
Whether to flip the menu to the opposite side if there’s not enough space.Default:
{}object | boolean
Whether to shift the menu along the axis to keep it in view.Default:
{}HTMLElement | Window
The scrollable element that should be listened to when updating the position.Default:
window() => void
Callback fired when the menu is shown.
() => void
Callback fired when the menu is hidden.
() => void
Callback fired when the menu position is updated.
() => void
Callback fired when the menu is destroyed.
Commands
Manually update the position of the floating menu.
React Component Props
When using the React component, you can pass these props:Editor
The editor instance. Can be omitted if used inside
EditorProvider.string
The plugin key.Default:
'floatingMenu'number
Update delay in milliseconds.
number
Resize delay in milliseconds.
function
Function to determine visibility.
object
Floating UI configuration options.
Vue Component Props
Editor
required
The editor instance.
string
The plugin key.Default:
'floatingMenu'number
Update delay in milliseconds.
number
Resize delay in milliseconds.
function
Function to determine visibility.
object
Floating UI configuration options.
HTMLElement | Function
Element to append the menu to.