Context menu
Context menu component that opens with a right click, a long press or the keyboard, with icons, shortcuts and danger items.
How to use it
Run npx @blossomui/react add context-menu, or copy src/components/UI/ContextMenu/ContextMenu.tsx into your React project and import it.
import { ContextMenu } from './components/ui/ContextMenu'Props
ContextMenuItem
| Prop | Type | Description |
|---|---|---|
| id (required) | string | |
| label (required) | string | |
| icon | ReactNode | |
| shortcut | string | Keyboard shortcut shown on the right, for example "Ctrl+C". It is only a hint: you handle the key yourself. |
| onSelect | () => void | Called when the item is chosen with the mouse or the keyboard. |
| danger | boolean | Shows the item in red, useful for destructive actions. |
| disabled | boolean | |
| separator | boolean | Draws a line above this item. |
ContextMenuProps
| Prop | Type | Description |
|---|---|---|
| items (required) | ContextMenuItem[] | |
| children (required) | ReactNode | The area that opens the menu with a right click, a long press on a phone, or the context menu key. |
| color | string | Accent color of the highlighted item: any CSS color. Without it the component uses `--blossom-accent`. |
| label | string | Accessible name of the menu. |
| disabled | boolean | |
| className | string |