Pre-built menus
Drop-in menus for common use cases. Each one handles its own trigger logic and plugin key.BubbleMenu.Default
Text formatting toolbar that appears on text selection.Items to hide. Options:
'bold', 'italic', 'underline',
'strike', 'code', 'uppercase', 'align-left', 'align-center',
'align-right', 'node-selector', 'link-selector'.Node types that prevent the menu from showing (e.g.,
'codeBlock', 'button').Mark types that prevent the menu from showing (e.g.,
'link').Position relative to the selection.
Distance from the selection in pixels.
Called when the bubble menu is hidden.
BubbleMenu.LinkDefault
Link editing menu that appears when clicking a link.Actions to hide from the toolbar.
Position relative to the link.
Distance from the link in pixels.
Called when the bubble menu is hidden.
Custom URL validator. Return the valid URL string or
null.Called after a link is applied.
Called after a link is removed.
BubbleMenu.ButtonDefault
Button link editing menu that appears when clicking a button.LinkDefault (except excludeItems).
BubbleMenu.ImageDefault
Image editing menu that appears when clicking an image.Actions to hide.
Position relative to the image.
Distance from the image in pixels.
Called when the bubble menu is hidden.
Combining menus
A typical email editor uses multiple bubble menus together. UsehideWhenActiveNodes and hideWhenActiveMarks
to prevent overlapping menus:
Compound components
Build fully custom menus using the compound API.BubbleMenu.Root
Base container for all custom bubble menus. Provides editor context to children.Controls when the menu is visible. Defaults to showing on text selection.
Use
bubbleMenuTriggers for common patterns.Unique key for the ProseMirror plugin backing this menu. Required when
rendering multiple
BubbleMenu.Root instances to avoid collisions.
Import PluginKey from @tiptap/pm/state.Node types that prevent the menu from showing.
Mark types that prevent the menu from showing.
Position relative to the selection.
Distance from the selection in pixels.
Called when the bubble menu is hidden.
bubbleMenuTriggers
Factory for commonshouldShow functions:
| Trigger | Description |
|---|---|
bubbleMenuTriggers.textSelection(hideNodes?, hideMarks?) | Show on text selection. This is the default. |
bubbleMenuTriggers.node(name) | Show when a specific node type is active (e.g., 'button', 'image') |
bubbleMenuTriggers.nodeWithoutSelection(name) | Show when a node is active but no text is selected (e.g., 'link') |
Text formatting items
| Component | Description |
|---|---|
BubbleMenu.ItemGroup | Visual grouping of items |
BubbleMenu.Separator | Divider between groups |
BubbleMenu.Bold | Bold toggle |
BubbleMenu.Italic | Italic toggle |
BubbleMenu.Underline | Underline toggle |
BubbleMenu.Strike | Strikethrough toggle |
BubbleMenu.Code | Inline code toggle |
BubbleMenu.Uppercase | Uppercase toggle |
BubbleMenu.AlignLeft | Left alignment |
BubbleMenu.AlignCenter | Center alignment |
BubbleMenu.AlignRight | Right alignment |
BubbleMenu.NodeSelector | Block type dropdown |
BubbleMenu.LinkSelector | Link add/edit popover |
Link components
| Component | Description |
|---|---|
BubbleMenu.LinkToolbar | Wrapper — hides when editing mode is active |
BubbleMenu.LinkEditLink | Button that enters editing mode |
BubbleMenu.LinkUnlink | Removes the link |
BubbleMenu.LinkOpenLink | Opens the link in a new tab |
BubbleMenu.LinkForm | Inline form for editing link URLs |
Button components
| Component | Description |
|---|---|
BubbleMenu.ButtonToolbar | Wrapper — hides when editing mode is active |
BubbleMenu.ButtonEditLink | Button that enters editing mode |
BubbleMenu.ButtonUnlink | Removes the button link |
BubbleMenu.ButtonForm | Inline form for editing button URLs |
Image components
| Component | Description |
|---|---|
BubbleMenu.ImageToolbar | Wrapper — hides when editing mode is active |
BubbleMenu.ImageEditLink | Button that enters editing mode |
Custom menu example
Here’s a complete custom link bubble menu built from compound components:LinkToolbar automatically hides when LinkEditLink is clicked, and LinkForm
appears in its place. When the user submits or cancels, the toolbar reappears.
Context
UseuseBubbleMenuContext() inside any child of BubbleMenu.Root to access the editor and editing state:
| Field | Type | Description |
|---|---|---|
editor | Editor | The TipTap editor instance |
isEditing | boolean | Whether the menu is in editing mode |
setIsEditing | (value: boolean) => void | Toggle editing mode |