Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-sidemenubar

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-sidemenubar

React side menu bar allows you to add sidemenu to your app.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

React-Sidemenubar

React-sidemenubar allows you to create a responsive sidebar with easy to customize.

Installation

$ npm install --save react-sidemenubar
$ yarn add react-sidemenubar

import { Menu, Toggle } from "react-sidemenubar";
import "react-sidemenubar/dist/react-sidemenubar.css";

Features

  • Easy to set up for real, you can make it work in less than 1minute!
  • Super easy to customize
  • Has onClick hooks. Can pass onclick event when user interact.
  • Toggle function allows you to toggle the sidemenu from open to close and close to open.
  • And much more !

The gist

import React from "react";

import { Menu, Toggle } from "react-sidemenubar";
import "react-sidemenubar/dist/react-sidemenubar.css";

function App() {
  const data = [
    {
      title: "Home",
      section: true,
    },
    {
      icon: <img src="home.png" alt="home" />,
      title: "Home",
      submenus: [
        {
          title: "Dashboard 1",
          onClick: (e) => {
            alert("home1");
          },
        },
        {
          title: "Dashboard 2",
          onClick: (e) => {
            alert("home2");
          },
        },
        {
          title: "Dashboard 3",
          onClick: (e) => {
            alert("home3");
          },
        },
      ],
    },
    {
      title: "Auth",
      section: true,
    },
    {
      icon: <img src="login.png" alt="home" />,
      title: "Login",
    },
    {
      icon: <img src="register.png" alt="home" />,
      title: "Register",
    },
    {
      icon: <img src="logout.png" alt="home" />,
      title: "Logout",
    },
  ];

  return (
    <div>
      <button
        onClick={() => {
          Toggle();
        }}
      >
        Toggle
      </button>
      <Menu
        menus={data}
        bg="transparent"
        activeBg="linear-gradient(45deg, #204520, #74b474)"
        color="black"
        activeColor="white"
        menubg="#efefef"
        menuborder={5}
      />
    </div>
  );
}
Desktop Mobile

The properties

Properties used to customise the rendering:

NameTypeDescription
colorStringText color of a menu
dataArrayMenu items
bgStringBackground color of menu item
activeBgStringBackground color of menu item when user interacts
activeColorStringText color of menu item when user interacts
menubgStringBackground color of menu
menuborderNumberBorder-radius of a menu item

data Properties

NameTypeDescription
titleStringMenu title
iconString or HTMLElement'optional' Menu icon
submenusArray'optional' Submenu items
onClickfunc'optional' Calls the given function when user clicks on title and pass two parameters, first one is click event and second is the object of tree prop
sectionboolean'optional' true if menu item is a section, default is false.

Demo

A demo is worth a thousand words

Contribute

Show your ❤️ and support by giving a ⭐. Any suggestions are welcome! venkatmcajj@gmail.com

Financial Contributors

Become a financial contributor and help us sustain our community. Contribute

License

Licensed under MIT

Keywords

FAQs

Package last updated on 29 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc