• This repository has been archived on 05/Oct/2022
  • Stars
    star
    257
  • Rank 158,728 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple vue context menu component.

Attention:

I no longer have the ability or interest in maintaining this package since I am not using Vue in any of my projects anymore, so I am abandoning vue-context. If your project depends on vue-context, please feel free to fork and maintain the package yourself, or use an alternative context menu package.

vue-context

npm version npm downloads GitHub issues GitHub stars VueJS version

vue-context provides a simple yet flexible context menu for Vue. It is styled for the standard <ul> tag, but any menu template can be used. The menu is lightweight with its only dependency being vue-clickaway. The menu has some basic styles applied to it, but they can be easily overridden by your own styles.

The menu disappears when you expect by utilizing vue-clickaway and it also optionally disappears when clicked on.

Screenshot

Getting Started

The following instructions will help you get the vue-context menu up and running on your project.

Installation

Using npm:

npm i vue-context

Basic Usage

Import the component and use it in your app.

import Vue from 'vue';
import VueContext from 'vue-context';

new Vue({
    components: {
        VueContext
    },
    
    methods: {
        onClick (text) {
            alert(`You clicked ${text}!`);
        }
    }
}).$mount('#app');

Next add an element to the page that will trigger the context menu to appear, and also add the context menu to the page.

<div id="app">

    <div>
        <p @contextmenu.prevent="$refs.menu.open">
            Right click on me
        </p>    
    </div>
    
    <vue-context ref="menu">
        <li>
            <a href="#" @click.prevent="onClick($event.target.innerText)">Option 1</a>
        </li>
        <li>
            <a href="#" @click.prevent="onClick($event.target.innerText)">Option 2</a>
        </li>
    </vue-context>
    
</div>

Notice: As of version 4.1.0, the menu styles are not automatically included by default anymore. You will need to manually import them now in your own stylesheets.

@import '~vue-context/dist/css/vue-context.css';

// Or
@import '~vue-context/src/sass/vue-context';

Documentation

For full documentation, go here: https://randallwilk.dev/docs/vue-context.

If you would like to contribute to the documentation, you can edit the docs found here: https://github.com/rawilk/vue-context/tree/master/docs

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Alternatives

See awesome-vue for other alternatives.

License

vue-context uses the MIT License (MIT). Please see the license file for more information.

More Repositories

1

laravel-printing

Direct printing for Laravel apps.
PHP
400
star
2

laravel-form-components

Form components built for Tailwind & Livewire.
PHP
360
star
3

laravel-settings

Store Laravel application settings in the database.
PHP
148
star
4

filament-password-input

Enhanced password input component for filament.
PHP
35
star
5

alpine-ripple

Ripple effect (materialize) for Alpine.js.
JavaScript
21
star
6

laravel-app-key-rotator

Rotate app keys around while re-encrypting data.
PHP
21
star
7

laravel-webauthn

Add webauthn functionality to Laravel.
PHP
20
star
8

yubikey-u2f

Add Yubikey U2F authentication to Laravel.
PHP
15
star
9

laravel-breadcrumbs

Easily add breadcrumbs to a Laravel app.
PHP
13
star
10

laravel-ups

UPS api wrapper for Laravel.
PHP
10
star
11

laravel-base

Useful blade components and functionality for most Laravel projects.
PHP
8
star
12

filament-quill

Quill rich text editor for Filament.
PHP
8
star
13

laravel-casters

A collection of custom casts for Laravel.
PHP
6
star
14

randallwilk.dev

Repo for my personal site.
Blade
4
star
15

new-server-setup

Guide and stack scripts for setting up a new server environment
Shell
3
star
16

profile-filament-plugin

Profile & MFA starter kit for filament.
PHP
3
star
17

filament-inner-nav

Add inner navigation to filament panel pages.
Blade
2
star
18

laravel-form-components.randallwilk.dev

Demo site for Laravel Form Components
PHP
2
star
19

laravel-stubs

Opinionated modifications to the default Laravel stubs.
PHP
2
star
20

laravel-modules

Module management in Laravel
PHP
2
star
21

human-keys

Use stripe-like keys for your models.
PHP
2
star
22

blade

Commonly needed blade components for Laravel apps.
PHP
1
star
23

rawilk

My personal GitHub repository
1
star