# burger-menu

> A modern, flexible menu component that provides navigation for pages and features.

Latest version **2.0.0** (published 2022-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install burger-menu
pnpm add burger-menu
yarn add burger-menu
bun add burger-menu
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-08-25 |
| First published | 2021-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 101.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | perezpz |
| Maintainers | bronzetrees |
| Keywords | react, reactjs, hooks, burger, menu, react-component, typescript |

## Links

- npm: https://www.npmjs.com/package/burger-menu
- Repository: https://github.com/perezpz/burger-menu
- Homepage: https://github.com/perezpz/burger-menu#readme
- Issues: https://github.com/perezpz/burger-menu/issues
- npm.io page: https://npm.io/package/burger-menu

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^18.2.0
- [classnames](https://npm.io/package/classnames.md) ^2.3.1
- [framer-motion](https://npm.io/package/framer-motion.md) ^6.5.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2022-08-25
- 1.0.13 — 2022-04-28
- 1.0.12 — 2021-12-09
- 1.0.11 — 2021-12-07
- 1.0.10 — 2021-12-07
- 1.0.9 — 2021-12-07
- 1.0.8 — 2021-11-23
- 1.0.7 — 2021-11-18
- 1.0.6 — 2021-11-18
- 1.0.5 — 2021-11-18
- 1.0.4 — 2021-11-18
- 1.0.3 — 2021-11-18
- 1.0.2 — 2021-11-18
- 1.0.1 — 2021-11-18
- 1.0.0 — 2021-11-18

## README

<div align="center">
<article style="display: flex; flex-direction: column; align-items: center; justify-content: center;">
    <h1 style="width: 100%; text-align: center;">Burger-Menu</h1>
    <p>
        A modern, flexible menu component that provides navigation for pages and features. Quickly build beautiful React apps.
    </p>
</article>

<div align="center">

[![NPM][npm-badge]][npm-url] [![LICENSE][license-badge]][license-url]
[![CODECOV][codecov-badge]][codecov-url]

[npm-badge]: https://img.shields.io/npm/v/burger-menu
[npm-url]: https://www.npmjs.com/package/burger-menu
[license-badge]: https://img.shields.io/badge/license-MIT-orange
[license-url]: https://github.com/perezpz/burger-menu/blob/main/LICENSE
[codecov-badge]: https://img.shields.io/codecov/c/gh/perezpz/react-burger-menu
[codecov-url]: https://codecov.io/gh/perezpz/react-burger-menu

</div>

</div>

# 🎉 Features

- Written in Typescript, Friendly Static Type Support.

# 🔥 Demo

Live demo: [burger-menu](https://burger-menu-gold.vercel.app/)

# 🔥 Install

```sh
# with npm
npm install burger-menu

# with yarn
yarn add burger-menu

```

# 👍 Usage

Here is a quick example to get you started, it's all you need:

```jsx live=true dir="column"
import React, { useState } from "react";
import { createRoot } from 'react-dom/client';
import { Menu, SubMenu, Item } from "burger-menu";
import 'burger-menu/lib/index.css';

const App = () => {
  const [isOpen, setIsOpen] = useState(false);
  return (
    <>
      <div onClick={() => setIsOpen(!isOpen)}>Icon</div>
      <Menu className="burger-menu" isOpen={isOpen} selectedKey={'entry'} onClose={() => setIsOpen(false)}>
        <Item itemKey={'manage'} text={'User Management'}></Item>
        <Item itemKey={'user'} text={'User Center'}></Item>
        <SubMenu title="Union Management">
          <Item itemKey={'notice'} text={'Announcement'}></Item>
          <Item itemKey={'union'} text={'Union Inquiries'}></Item>
          <Item itemKey={'entry'} text={'Entry information'}></Item>
        </SubMenu>
      </Menu>
    </>
});

createRoot(document.getElementById('root')).render(<App />);
```

## How to import

```jsx
import { Menu, SubMenu } from 'burger-menu';
import 'burger-menu/lib/index.css';
```

## Animations

The usage above imported `slide` which renders a menu that slides in when the burger icon is clicked. To use a different animation you can substitute `slide` with any of the following (check out the [demo](https://burger-menu-gold.vercel.app/) to see the animations in action):

- `slide`
- `fallDown`

## API Reference

| Properties       | Description                                                       | Type              | Default  |
| ---------------- | ----------------------------------------------------------------- | ----------------- | -------- |
| isOpen           | Control open state                                                | boolean           | false    |
| width            | Width                                                             | number \| string  | 300      |
| side             | Sliding position                                                  | string            | right    |
| animate          | animate type                                                      | string            | slide    |
| duration         | transition duration                                               | string            | 300ms    |
| customCrossIcon  | Icon for close button                                             | ReactNode         | false    |
| customIcon       | Custom icon or logo component, will be displayed on the head left | ReactNode         | false    |
| onOpen           | The Callback function when animation end                          | function(e) => {} | () => {} |
| onClose          | The callback function before the exit animation ends              | function(e) => {} | () => {} |
| bodyClassName    | Add className to body tag                                         | string            |          |
| htmlClassName    | Add className to html tag                                         | string            |          |
| noOverlay        | Toggle whether to show overlay                                    | boolean           | false    |
| overlayClassName | Overlay style name                                                | string            |          |

### SubMenu

| Properties | Description                                     | Type      | Default |
| ---------- | ----------------------------------------------- | --------- | ------- |
| title      | SubMenu copy                                    | string    |         |
| icon       | Icon of SubMenu, will be displayed on the right | ReactNode |         |

### Item

| Properties | Description                                              | Type      | Default |
| ---------- | -------------------------------------------------------- | --------- | ------- |
| text       | Content for item                                         | string    |         |
| icon       | The icon of the menu item, will be displayed on the left | ReactNode |         |
| itemKey    | Unique ID of the menu item                               | string    |         |

# 🎈 License

Burger Menu is [MIT Licensed](LICENSE)

---
_Source: https://npm.io/package/burger-menu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
