Code Monkey home page Code Monkey logo

vue3-context-menu's Introduction

Note

This library is derived by (vue-context) library where main functionality hasn't changed.

vue3-context-menu

VueJS version

context-menu-vue3 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 vue3-click-outside. 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 vue3-click-outside 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 @albizeka/context-menu-vue3

Basic Usage

Import the component and use it in your app.

import VueContext from "@albizeka/context-menu-vue3";
import { ref, nextTick } from "vue";

// Context items
const items = ref(["Item 1", "Item 2"]);

// Action
function onClick(param) {
  console.log("Item clicked");
}

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 class="button">
      <p @contextmenu.prevent="$refs.menu.open">Right click on me</p>
    </div>
    
    <VueContext ref="menu">
      <li v-for="item in items">
        <a href="#" @click.prevent="onClick($event.target.innerText)">{{
          item
        }}</a>
      </li>
    </VueContext>
    
</div>

Documentation

Notice: The code in full documentation is written in VUE2 but all functions are the same so everything should work fine

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

@albizeka/context-menu-vue3 uses the MIT License (MIT). Please see the license file for more information.

vue3-context-menu's People

Contributors

albizeka avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.