Socket
Socket
Sign inDemoInstall

@material/menu

Package Overview
Dependencies
Maintainers
21
Versions
1689
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/menu

The Material Components for the web menu component


Version published
Weekly downloads
857K
decreased by-2.16%
Maintainers
21
Weekly downloads
 
Created

What is @material/menu?

@material/menu is a Material Design menu component for the web. It provides a simple way to create menus that follow the Material Design guidelines, including support for nested menus, keyboard navigation, and accessibility features.

What are @material/menu's main functionalities?

Basic Menu

This code demonstrates how to create a basic menu using the @material/menu package. It initializes a menu component and opens it.


import {MDCMenu} from '@material/menu';

const menu = new MDCMenu(document.querySelector('.mdc-menu'));
menu.open = true;

Menu with Items

This code shows how to create a menu with items and add an event listener to handle item clicks.


import {MDCMenu} from '@material/menu';

const menu = new MDCMenu(document.querySelector('.mdc-menu'));
menu.open = true;

const listItem = document.querySelector('.mdc-list-item');
listItem.addEventListener('click', () => {
  console.log('Item clicked');
});

Nested Menus

This code demonstrates how to create nested menus using the @material/menu package. It initializes a parent menu and a child menu, and opens the child menu when an item in the parent menu is clicked.


import {MDCMenu} from '@material/menu';

const parentMenu = new MDCMenu(document.querySelector('.mdc-menu-parent'));
const childMenu = new MDCMenu(document.querySelector('.mdc-menu-child'));

parentMenu.open = true;

const parentItem = document.querySelector('.mdc-list-item-parent');
parentItem.addEventListener('click', () => {
  childMenu.open = true;
});

Other packages similar to @material/menu

Keywords

FAQs

Package last updated on 30 Sep 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc