---
title: Context Menu
description: Displays a menu to the user — such as a set of actions or functions — triggered by a button.

link:
  doc: https://kobalte.dev/docs/core/components/context-menu
  api: https://kobalte.dev/docs/core/components/context-menu#api-reference
---

<ComponentPreview name="context-menu-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/context-menu-demo.tsx

```

</ComponentPreview>

## Installation

<ComponentInstallation>

<Step>

<StepItem>Copy and paste the following code into your project:</StepItem>

  <ComponentSourceTabs>

    ```tsx title="components/ui/context-menu" file=<rootDir>/apps/docs/src/registry/ui/context-menu.tsx

    ```

    ```tsx title="components/ui/context-menu" file=<rootDir>/apps/unocss-playground/src/registry/ui/context-menu.tsx

    ```

  </ComponentSourceTabs>

</Step>

</ComponentInstallation>

## Usage

```tsx
import {
  ContextMenu,
  ContextMenuContent,
  ContextMenuItem,
  ContextMenuTrigger,
} from "@/components/ui/context-menu"
```

```tsx
<ContextMenu>
  <ContextMenuTrigger />
  <ContextMenuContent>
    <ContextMenuItem />
  </ContextMenuContent>
</ContextMenu>
```
