svelte-context-action

Svelte Context Action

A svelte action to create context menus

svelte-context-action

Svelte context action provides a svelte action to create highly configurable context/right click menus.

Installation

$ npm install svelte-context-action
$ yarn add svelte-context-action
$ pnpm add svelte-context-action

Usage

<script>
  import { contextMenu } from 'svelte-context-action';
</script>

<div
    use:contextMenu={{
        items: [
            {
                type: 'button',
                content: 'Hello world',
                callback: () => window.alert('hi')
            },
            {
                type: 'button',
                content: 'Hi 1',
                callback: () => window.alert('hi')
            },
            {
                type: 'divider'
            },
            {
                type: 'button',
                content: 'Hi 2',
                callback: () => window.alert('hi')
            }
        ],
    }}
>
    Right click me!
</div>

Documentation

Documentation is available using a GitHub Wiki here.

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes