New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

modern-context

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modern-context

A modern, beautiful, and lightweight context menu JavaScript library inspired by Fluent Design.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

ModernContext.js

A modern, beautiful, and lightweight context menu JavaScript library inspired by Fluent Design.

screenshot

Dark Mode Support

ModernContext.js supports dark mode. If your browser is set to dark mode, the context menu will automatically switch to the black-based design.

screenshot

Usage

See the documentation for more information.

npm

npm install modern-context
import { Context } from "modern-context";

Browser

import { Context } from "./dist/modern-context.min.js"

Example

const contents = [
    {
        type: "item",
        label: "Alert",
        callback: () => {
            alert("Clicked!");
        }
    },
    {
        type: "separator"
    },
    {
        type: "item",
        label: "No Callback"
    }
];

const context = new Context("#target", contents);

CSS Custom Properties

PropertyDefaultDescription
--mc-text-color#333333 (white in dark mode)Text color in the context menu.
--mc-background-colorrgba(255, 255, 255, 0.7) (rgba(51, 51, 51, 0.7) in dark mode)Background color of the context menu.
--mc-corner-radius0.25emCorner radius size of the context menu.
--mc-font-familysans-serifFont family of text.

Supported Browsers

The following browsers are supported. ModernContext.js may work in other modern browsers, but I tested only the following browsers.

  • Google Chrome
  • Mozilla Firefox
  • Microsoft Edge

Development

Setup

npm install

Build

npm run build

Generate documentation

npm run doc

Keywords

contextmenu

FAQs

Package last updated on 17 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts