You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
dependabot[bot] 56ac5c5201
Bump @babel/core from 7.18.9 to 7.18.10 (#598)
1 week ago
.github Update issue templates 5 months ago
dist Restore focus to menu after focused item is deleted 2 weeks ago
example Restore focus to menu after focused item is deleted 2 weeks ago
src Update unit tests 2 weeks ago
style-utils Create style-utils selectors 9 months ago
types Fix menu detached from anchor when rendered via portal (#551) 2 months ago
.browserslistrc Preserve es module structure 10 months ago
.eslintignore Convert docs website to Next.js (#406) 7 months ago
.eslintrc.json Fix menu detached from anchor when rendered via portal (#551) 2 months ago
.gitignore Convert docs website to Next.js (#406) 7 months ago
.prettierignore Convert docs website to Next.js (#406) 7 months ago
.prettierrc.yaml Reformatting with prettier 10 months ago
LICENSE Create LICENSE 2 years ago
README.md Update README.md 5 months ago
babel.config.js Upgrade to the new JSX transform (#440) 5 months ago
jest.config.js Enable tests to run on npm distribution 10 months ago
package-lock.json Bump @babel/core from 7.18.9 to 7.18.10 (#598) 1 week ago
package.json Bump @babel/core from 7.18.9 to 7.18.10 (#598) 1 week ago
rollup.config.js Upgrade to the new JSX transform (#440) 5 months ago

README.md

React-Menu

An accessible and keyboard-friendly React menu library.

Live examples and docs

NPM NPM TypeScript Known Vulnerabilities

Features

  • React menu components for easy and fast web development.
  • Unlimited levels of submenu.
  • Supports dropdown or context menu.
  • Supports radio and checkbox menu items.
  • Flexible menu positioning.
  • Comprehensive keyboard interactions.
  • Unstyled components and easy customisation.
  • Supports React 18 concurrent rendering.
  • Works in major browsers without polyfills.
  • Adheres to WAI-ARIA Authoring Practices.

Install

# with npm
npm install @szhsin/react-menu

# with Yarn
yarn add @szhsin/react-menu

Usage

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

export default function App() {
  return (
    <Menu menuButton={<MenuButton>Open menu</MenuButton>}>
      <MenuItem>New File</MenuItem>
      <MenuItem>Save</MenuItem>
      <SubMenu label="Edit">
        <MenuItem>Cut</MenuItem>
        <MenuItem>Copy</MenuItem>
        <MenuItem>Paste</MenuItem>
      </SubMenu>
      <MenuItem>Print...</MenuItem>
    </Menu>
  );
}

Edit on CodeSandbox

Visit more examples and docs

Migration from v2 to v3
Migration from v1 to v2

Please note that React-Menu v3 requires React 16.14.0 or higher. If you are not able to upgrade React, you could install v2/v1 which requires React 16.8.0.

License

MIT Licensed.