0.6.5 • Published 9 years ago

react-nav-bar v0.6.5

Weekly downloads
75
License
MIT
Repository
github
Last release
9 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

9 years ago

0.6.4

9 years ago

0.6.3

9 years ago

0.6.2

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.21

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.33

9 years ago

0.2.32

9 years ago

0.2.31

9 years ago

0.2.30

9 years ago

0.2.29

9 years ago

0.2.28

9 years ago

0.2.27

9 years ago

0.2.26

9 years ago

0.2.25

9 years ago

0.2.24

9 years ago

0.2.23

9 years ago

0.2.22

9 years ago

0.2.21

9 years ago

0.2.20

9 years ago

0.2.19

9 years ago

0.2.18

9 years ago

0.2.17

9 years ago

0.2.16

9 years ago

0.2.15

9 years ago

0.2.14

9 years ago

0.2.13

9 years ago

0.2.12

9 years ago

0.2.11

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.7

9 years ago

0.1.65

9 years ago

0.1.64

9 years ago

0.1.63

9 years ago

0.1.62

9 years ago

0.1.61

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.42

9 years ago

0.1.41

9 years ago

0.1.4

9 years ago

0.1.3

10 years ago

0.1.24

10 years ago

0.1.23

10 years ago

0.1.22

10 years ago

0.1.21

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.9

10 years ago

0.0.84

10 years ago

0.0.83

10 years ago

0.0.82-s

10 years ago

0.0.81

10 years ago

0.0.8

10 years ago

0.0.78

10 years ago

0.0.77

10 years ago

0.0.76

10 years ago

0.0.75

10 years ago

0.0.74

10 years ago

0.0.73

10 years ago

0.0.72

10 years ago

0.0.71

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago