Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
OverlaysGlass surface

ContextMenu

Provides contextual actions for a selected object.

FrameworksAstro · React · Elements

Registry commandlumen add ContextMenu

InteractionEnhanced runtime

01

See it and copy it

Framework example

Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroSame visual contract, native framework API
Right-click (or press Shift+F10) inside this area

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { ContextMenu } from '@santi020k/lumen-astro'
---

<div
  data-ui-context-menu-trigger="ex-context-menu"
  style="border: 1px dashed hsl(var(--line)); border-radius: 0.5rem; padding: 2rem; text-align: center;"
  tabindex="0"
>
  Right-click (or press Shift+F10) inside this area
</div>
<ContextMenu aria-label="Project actions" id="ex-context-menu">
  <button role="menuitem" type="button">Duplicate</button>
  <button role="menuitem" type="button">Rename</button>
  <button role="menuitem" type="button">Delete</button>
</ContextMenu>
Edit ContextMenu in browser
02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add ContextMenu
lumen add ContextMenu

Glass

Add the glass prop to apply the shared blur, saturation, border, and highlight tokens. Glass reads best over vivid content, so place the surface above imagery or color.

AstroSame visual contract, native framework API

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { ContextMenu } from '@santi020k/lumen-astro'
---

<div class="docs-glass-demo" style="justify-items: center;">
  <ContextMenu aria-label="Project actions" glass>
    <button role="menuitem">Duplicate</button>
    <button role="menuitem">Rename</button>
    <button role="menuitem">Move to workspace</button>
    <button role="menuitem">Delete</button>
  </ContextMenu>
</div>
Edit ContextMenu in browser

API reference

Lumen-specific props and runtime attributes for the Astro primitive. React props follow the same names; Elements use equivalent kebab-case attributes where custom elements expose them.

AttributeValuesDefaultDescription
glassboolean | "subtle" | "strong"falseApplies the tokenized liquid-glass surface treatment with backdrop-filter fallbacks; "subtle" and "strong" adjust the fill intensity.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Keyboard interactions

Keyboard behavior provided by the Astro UIPrimitives runtime for this component.

KeyAction
ContextMenu, Shift+F10 on triggerOpen the linked menu near the trigger and focus the first focusable menu item.
Escape in menuClose the menu and return focus to the trigger.
ArrowDown, ArrowUp in menuMove focus through focusable menu items, wrapping at the ends.
Home, End in menuMove focus to the first or last focusable menu item.

Web docsFull catalog