All Projects → azouaoui-med → React Pro Sidebar

azouaoui-med / React Pro Sidebar

Licence: mit
Customizable and responsive react sidebar library with dropdown menus and unlimited number of nested submenus

Projects that are alternatives of or similar to React Pro Sidebar

Input Range Scss
Styling Cross-Browser Compatible Range Inputs with Sass
Stars: ✭ 272 (-24.23%)
Mutual labels:  npm, npm-package, scss
Reactopt
A CLI React performance optimization tool that identifies potential unnecessary re-rendering
Stars: ✭ 1,975 (+450.14%)
Mutual labels:  npm, npm-package, react-component
React Ckeditor
CKEditor component for React with plugin and custom event listeners support
Stars: ✭ 124 (-65.46%)
Mutual labels:  npm, npm-package, react-component
react-daterange-picker
A react date range picker to using @material-ui. Live Demo: https://flippingbitss.github.io/react-daterange-picker/
Stars: ✭ 85 (-76.32%)
Mutual labels:  react-component, npm-package
react-folder-tree
A versatile react treeview library that supports custom icons and event handlers
Stars: ✭ 56 (-84.4%)
Mutual labels:  npm-package, tree-structure
react-circle-flags
🚀 A React component with a collection of 300+ minimal circular SVG country flags. Wrapper of HatScripts/circle-flags
Stars: ✭ 29 (-91.92%)
Mutual labels:  react-component, npm-package
react-native-value-picker
Cross-Platform iOS(ish) style picker for react native.
Stars: ✭ 18 (-94.99%)
Mutual labels:  react-component, npm-package
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: ✭ 256 (-28.69%)
Mutual labels:  npm, npm-package
Laravel Nestedset
Effective tree structures in Laravel 4-5
Stars: ✭ 3,045 (+748.19%)
Mutual labels:  tree-structure, menus
Alfred Npms
Alfred 3 workflow to search for npm packages with npms.io
Stars: ✭ 312 (-13.09%)
Mutual labels:  npm, npm-package
Length.js
📏 JavaScript library for length units conversion.
Stars: ✭ 292 (-18.66%)
Mutual labels:  npm, npm-package
React Router Util
Useful components and utilities for working with React Router
Stars: ✭ 320 (-10.86%)
Mutual labels:  npm-package, react-component
Singlespotify
🎵 Create Spotify playlists based on one artist through the command line
Stars: ✭ 254 (-29.25%)
Mutual labels:  npm, npm-package
Ts ci
✅ Continuous integration setup for TypeScript projects via GitHub Actions.
Stars: ✭ 225 (-37.33%)
Mutual labels:  npm, npm-package
react-windows-ui
Build Windows fluent UI apps using ReactJS. Provides a set of accessible, reusable, and composable React components that make it super easy to create websites and apps.
Stars: ✭ 383 (+6.69%)
Mutual labels:  react-component, npm-package
Pinyinlite
Lightweight and Lightning-Fast ⚡️ Pinyin Library for JavaScript
Stars: ✭ 218 (-39.28%)
Mutual labels:  npm, npm-package
Jsonexport
{} → 📄 it's easy to convert JSON to CSV
Stars: ✭ 208 (-42.06%)
Mutual labels:  npm, npm-package
Eslint Plugin Vue
Official ESLint plugin for Vue.js
Stars: ✭ 3,592 (+900.56%)
Mutual labels:  npm, npm-package
Horus
🎯 A gRPC-Node Distributed Tracing and Monitoring Tool.
Stars: ✭ 184 (-48.75%)
Mutual labels:  npm, npm-package
Darkmode.js
🌓 Add a dark-mode / night-mode to your website in a few seconds
Stars: ✭ 2,339 (+551.53%)
Mutual labels:  npm, npm-package

React Pro Sidebar

npm License Peer Download Stars

Customizable and responsive react sidebar library with dropdown menus and unlimited number of nested submenus

Demo

Live preview

Screenshot

react-pro-sidebar

Installation

yarn

yarn add react-pro-sidebar

npm

npm install react-pro-sidebar

Usage

import { ProSidebar, Menu, MenuItem, SubMenu } from 'react-pro-sidebar';
import 'react-pro-sidebar/dist/css/styles.css';

<ProSidebar>
  <Menu iconShape="square">
    <MenuItem icon={<FaGem />}>Dashboard</MenuItem>
    <SubMenu title="Components" icon={<FaHeart />}>
      <MenuItem>Component 1</MenuItem>
      <MenuItem>Component 2</MenuItem>
    </SubMenu>
  </Menu>
</ProSidebar>;

If you are using sass then you can import the styles.scss directly into your scss file

@import '~react-pro-sidebar/dist/scss/styles.scss';

Sidebar Layout

You can take advantage of the sidebar layout components to organize the content of your sidebar

import { ProSidebar, SidebarHeader, SidebarFooter, SidebarContent } from 'react-pro-sidebar';

<ProSidebar>
  <SidebarHeader>
    {/**
     *  You can add a header for the sidebar ex: logo
     */}
  </SidebarHeader>
  <SidebarContent>
    {/**
     *  You can add the content of the sidebar ex: menu, profile details, ...
     */}
  </SidebarContent>
  <SidebarFooter>
    {/**
     *  You can add a footer for the sidebar ex: copyright
     */}
  </SidebarFooter>
</ProSidebar>;

Custom Styling

There are sets of sass variables available which you can override to define your own styles

You need to include your override variables before importing the scss file

Your custom.scss file should look something like this

// Your variable overrides
$sidebar-bg-color: #1d1d1d;

@import '~react-pro-sidebar/dist/scss/styles.scss';

Available scss variables

$sidebar-bg-color: #1d1d1d !default;
$sidebar-color: #adadad !default;
$sidebar-width: 270px !default;
$sidebar-collapsed-width: 80px !default;
$highlight-color: #d8d8d8 !default;
$submenu-bg-color: #2b2b2b !default;
$submenu-bg-color-collapsed: #2b2b2b !default;
$icon-bg-color: #2b2b2b !default;
$icon-size: 35px !default;
$breakpoint-xs: 480px !default;
$breakpoint-sm: 576px !default;
$breakpoint-md: 768px !default;
$breakpoint-lg: 992px !default;
$breakpoint-xl: 1200px !default;

Using nested sub-menus

You can have as many nested menu-items and sub-menus as you like, and the syntax is very simple

<Menu iconShape="square">
  <SubMenu title="Components" icon={<FaGem />}>
    <MenuItem>Component 1</MenuItem>
    <SubMenu title="Sub Component 1" icon={<FaHeart />}>
      {/* you can have more nested submenus ... */}
    </SubMenu>
  </SubMenu>
</Menu>

Using React Router Dom

Here is an example on how to use react router dom in the menu item

import { Link } from 'react-router-dom';

<MenuItem icon={<FaGem />}>
  Dashboard
  <Link to="/" />
</MenuItem>;

API

Component Prop Type Description Default
ProSidebar collapsed boolean collapsed status of the sidebar false
rtl boolean RTL direction false
toggled string Toggle status of the sidebar when break point is enabled false
onToggle (value:boolean)=>{} Callback function called when toggled status changes, happens when overlay is clicked -
breakPoint xs | sm | md | lg | xl Set break point to specify when the sidebar should be responsive -
width number | string Width of the sidebar 270px
collapsedWidth number | string Width of the sidebar on collapsed state 80px
image string Url of the image to use in the sidebar background -
Menu iconShape 'square' | 'round' | 'circle' Shape of the menu icons -
popperArrow boolean if true, an arrow will be displayed when sidebar collapsed to point to sub-menu wrapper false
MenuItem icon ReactNode Icon for the menu item -
active boolean Set active menu items false
prefix ReactNode Add a prefix to the menuItem -
suffix ReactNode Add a suffix to the menuItem -
SubMenu title string | ReactNode Title for the submenu -
icon ReactNode Icon for submenu -
defaultOpen boolean Set if the submenu is open by default false
open boolean Set open value if you want to control the state -
prefix ReactNode Add a prefix to the submenu -
suffix ReactNode Add a suffix to the submenu -
onOpenChange (open: boolean)=>{} Callback function called when submenu state changes -

License

MIT © Mohamed Azouaoui

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].