# Bubble Menu ## Example ```svelte ``` ## Documentation ## Usage `FormattingBubbleMenu` provides a ready-to-use formatting toolbar that appears when text is selected. It includes bold, italic, underline, strikethrough, and link controls. ```svelte ``` ## Adding extra controls Use the `children` snippet to add custom controls after the default formatting toggles. ```svelte ``` ## Custom bubble menu Use `BubbleMenu` directly for full control over the menu contents. It provides the styled container and positioning — you supply the controls. ```svelte ``` ## Controlling visibility Pass `shouldShow` to control when the menu appears. By default, `FormattingBubbleMenu` hides when there's no selection or when inside a code block. ```svelte from !== to && editor.isActive('paragraph')} > ``` ## How it works Both components wrap svelte-tiptap's `BubbleMenu` with a styled container that supports dark mode. `FormattingBubbleMenu` automatically detects available extensions — for example, `LinkPopover` only appears if the link extension is registered. ## Sources Based on "TipTap" (https://tiptap.dev/docs/editor/extensions/functionality/bubble-menu) ## API Reference ### FormattingBubbleMenu A pre-configured bubble menu with bold, italic, underline, strikethrough toggles, and an optional link editor. Appears on text selection. | Prop | Type | Default | Description | |------|------|---------|-------------| | editor | `Readable` | `-` | The editor store. (required, bindable) | | class | `string` | `-` | CSS classes for the menu container. | | children | `Snippet` | `-` | Additional controls rendered after the default toggles. | ### BubbleMenu A styled bubble menu container that appears on text selection. Wraps svelte-tiptap BubbleMenu with dark mode styling. Use this for fully custom menus. | Prop | Type | Default | Description | |------|------|---------|-------------| | editor | `Readable` | `-` | The editor store. (required, bindable) | | shouldShow | `(props: { editor: Editor; from: number; to: number }) => boolean` | `-` | Function to control when the menu is visible. | | class | `string` | `-` | CSS classes for the menu container. | | children | `Snippet` | `-` | Menu content (buttons, toggles, etc.). |