Awesome Open Source
Awesome Open Source

React-Menu

An accessible, responsive, and customisable React menu library.

Live examples and documentation

NPM TypeScript Known Vulnerabilities

Features

  • React menu components for easy and fast web development.
  • Unlimited levels of submenu.
  • Supports radio and checkbox menu items.
  • Supports context menu.
  • Flexible menu positioning.
  • Customisable styling.
  • Comprehensive keyboard interactions.
  • Adheres to WAI-ARIA Authoring Practices.

Installation

# with npm
npm install @szhsin/react-menu

# with Yarn
yarn add @szhsin/react-menu

Usage

import React from 'react';
import {
    Menu,
    MenuItem,
    MenuButton,
    SubMenu
} from '@szhsin/react-menu';
import '@szhsin/react-menu/dist/index.css';

export default function Example() {
    return (
        <Menu menuButton={<MenuButton>Open menu</MenuButton>}>
            <MenuItem>New File</MenuItem>
            <SubMenu label="Open">
                <MenuItem>index.html</MenuItem>
                <MenuItem>example.js</MenuItem>
                <MenuItem>about.css</MenuItem>
            </SubMenu>
            <MenuItem>Save</MenuItem>
        </Menu>
    );
}

More examples and documentation

License

MIT Licensed. Copyright (c) 2021 Zheng Song.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (69,677
react (5,371
accessibility (177
menu (174
dropdown (94
checkbox (45
radio-buttons (19
contextmenu (18
wai-aria (17