1.1.2 • Published 3 years ago

@bscop/react-menu v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-menu

GitHub license npm version CircleCI Status Coverage

Accessible menu (in React).

View in Storybook.

Install

npm i @bscop/react-menu

Usage

import Menu from "@bscop/react-menu";

function App () {
  return (
    <Menu 
      items={
        [
          [
            {
              href: "#account",
              id: "account",
              label: "Account",
            },
            {
              href: "#preferences",
              id: "preferences",
              label: "Preferences",
            },
            {
              href: "#billing",
              id: "billing",
              label: "Billing",
            },
          ],
          [
            {
              id: "logout",
              label: "Logout",
              renderItem (baseProps) {
                return (
                  <form action="/logout" method="post">
                    <button {...baseProps} type="submit">
                      Logout
                    </button>
                  </form>
                );
              },
            },
          ],
        ]
      }
      label="Menu"
    />
  );
}

Contribute

Read the guidelines.

Run tests

npm test

Coverage

Coverage reports are hosted on codecov.

npm run badge:coverage -- --token=<guid>

Bruno Scopelliti\ www.brunoscopelliti.com