Customizable and responsive react sidebar library with dropdown menus and unlimited number of nested submenus
yarn add react-pro-sidebar
npm install react-pro-sidebar
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';
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>;
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;
$submenu-indent: 24px !default;
$breakpoint-xs: 480px !default;
$breakpoint-sm: 576px !default;
$breakpoint-md: 768px !default;
$breakpoint-lg: 992px !default;
$breakpoint-xl: 1200px !default;
$breakpoint-xxl: 1600px !default;
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>
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>;
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 |
|
innerSubMenuArrows | boolean | if true , arrows will be displayed for each inner submenu |
true |
|
subMenuBullets | boolean | if true , bullets will be displayed for each inner submenu/menuItem |
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 | - |
MIT © Mohamed Azouaoui
插件 Ant Design Snippets 如果生成layout快捷键 antlayout + enter function IndexPage() {//布局生成快键antlayout + enter return ( <Layout> <Header>header</Header> <Layout> <Sider>left sidebar</Si
作用 一般的React组件总是挂载在父组件的this.props.children上,总是被最近的父组件捕捉到React的根节点上。 Portal是react16提出的将子节点直接渲染React的最顶层方案,portal是真实DOM,存在于DOM tree中,且与在DOM tree中的位置无关 用法 import React, { Component } from "react"; export
Recovery Pro 是一种独特的恢复追踪解决方案,可让您知道您的心肺系统是否已恢复并准备好进行心肺训练。此外,它还根据您的短期及长期训练和恢复之间的平衡情况提供恢复反馈和训练建议。 结合使用 Recovery Pro 和 Training Load Pro,您可全面了解训练课如何对身体不同系统造成疲劳。然后,Recovery Pro 会告诉您身体对于这种疲劳的反应,以及它如何影响您每天进行心
主页: Markdown Pro 平台: OSX 费用: $9.99 介绍 Markdown Pro 提供了 iCloud 支持、文件导出等功能。 截图
phpMyBackupPro是一个易于使用,基于web的MySQL备份系统。它的主要特性如下: 1.可以选择备份一个或几个数据库,并可以选择是只备份表格结构还是包含数据,…。 2.支持三种压缩类型(不压缩,gzip和zip)。 3.按计划自动备份。 4.提供一个备份管理界面(查看,恢复,下载,删除)。 5.可直接备份到FTP服务器上或通过email发送。 6.支持多种语言。
DashO Pro 是Java代码保护的理想选择。其代码保护能力强大易用,方便灵活(商业软件,非开源)。 该Java混淆器是: 独立软件开发商理想选择——保护其重要知识产权; 业界理想选择——防止针对Java代码的内部和外部黑客威胁; Sun的选择——代码防护和混淆。对于企业级应用,作为其Java开发包的一部分,Sun微系统使用DashO Pro来混淆其加密库。 您的选择——超级的代码保护和混淆能
Sequel Pro 的原名是CocoaMySQL,是一个与phpMyAdmin相像的MySQL管理工具。它是由Cocoa和面对对象的C(Mac OSX)编写的。Sequel Pro允许你编辑数据库,表格(字段和索引)和列,执行个性化查找和导入导出数据。
pro-cloud是一个SpringCloud alibaba微服务架构springboot2.x+mybatisplus基于oauth2.0认证,采用Nacos注册和配置中心,集成流量卫兵Sentinel的分布式架构。解决常见的分布式问题, redis/zookeeper分布式锁,分布式事务,sso单点登录问题等 前台主要功能介绍 生成代码模块,节省开发时间,提高开发效率。 统一授权中心,打造平