Reputation: 271
Has anyone used react pro sidebar. Can someone tell me how to use sass sidebar components and how to increase the length of the sidebar. are there any other libraries with examples of how to use their sidebar. Here is the react pro sidebar example.
<ProSidebar>
<SidebarHeader>
{
Dashboard}
</SidebarHeader>
<Menu iconShape="square">
<MenuItem>Dashboard</MenuItem>
<SubMenu title="Components">
<MenuItem>Component 1</MenuItem>
<MenuItem>Component 2</MenuItem>
</SubMenu>
<SubMenu title="Reports">
<MenuItem>My Report</MenuItem>
<MenuItem>MIS Report</MenuItem>
</SubMenu>
</Menu>
</ProSidebar>
;
Please help
Upvotes: 2
Views: 15436
Reputation: 41
The Pro Sidebar uses nested classes namely(in-oder)
More here-https://www.npmjs.com/package/react-pro-sidebar
So to increase the height of the sidebar use
.pro-sidebar {
position: absolute;
height: 100%;
}
If you want to explore more just use the web-developer tools to find out more
Upvotes: 1
Reputation: 307
To install sass, run
npm install node-sass
Then you just have to create a .scss
file and import it to your react file.
import './custom.scss';
Your custom.scss
could be as simple as:
$sidebar-width: 323px;
@import '~react-pro-sidebar/dist/scss/styles.scss';
Note: if you used css for react-pro-sidebar, remember to remove
import 'react-pro-sidebar/dist/css/styles.css';
Upvotes: 2
Reputation: 486
To increase Sidebar (react-pro-sidebar) component height, just wrap the sidebare in div tag and add style to that div as below:
.sidebar {
height: 60vh !important;
}
<div className='sidebar'>
<ProSidebar>
<SidebarHeader>
{
Dashboard}
</SidebarHeader>
<Menu iconShape="square">
<MenuItem>Dashboard</MenuItem>
<SubMenu title="Components">
<MenuItem>Component 1</MenuItem>
<MenuItem>Component 2</MenuItem>
</SubMenu>
<SubMenu title="Reports">
<MenuItem>My Report</MenuItem>
<MenuItem>MIS Report</MenuItem>
</SubMenu>
</Menu>
</ProSidebar>
</div>
Upvotes: 2