react-strapmenu
Bootstrap dropdown menu generator for react-router
but why?
It's just another automated everyday-task. A lot kittens developing navigation menus synced with routes, every single day.
but how?
It basically loops through the given routes to generate cute little dropdown menu. like dis ;
teach me
yarn add react-strapmenu
- or -
npm install react-strapmenu --save
then, in your entry point - where the routes are defined - you'll need to expose which routes you want to include in menu. like dis ;
Index.js
ReactDOM;
Route props
- exposed: indicates that you want it in the menu.
- name: name of your menu item.
- icon: icon of your menu item. accepts any css icon class name. ex.
ion-users
,fa fa-users
,glyphicon glyphicon-users
- divideAfter: set menu item divider after that item, exposed or not.
App.js
{ return <div className="App"> <Navbar fixedTop inverse > <NavbarCollapse> <Nav pullRight> <NavbarGenerator routes=thispropsroutes /> </Nav> </NavbarCollapse> </Navbar> <div className="App-header">Insert content here</div> ; } ;
Component props
- routes (required): you have to pass the routes to the component, which can be passed by
this.props.routes
- dropdownProps: props you want to pass to [
<NavDropdown />
][https://react-bootstrap.github.io/components.html#navs-dropdown]
TODO
- Iconless layout
- Tell Me