npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

burger-menu

v2.0.0

Published

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

Downloads

1,156

Readme

NPM LICENSE CODECOV

🎉 Features

  • Written in Typescript, Friendly Static Type Support.

🔥 Demo

Live demo: burger-menu

🔥 Install

# 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:

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

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 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