🔥 Meet Our New Project: t0ggles - Your Ultimate Project Management Tool!

Navbar React Component

Navbar is a fixed (with Fixed and Through layout types) area at the top of a screen that contains Page title and navigation elements.

Navbar React component represents Navbar component.

There are following components included:

PropTypeDefaultDescription
<Navbar> properties
titlestringNavbar title
subtitlestringNavbar sub title
backLinkboolean
string
Adds back-link with text (if string value is specified)
backLinkUrlstringCustom back link URL
backLinkForcebooleanfalseForce page to load and ignore previous page in history
backLinkShowTextbooleanBy default back link text disable for MD theme
slidingbooleantrueEnables "sliding" effect for nav elements
outlinebooleantrueAdds navbar bottom thin border (hairline) for iOS theme
hiddenbooleanfalseMakes navbar hidden
innerClassstringAdds additional class to navbar-inner element
innerClassNamestringAlias for innerClass prop
largebooleanEnables navbar with large title
transparentbooleanMakes navbar transparent. Can be used in addition to large prop to make large navbar transparent.
titleLargestringNavbar large title text. If not specified then will be equal to title prop
<NavLeft> properties
backLinkboolean
string
Adds back-link with text (if string value is specified)
backLinkUrlstringCustom back link URL
backLinkForcebooleanfalseForce page to load and ignore previous page in history
backLinkShowTextbooleanBy default back link text disable for MD theme
slidingbooleanEnables "sliding" effect. By default inherits sliding prop of parent Navbar
<NavTitle> properties
titlestringSpecifies element inner title text (affects if there is no child elements)
subtitlestringSub title text
slidingbooleanEnables "sliding" effect. By default inherits sliding prop of parent Navbar
<NavRight> properties
slidingbooleanEnables "sliding" effect. By default inherits sliding prop of parent Navbar
<Navbar> methods
.hide(animate)Hide navbar
.show(animate)Show navbar
.size()Size navbar
EventDescription
<Navbar> events
backClick
clickBack
Event will be triggered after click on navbar back link
navbarHideEvent will be triggered when Navbar becomes hidden
navbarShowEvent will be triggered when Navbar becomes visible
navbarCollapseEvent will be triggered when Navbar with large title collapsed (from large navbar to usual navbar)
navbarExpandEvent will be triggered when Navbar with large title expanded (from usual navbar to large navbar)
<NavLeft> events
backClick
clickBack
Event will be triggered after click on navbar back link

Navbar React component (<Navbar>) has additional slots for custom elements:

<Navbar title="My App">
  <a href="#" slot="left">Left Link</a>
  <a href="#" slot="right">Right Link</a>
  <div slot="before-inner">Before Inner</div>
  <div slot="after-inner">After Inner</div>
  <div>Default slot</div>
</Navbar>

{/* Renders to: */}

<div class="navbar">
  <div class="navbar-bg"></div>
  <div>Before Inner</div>
  <div class="navbar-inner">
    <div class="left">
      <a href="#">Left Link</a>
    </div>
    <div class="title">My App</div>
    <div class="right">
      <a href="#">Right Link</a>
    </div>
    <div>Default slot</div>
  </div>
  <div>After Inner</div>
</div>

Examples

Minimal layout

<Navbar title="My App"></Navbar>

Minimal layout with back link

<Navbar title="My App" backLink="Back"></Navbar>

Without "sliding" transition effect (affects iOS theme only)

<Navbar title="My App" backLink="Back" sliding="{false}"></Navbar>

With additional right link to open right panel

<Navbar title="My App" backLink="Back">
  <NavRight>
    <Link icon="icon-bars" panelOpen="right"></Link>
  </NavRight>
</Navbar>

{/* or */}

<Navbar title="My App" backLink="Back">
  <Link slot="right" icon="icon-bars" panelOpen="right"></Link>
</Navbar>

With large title

<Navbar title="My App" backLink="Back" large></Navbar>

{/* with different large title text */}

<Navbar title="My App" backLink="Back" large titleLarge="Large Title"></Navbar>

All three parts

<Navbar>
  <NavLeft backLink="Back"></NavLeft>
  <NavTitle>My App</NavTitle>
  <NavRight>
    <Link icon="icon-bars" panelOpen="right"></Link>
  </NavRight>
</Navbar>

Full custom layout

<Navbar>
  <NavLeft>
    <Link>Left Link</Link>
  </NavLeft>
  <NavTitle>My App</NavTitle>
  <NavRight>
    <Link>Right Link</Link>
  </NavRight>
</Navbar>