Overview
FloatingBlockActions is a self-contained component that displays floating action buttons when you hover over editor blocks. It handles hover tracking internally and exposes state via render props.
Features
- API — compound components with render props
- Auto-positioning — automatically positions itself next to blocks
- Hover detection — shows on hover, hides on mouse leave
frozenprop — pause hover tracking when menus are open- TypeScript — full type safety
Installation
Basic Usage
API Reference
FloatingBlockActions (Root)
Root component that handles hover tracking and positioning.
| Prop | Type | Description |
|---|---|---|
children | ReactNode | ((api) => ReactNode) | Buttons or render function |
frozen | boolean | When true, hover tracking is paused |
className | string | Custom CSS classes |
| Property | Type | Description |
|---|---|---|
blockId | string | null | Currently hovered block ID |
blockData | YooptaBlockData | null | Block data for hovered block |
isVisible | boolean | Whether actions are visible |
hide | () => void | Manually hide the actions |
FloatingBlockActions.Button
Action button component.
| Prop | Type | Description |
|---|---|---|
onClick | (e: MouseEvent) => void | Click handler |
disabled | boolean | Disable the button |
title | string | Tooltip text |
className | string | Custom CSS classes |
children | ReactNode | Button content (usually an icon) |
Examples
With BlockOptions
Conditional Buttons Based on Block Type
Styling
CSS Variables
Best Practices
Always check if blockId exists
Always check if blockId exists
Use frozen prop when opening menus
Use frozen prop when opening menus

