Component reference
ContextMenu
Right-click or Shift+F10 opens the existing Menu, including nested items.
Preview
Right-click actions
Right-click the region, or focus it and press Shift+F10. Nested items reuse Menu, including keyboard movement inside the menu.
render: () => {
const feedback = signal("No action selected yet.");
return (
<Stack align="start">
<ContextMenu
id="file-actions"
items={[
{
id: "open",
label: "Open",
icon: <Icon name="file" />,
onSelect: () => {
feedback.value = "Selected Open.";
},
},
{
id: "export",
label: "Export",
children: [
{
id: "markdown",
label: "Markdown",
onSelect: () => {
feedback.value = "Selected Markdown.";
},
},
{
id: "text",
label: "Plain text",
onSelect: () => {
feedback.value = "Selected Plain text.";
},
},
],
},
{ type: "separator", id: "divider" },
{
id: "remove",
label: "Remove",
danger: true,
onSelect: () => {
feedback.value = "Selected Remove.";
},
},
]}
>
<Card>
<p>Right-click this card for file actions.</p>
<p>Shift+F10 opens the same menu when the region is focused.</p>
</Card>
</ContextMenu>
<Note role="status">{feedback}</Note>
</Stack>
);
}Installation
bun add meowtail
Usage
import { ContextMenu } from "meowtail";API reference
Props
| Prop | Type | Default |
|---|---|---|
idRequired | string | – |
itemsRequired | readonly MenuEntry[] | – |
open | MaybeSignal<boolean> | – |
onOpenChange | (open: boolean) => void | – |
children | Child | – |
Also takes className, children and the attributes and events of its root element.
DOM parts
root
Registry
The component is registered as context-menu in the meowtail component registry.