1.1.0 • Published 2 years ago

react-responsive-sidebar-menu v1.1.0

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

react-responsive-sidebar-menu

Travis npm package Coveralls

Required

  • react-router-dom@^6.0.2

Installation

# npm
npm i react-responsive-sidebar-menu --save
# yarn
yarn add react-responsive-sidebar-menu

Usage

import React, { Component } from "react";
import ReactSearchBox from "react-search-box";
export default class App extends Component {
  menuItems = [
    {
      path: "/",
      text: "Dashboard",
      tooltip: "Dashboard",
      icon: "bx bx-grid-alt",
    },
    {
      path: "/users",
      text: "Users",
      tooltip: "Users",
      icon: "bx bx-user",
    },
    {
      path: "/users",
      text: "Messages",
      tooltip: "Messages",
      icon: "bx bx-chat",
    },
    {
      path: "/users",
      text: "Settings",
      tooltip: "Settings",
      icon: "bx bx-cog",
    },
  ];
  options = {
    title: "React RSB",
    icon: "bx bxl-react icon",
    logo: "https://lucassenarj.github.io/favicon.ico",
  }
  user={
    name: "Lucas Sena",
    avatar: "https://lucassenarj.github.io/images/author.jpg",
    status: "Frontend developer",
    onLogout: () => console.log("logout"),
  }
  render() {
    return (
      <ResponsiveSidebar
        menuItems={this.menuItems}
        options={this.options}
        user={this.user}
      />
    );
  }
}

Props

PropDescription
menuItemsAn array of objects which acts as the source of data for the menu. This prop is required
menuItems.pathPath when users will be redirected when clicked on a menu item. This prop is required
menuItems.textText which act as name or title for menu items. This prop is required
menuItems.tooltipText which act as tooltip when sidebar is closed for menu items. This prop is required
menuItems.iconBoxicon class name. This prop is required
optionsObject which acts as source for project settings. This prop is required
options.titleProject or company title. This prop is required
options.iconBoxicon path for company or project icon
options.logoImage path company or project logo
userObject which acts as source for user. This prop is required
user.nameUser name. This prop is required
user.avatarUser picture, image, or avatar. This prop is required
user.statusUser subtitle or user role. This prop is required
user.onLogoutA function which acts as a callback when the logout button is click. This prop is required

Built With

  • React - A JavaScript library for building user interfaces
  • React-Router-Dom - React Router DOM enables you to implement dynamic routing in a web app.
  • BoxIcons - Free collection of carefully crafted open source icons

License

MIT Licensed. Copyright (c) Lucas Sena 2021.

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago