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

react-megamenu-responsive

v1.0.2

Published

It's a megamenu component on React. It comes with features like fullwidth, call to action button, image, and responsible for mobile/tablet device.

Downloads

10

Readme

React Mega Menu

NPM Downloads npm package minimized gzipped size NPM Version

It's a mega menu component on React. It comes with features like fullwidth, call to action button, image, and responsible for mobile/tablet device.

megamenu2

megamenu1

Features:

  • fullwidth mode
  • CTA button
  • image
  • responsible for mobile/tablet

Table of contents

Install

npm i react-megamenu

Attention

ReactMegaMenu component must use between BrowserRouter tag

Usage

simple mega menu

import { BrowserRouter } from 'react-router-dom';
import ReactMegaMenu from 'react-megamenu-responsive';
import type { MenuType } from 'react-megamenu-responsive';

const menu: MenuType[] = [
  {
    id: "1",
    title: "Phone",
    href: "#",
    items: [
      { id: "1", title: "Phone 9", href: "#" },
      { id: "2", title: "Phone 10", href: "#" },
      { id: "3", title: "Phone 11", href: "#" },
    ],
    description: "my phones are very useful",
  },
  {
    id: "2",
    title: "Monitor",
    href: "#",
    items: [
      { id: "1", title: "Monitor m1", href: "#" },
      { id: "2", title: "Monitor m2", href: "#" },
    ]
  },
  {
    id: "3",
    title: "Laptop",
    href: "#",
    items: [
      { id: "1", title: "Laptop l1", href: "#" },
      { id: "2", title: "Laptop l2", href: "#" },
      { id: "3", title: "Laptop l3", href: "#" },
    ]
  },
]

export default function Example() {
  return (
    <BrowserRouter >
      <ReactMegaMenu menus={menu} />
    </BrowserRouter>
  )
}

API

ReactMegaMenu

The component accepts the following props:

|Name|Type|Description |:--:|:-----|:-----| |direction|lrt | rtl | inherit|Direction used to describe direction of menu. |menus|array|Used to describe menus. Must be either an array of objects describing a menu. (This field is required) |options|object|Options used to describe mega menu.

Menu Options

|Name|Type|Default|Description |:--:|:-----|:--|:-----| |color|object||User provided colors to customized menu. |fullWidth|boolean|false|Possible values:true: Mega menu is fullwidth.false: Mega menu is not fullwidth. Example |image|object||User provided image to customized menu. Example |CTA|object||User provided CTA button to customized menu. Example

CSS Classes

These class names are useful for styling with CSS. They are applied to the component.

|Name|Description |:--:|:-----| |rmm-megamenu-main|Styles applied to the mega menu| |rmm-megamenu-menu|Styles applied to the menu| |rmm-megamenu-cta|Styles applied to the CTA section| |rmm-megamenu-cta__title|Styles applied to the CTA title| |rmm-megamenu-cta__des|Styles applied to the CTA description| |rmm-megamenu-img|Styles applied to the image section| |rmm-megamenu-img__title|Styles applied to the image title| |rmm-menu-main|Styles applied to the each of the menus | |rmm-menu-head|Styles applied to options of the header of menu| |rmm-menu-head__icon|Styles applied to the header icon| |rmm-menu-head__link|Styles applied to the header link| |rmm-menu-head__title|Styles applied to the header title| |rmm-menu-head__des|Styles applied to the header description| |rmm-menu-ul|Styles applied to the items| |rmm-menu-item|Styles applied to the each of the items| |rmm-menu-item__icon|Styles applied to the item icon| |rmm-menu-item__link|Styles applied to the item link| |rmm-menu-item__title|Styles applied to the item title|

Item Icon

On each item and menu object, you have the ability to choose icon to your liking with the 'icon' property. Example:

const menu: MenuType[] = [
  {
    id: "1",
    title: "Phone",
    href: "#",
    icon: <svg>...</svg>,
    items: [
      {
        id: "1", title: "Phone 9", href: "#", icon: <svg>...</svg>,
      },
      {
        id: "2", title: "Phone 10", href: "#", icon: <svg>...</svg>,
      },
      {
        id: "3", title: "Phone 11", href: "#", icon: <svg>...</svg>,
      },
    ],
    description: "my phones are very useful",
  }
]

Options

Change default options

const defaultOptions: OptionType = {
  color: {
    backgroundColor: "#fff",
    borderColor: "#ddd",
    headTitle: "#2563eb",
    description: "#2563eb",
    itemTitle: "#6b7280",
  },
  fullWidth: false,
}

License

The files included in this repository are licensed under the MIT license.