React menu components
Live examples and documentation
Features
- React menu components for easy and fast web development.
- Unlimited levels of submenu.
- Radio and checkbox menu items.
- Supports context menu.
- Customisable styling.
- Comprehensive keyboard interaction.
- Built to comply with WAI-ARIA Authoring Practices.
Installation
npm install @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>
);
}
License
MIT Licensed. Copyright (c) 2020 Zheng Song.