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 bubble menu.Default:
'bubbleMenu'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. If this function returns
false, the menu will be hidden, otherwise it will be shown.Parameters:editor: The editor instanceelement: The menu elementview: The ProseMirror EditorViewstate: The current editor stateoldState: The previous editor state (optional)from: Selection start positionto: Selection end position
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
() => VirtualElement | null
A function that returns the virtual element for the menu. This is useful when the menu needs to be positioned relative to a specific DOM 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 selection. Options:
'top', 'right', 'bottom', 'left', 'top-start', 'top-end', 'right-start', 'right-end', 'bottom-start', 'bottom-end', 'left-start', 'left-end'Default: 'top'number | object | boolean
Distance in pixels from the selection.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 of the bubble menu.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.
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:
'bubbleMenu'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 | Object
The plugin key.Default:
'bubbleMenu'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.
function
Function to get the virtual element for positioning.