import type { Meta, StoryObj } from "@storybook/react" import { Button } from "../../action/button" import { ContextMenu } from "./ContextMenu" /** * A context menu component that appears on right-click. * * ## Props * - `Root`: Container for the context menu * - `Trigger`: Element that triggers the context menu * - `Content`: The context menu content * - `Item`: Individual menu item * - `Label`: Section label * - `Separator`: Visual separator * - `Sub`: Submenu container * - `SubTrigger`: Submenu trigger * - `SubContent`: Submenu content * - `CheckboxItem`: Checkbox menu item * - `RadioGroup`: Radio group container * - `RadioItem`: Radio menu item */ const meta = { title: "base/selection/ContextMenu", component: ContextMenu.Root, tags: ["autodocs"], parameters: { layout: "centered", }, } satisfies Meta export default meta type Story = StoryObj /** * Basic context menu with default settings. */ export const Default: Story = { render: () => (
Right-click here
Copy Cut Paste Delete
), } /** * Context menu with different item types. */ export const ItemTypes: Story = { render: () => ( Regular Item Disabled Item Checkbox Item Unchecked Item Option 1 Option 2 Option 3 ), } /** * Context menu with submenus. */ export const WithSubmenus: Story = { render: () => (
Right-click for submenus
File Edit View Zoom In Zoom Out Reset Zoom Tools Settings Preferences Advanced Developer Tools Console Help
), } /** * Context menu with labels and separators. */ export const WithLabels: Story = { render: () => ( File Operations New Open Save Edit Operations Undo Redo View Options Show Toolbar Show Status Bar Show Sidebar ), } /** * Context menu with keyboard shortcuts. */ export const WithShortcuts: Story = { render: () => (
Right-click for shortcuts
Copy
⌘C
Cut
⌘X
Paste
⌘V
Undo
⌘Z
Redo
⌘⇧Z
Select All
⌘A
), } /** * Context menu with icons. */ export const WithIcons: Story = { render: () => ( 📄 New File 📁 Open File 💾 Save ✂️ Cut 📋 Copy 📌 Paste 🗑️ Delete ), } /** * Context menu with radio groups. */ export const RadioGroups: Story = { render: () => (
Right-click for radio options
Theme Light Dark Auto Language English Spanish French
), }