The BubbleMenu component provides a floating UI toolbar that appears when text is selected in a Tiptap editor. It includes built-in support for common text formatting (Bold, Italic, Underline, Strike, Code) as well as specialized selectors for Nodes, Links, and Colors.
To use it, pass an active Tiptap Editor instance to the component. You can customize its behavior using props like tippyOptions, shouldShow, and updateDelay.
Props
editor: (Required) The Tiptap Editor instance.tippyOptions: Configuration for the underlying Tippy.js positioning engine. Includes an onHidden callback to reset internal selector states.pluginKey: A unique string identifier for the bubble menu plugin (defaults to 'SvelteTiptapBubbleMenu').shouldShow: A function determining when the menu is visible. The default implementation hides the menu if an image is selected or if the selection size is 0.updateDelay: The delay in milliseconds before the menu updates its position/visibility (defaults to 250).
<script>
import { Editor } from '@tiptap/core';
import BubbleMenu from '$lib/ui/editor/bubble-menu';
let editor = new Editor({ /* ... */ });
</script>
<BubbleMenu {editor} />