Overview
FloatingToolbar is a self-contained component that displays a formatting toolbar when text is selected. It handles selection tracking internally and exposes visibility state via context.

Features
- API — compound components with auto-visibility
- Selection tracking — automatically shows/hides on text selection
- Block selection support — also works when blocks are selected
frozenprop — pause selection tracking when popups are open- TypeScript — full type safety
Installation
Basic Usage
API Reference
FloatingToolbar (Root)
Root component that handles selection tracking.
| Prop | Type | Description |
|---|---|---|
children | ReactNode | ((api) => ReactNode) | Content or render function |
frozen | boolean | When true, selection tracking is paused |
className | string | Custom CSS classes |
| Property | Type | Description |
|---|---|---|
isOpen | boolean | Whether toolbar is visible |
FloatingToolbar.Content
Floating content panel. Automatically hides when no selection.
| Prop | Type | Description |
|---|---|---|
className | string | Custom CSS classes |
children | ReactNode | Toolbar groups and buttons |
FloatingToolbar.Group
Groups related buttons together.
FloatingToolbar.Button
Individual toolbar button.
| Prop | Type | Description |
|---|---|---|
onClick | (event) => void | Click handler |
active | boolean | Whether button is active/pressed |
disabled | boolean | Disable the button |
title | string | Tooltip text |
className | string | Custom CSS classes |
FloatingToolbar.Separator
Visual separator between groups.
Examples
With Turn Into Button
Rich Formatting Toolbar
Styling
CSS Variables
Custom Styles
Best Practices
Use frozen prop when opening popovers
Use frozen prop when opening popovers
Check if format exists before rendering
Check if format exists before rendering
Use separators to group related actions
Use separators to group related actions