
How to create responsive seidebar with drowdown menu in react-js
After reading this post you have to create responsive sidebar in reactjs
Installation
-
Install the latest version of react and react-sidenav:
npm install --save react @trendmicro/react-sidenav
-
you can import @trendmicro/react-sidenav and its styles in your application as follows:
import SideNav, { Toggle, Nav, NavItem, NavIcon, NavText } from '@trendmicro/react-sidenav';
// Be sure to include styles at some point, probably during your bootstraping
import '@trendmicro/react-sidenav/dist/react-sidenav.css';
<SideNav
onSelect={(selected) => {
// Add your code here
}}
>
<SideNav.Toggle />
<SideNav.Nav defaultSelected="home">
<NavItem eventKey="home">
<NavIcon>
<i className="fa fa-fw fa-home" style={{ fontSize: '1.75em' }} />
</NavIcon>
<NavText>
Home
</NavText>
</NavItem>
<NavItem eventKey="charts">
<NavIcon>
<i className="fa fa-fw fa-line-chart" style={{ fontSize: '1.75em' }} />
</NavIcon>
<NavText>
Charts
</NavText>
<NavItem eventKey="charts/linechart">
<NavText>
Line Chart
</NavText>
</NavItem>
<NavItem eventKey="charts/barchart">
<NavText>
Bar Chart
</NavText>
</NavItem>
</NavItem>
</SideNav.Nav>
</SideNav>
Post a Comment