React Pro Sidebar
Customizable and responsive react sidebar library with dropdown menus and unlimited number of nested submenus.
Installation
yarn
npm
Usage
If you are using sass then you can import the styles.scss
directly into your scss file
Sidebar Layout
You can take advantage of the sidebar layout components to organize the content of your sidebar
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
Available scss variables
Using nested sub-menus
You can have as many nested menu-items and sub-menus as you like, and the syntax is very simple
Using React Router Dom
Here is an example on how to use react router dom in the menu item
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 |
|
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 | - |