0.6.5 • Published 7 years ago

react-nav-bar v0.6.5

Weekly downloads
75
License
MIT
Repository
github
Last release
7 years ago

React Navigation Bar

Can be used to create customizable navigation bar for your react project.

Examples:

Full size:

full size

Mobile size

Mobile size

Installation

npm install --save react-nav-bar

Usage and options:

var reactNavBar = require('react-nav-bar');
var NavBar = reactNavBar.NavBar;
var Menu = reactNavBar.Menu;

// Define your menu:
// Menu can be any valid component form within react or objects with the listed properties.
var menus = [
  { path:'menu1', label:'Menu 1', icon:'bell'},
  <div>jsx element</div>,
  { path:'menu3', label:'Menu 3', icon:'bars', subMenus: [
    { path:'menu4', label:'Menu 4'},
    { path:'menu5', label:'Menu 5', subMenus: [
      { path:'menu6', label:'Menu 6' },
      { path:'menu7', label:'Menu 7'},
      React.createClass({ render: function() { return <li>can do that TOO</li>; } }),
      { path:'menu9', label:'Menu 9'}
    ]},
    { path:'menu10', label: <div> You can do that too</div>, icon:'bars'}
  ]}
]

// Then use NavBar to place the menus where you want.
<div className="menu">
  <NavBar menus={menus} theme={'hoverLakeBright'} location={this.props.location} />
</div>

Options

NavBar and Menu have different options

NavBar

  • location {Object} - react-router location object.
  • menus {Array} - required - An array of instantiated menus .
  • theme {String} - Name of the theme you want to use.
  • spring {Object} - An object with details on how menus will open E.G: spring={{ opened:100, closed:0, style: function(x) { return { height:${x}%} } }}
  • toggle {Object} - An object that determines how will the toggle button look
  • openOnHover {Boolean} - Determines if menus will open or close on hover(for mobiles false is recommended).

// icons used are font-awesome icons so: use https://github.com/danawoodman/react-fontawesome for icons reference. toggle object example:

   var toggle = {
     display: false,
     default: 'pied-piper',
     parent: {
       opened: 'bars',
       closed: 'pied-piper'
     },
     child: {
       opened: 'bus',
       closed: 'coffee'
     },
   };

Menu

  • path {String} - required - route to redirect on click.
  • label {String|component} - what will be the menu's text Or component instead.
  • active {Boolean|Function|Undefined|String} - Determines if the menu is active currently.
    • If String or Undefined will check if that string is in pathname to determine if is active.
    • If Boolean will do nothing and use the given value.
    • If Function will invoke the function and assign the returned value to active.
  • action {Function} - Will get invoked when a menu item is clicked and prevent default
  • opened {Boolean} - Flag to indicate if submenu is opened or closed.
  • permission {Function|Boolean} - determines whether or not to show this menu - can be use for access control.
    • If Function Will invoke the function and assign the returned value to visible
    • If Boolean will be assigned to visible
  • subMenus {Array} - an array of submenus with the same signature.
  • className {String} - class name to be used for that menu(in the li)
  • icon {String} - specify an icon for menu.

Themes:

Using custom theme is very simple:

  • copy one of the included themes
  • change the selector theme name to your new theme E.G: .hoverLakeBright_isOpened to .YouThemeName_isOpened
  • set theme option to your theme name
  • include the theme file somewhere in your site

And your done.

0.6.5

7 years ago

0.6.4

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.5

8 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.21

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.33

8 years ago

0.2.32

8 years ago

0.2.31

8 years ago

0.2.30

8 years ago

0.2.29

8 years ago

0.2.28

8 years ago

0.2.27

8 years ago

0.2.26

8 years ago

0.2.25

8 years ago

0.2.24

8 years ago

0.2.23

8 years ago

0.2.22

8 years ago

0.2.21

8 years ago

0.2.20

8 years ago

0.2.19

8 years ago

0.2.18

8 years ago

0.2.17

8 years ago

0.2.16

8 years ago

0.2.15

8 years ago

0.2.14

8 years ago

0.2.13

8 years ago

0.2.12

8 years ago

0.2.11

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.7

8 years ago

0.1.65

8 years ago

0.1.64

8 years ago

0.1.63

8 years ago

0.1.62

8 years ago

0.1.61

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.42

8 years ago

0.1.41

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.24

8 years ago

0.1.23

8 years ago

0.1.22

8 years ago

0.1.21

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.9

8 years ago

0.0.84

8 years ago

0.0.83

8 years ago

0.0.82-s

8 years ago

0.0.81

8 years ago

0.0.8

8 years ago

0.0.78

8 years ago

0.0.77

8 years ago

0.0.76

8 years ago

0.0.75

8 years ago

0.0.74

8 years ago

0.0.73

8 years ago

0.0.72

8 years ago

0.0.71

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago