Overview
BlockOptions is compound component for block context menus. It supports controlled/uncontrolled modes, Floating UI positioning, and integrates seamlessly with other UI components.

Features
- API — controlled/uncontrolled with
open/onOpenChange - Compound components — Root, Content, Trigger, Item, Group, Separator
- Floating positioning — automatic positioning via Floating UI
- Helper hook —
useBlockActionsfor common operations
Installation
Basic Usage
API Reference
BlockOptions (Root)
Root component that manages open state and context.
| Prop | Type | Description |
|---|---|---|
open | boolean | Controlled open state |
onOpenChange | (open: boolean) => void | Called when open state changes |
defaultOpen | boolean | Default open state (uncontrolled) |
anchor | HTMLElement | null | Anchor element for positioning |
children | ReactNode | Content and trigger components |
BlockOptions.Trigger
Optional trigger button (for uncontrolled usage).
| Prop | Type | Description |
|---|---|---|
asChild | boolean | Merge props onto child element |
className | string | Custom CSS classes |
BlockOptions.Content
Floating content panel.
| Prop | Type | Description |
|---|---|---|
side | 'top' | 'right' | 'bottom' | 'left' | Placement side |
align | 'start' | 'center' | 'end' | Alignment |
sideOffset | number | Offset from anchor (default: 5) |
className | string | Custom CSS classes |
BlockOptions.Item
Menu item button.
| Prop | Type | Description |
|---|---|---|
onSelect | (event) => void | Called when item is selected |
variant | 'default' | 'destructive' | Visual variant |
icon | ReactNode | Icon to display |
keepOpen | boolean | Keep menu open after selection |
disabled | boolean | Disable the item |
BlockOptions.Group
Groups items together.
BlockOptions.Separator
Visual separator between groups.
useBlockActions()
Helper hook with common block operations.
Examples
With ActionMenuList (Turn Into)
Uncontrolled with Trigger
Styling
CSS Variables
Best Practices
Use keepOpen for submenu triggers
Use keepOpen for submenu triggers
Close both menus after action
Close both menus after action

