Skip to content

Laravel Context Menu Component

Free · MIT

A right-click context menu with viewport-aware positioning, powered by Alpine.js.

A Context Menu built for the TALL stack — Blade, Livewire 3 & 4, Alpine.js and Tailwind CSS 4. Server-rendered by default, dark-mode ready, and WCAG-minded. Drop it in with a single Blade tag: <x-aura::context-menu>

Installation

composer require bluestarsystem/aura-ui

Usage

<x-aura::context-menu>
    <div class="p-8 border border-dashed rounded-lg text-center text-sm text-gray-500">
        Right-click anywhere in this area
    </div>

    <x-slot:menu>
        <x-aura::dropdown.item icon="copy">Copy</x-aura::dropdown.item>
        <x-aura::dropdown.item icon="clipboard">Paste</x-aura::dropdown.item>
        <x-aura::dropdown.separator />
        <x-aura::dropdown.item icon="trash" variant="danger">Delete</x-aura::dropdown.item>
    </x-slot:menu>
</x-aura::context-menu>

See the full API, props and live examples in the Context Menu documentation.

Overview

The <x-aura::context-menu> component renders a custom right-click menu on any element. When the user right-clicks within the component's area, a floating menu appears at the cursor position. The menu is viewport-aware, flipping its position when it would overflow the screen edges. It closes on outside click or Escape key.

Use context menu for:

  • File manager actions (copy, paste, rename)
  • Table row actions
  • Canvas or editor context operations
  • Custom right-click menus replacing the browser default

Props

Prop Type Default Description
width string '200px' CSS width of the context menu panel

Slots

Slot Description
Default The area that responds to right-click events
menu Menu content (typically dropdown.item and dropdown.separator components)

See more examples and every variant in the Context Menu documentation.

Laravel-native
No JavaScript framework. Pure Blade, Livewire & Alpine.
Dark mode & themeable
Tailwind 4 CSS variables and a visual Theme Studio.
Accessible
WCAG 2.1 AA-minded, keyboard and ARIA support.