1.0.0 • Published 3 years ago

contexjs v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

Contex.js

Super-simple, customizable context menus based on Material Design

Installing

npm install contexjs

Importing

import * as Contex from './contex.js';

Usage

Contex.js exposes the Menu class, which can be used to create up to 100 context menus on one page. The following code creates the context menu seen below.

let myMenu = new Contex.Menu('Title', [
  {
    name: 'Option 1',
    link: 'https://example.com'
  },
  {
    name: 'Option 2',
    link: 'https://example.com'
  }
]);
myMenu.render();

context menu example

Clicking the shade behind the menu will automatically destroy the instance, as well as selecting an option. However, you can also call the .destroy() method to manually destroy the menu.

Customization

Contex.js uses CSS variables for easy customization.

VariableExplanation
--contex-fontfont families to use
--contex-textcolor of text
--contex-bgbackground color of menu
--contex-optionbackground of option <li>'s
1.0.0

3 years ago