# @vaadin/context-menu

> Web Component for showing context dependent items for any element on the page

Latest version **25.3.5** (published 2026-10-29) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @vaadin/context-menu
pnpm add @vaadin/context-menu
yarn add @vaadin/context-menu
bun add @vaadin/context-menu
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 25.3.5 |
| Published | 2026-10-29 |
| First published | 2021-10-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 9 |
| Unpacked size | 218.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 583 |
| Author | Vaadin Ltd |
| Maintainers | web-padawan, platosha, jouni, manolo, yuriyyev, vaadin-owner, tomivirkki, artur-, sunzhewyq, sissbruecker |
| Keywords | Vaadin, context menu, web-components, web-component |

## Links

- npm: https://www.npmjs.com/package/@vaadin/context-menu
- Repository: https://github.com/vaadin/web-components
- Homepage: https://vaadin.com/components
- Issues: https://github.com/vaadin/web-components/issues
- npm.io page: https://npm.io/package/@vaadin/context-menu

## Dependencies (9)

- [lit](https://npm.io/package/lit.md) ^3.0.0
- [@vaadin/item](https://npm.io/package/@vaadin/item.md) ~25.3.5
- [@vaadin/overlay](https://npm.io/package/@vaadin/overlay.md) ~25.3.5
- [@vaadin/list-box](https://npm.io/package/@vaadin/list-box.md) ~25.3.5
- [@vaadin/a11y-base](https://npm.io/package/@vaadin/a11y-base.md) ~25.3.5
- [@vaadin/lit-renderer](https://npm.io/package/@vaadin/lit-renderer.md) ~25.3.5
- [@open-wc/dedupe-mixin](https://npm.io/package/@open-wc/dedupe-mixin.md) ^1.3.0
- [@vaadin/component-base](https://npm.io/package/@vaadin/component-base.md) ~25.3.5
- [@vaadin/vaadin-themable-mixin](https://npm.io/package/@vaadin/vaadin-themable-mixin.md) ~25.3.5

## Recent versions

- 25.3.5 (latest) — 2026-10-29
- 25.4.0-alpha5 (next) — 2026-10-30
- 25.4.0-dev.c9532cd333 (dev-table-theme) — 2026-09-30
- 25.3.0-dev.1fa5a51482 (dev-disable-dates) — 2026-07-25
- 24.4.0-dev.4b20a0c55.3 (canary) — 2024-03-22
- 24.10.10 — 2026-11-02
- 24.9.22 — 2026-11-02
- 25.2.17 — 2026-10-29
- 23.6.8 — 2026-10-29
- 24.9.21 — 2026-10-29
- 24.10.9 — 2026-10-29
- 24.4.21 — 2026-10-23
- 25.3.4 — 2026-10-22
- 25.4.0-alpha4 — 2026-10-21
- 25.2.16 — 2026-10-21
- … 667 more at https://npm.io/package/@vaadin/context-menu/versions

## README

# @vaadin/context-menu

A web component that can be attached to any component to display a context menu.

[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/context-menu)

[![npm version](https://badgen.net/npm/v/@vaadin/context-menu)](https://www.npmjs.com/package/@vaadin/context-menu)

```html
<vaadin-context-menu>
  <span>Open a context menu with <b>right click</b> or with <b>long touch.</b></span>
</vaadin-context-menu>

<script>
  const contextMenu = document.querySelector('vaadin-context-menu');
  contextMenu.renderer = function (root) {
    let listBox = root.firstElementChild;
    // Check if there is a list-box generated with the previous renderer call to update its content instead of recreation
    if (listBox) {
      listBox.innerHTML = '';
    } else {
      listBox = document.createElement('vaadin-list-box');
      root.appendChild(listBox);
    }

    ['First', 'Second', 'Third'].forEach(function (name) {
      const item = document.createElement('vaadin-item');
      item.textContent = name + ' menu item';
      listBox.appendChild(item);
    });
  };
</script>
```

[<img src="https://raw.githubusercontent.com/vaadin/web-components/main/packages/context-menu/screenshot.png" width="493" alt="Screenshot of vaadin-context-menu">](https://vaadin.com/docs/latest/components/context-menu)

**Note:** [`<vaadin-list-box>`](https://github.com/vaadin/vaadin-list-box) component used in the above example should be installed and imported separately.

## Installation

Install the component:

```sh
npm i @vaadin/context-menu
```

Once installed, import the component in your application:

```js
import '@vaadin/context-menu';
```

## License

Apache License 2.0

Vaadin collects usage statistics at development time to improve this product.
For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.

---
_Source: https://npm.io/package/@vaadin/context-menu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
