# Navbars and menus

> Navbars allow visitors to navigate your help center and are often featured in the page header.

Source: https://www.zenplates.co/documentation/elements/navbars-and-menus/ (Elements › Navigation)

## Colors

Use `.navbar-light` and `.navbar-dark` for light and dark navbars, respectively.

These classes ensure that `.navbar-brand`, `.navbar-toggle` and `.nav-link` elements adopt colors appropriate to the background color of the `.navbar`.

**Example: Light navbar**

```html
<nav class="navbar navbar-light flex-column p-4 border-bottom bg-white sm:flex-row">
  {{#link 'help_center' class='navbar-brand mr-auto'}}
    <img class="block img-fluid z-100" id="logo" src="{{settings.logo}}" alt="{{t 'home_page' name=help_center.name}}" />
    {{~#if settings.tagline}}
      <span class="navbar-tagline mx-3 white-space-no-wrap lg:font-size-lg">
        {{~#if settings.use_translations}}
          {{dc settings.tagline}}
        {{else}}
          {{settings.tagline}}
        {{/if~}}
      </span>
    {{/if~}}
  {{/link}}
  <div class="nav flex-column justify-content-center text-center font-size-md sm:flex-row">
    {{#if help_center.community_enabled}}
      {{link 'community' class='nav-link'}}
    {{/if}}
    {{link 'new_request' class='nav-link'}}
  </div>
</nav>
```

**Example: Dark navbar**

```html
<nav class="navbar navbar-light flex-column p-4 border-bottom bg-gray-800 sm:flex-row">
  {{#link 'help_center' class='navbar-brand mr-auto'}}
    <img class="block img-fluid z-100" id="logo" src="{{settings.logo}}" alt="{{t 'home_page' name=help_center.name}}" />
    {{~#if settings.tagline}}
      <span class="navbar-tagline mx-3 white-space-no-wrap lg:font-size-lg">
        {{~#if settings.use_translations}}
          {{dc settings.tagline}}
        {{else}}
          {{settings.tagline}}
        {{/if~}}
      </span>
    {{/if~}}
  {{/link}}
  <div class="nav flex-column justify-content-center text-center font-size-md sm:flex-row">
    {{#if help_center.community_enabled}}
      {{link 'community' class='nav-link'}}
    {{/if}}
    {{link 'new_request' class='nav-link'}}
  </div>
</nav>
```

The background color and link color of the navbar in the page header of our themes are defined in theme settings. Light and dark navbars are useful for use elsewhere in the help center, for example on the Contributions page.

You can apply your own colors to navbar elements and navbar links using utilities like `.text-gray-600` and `.hover:text-gray-700`.

## Toggle

Use `.navbar-toggle` to display an animated, hamburger-style menu toggle on small screen sizes.

```html
<button class="navbar-toggle ml-2 {{settings.nav_breakpoint}}:hidden">
  <span></span>
  <span class="sr-only">{{t 'toggle_navigation'}}</span>
</button>
```

## Brand

Use `.navbar-brand` on the link containing your logo to ensure that it inherits the appropriate color scheme. The color is inherited by the optional tagline, which is configurable through theme settings, as well as the logo itself if you choose to use an inline SVG with the `.fill-current` utility.

```html
{{#link 'help_center' class='navbar-brand mr-auto'}}
  <img class="block img-fluid z-100" id="logo" src="{{settings.logo}}" alt="{{t 'home_page' name=help_center.name}}" />
  {{~#if settings.tagline}}
    <span class="navbar-tagline mx-3 white-space-no-wrap lg:font-size-lg">
      {{~#if settings.use_translations}}
        {{dc settings.tagline}}
      {{else}}
        {{settings.tagline}}
      {{/if~}}
    </span>
  {{/if~}}
{{/link}}

{{#link 'help_center' class='navbar-brand mr-auto'}}
  <img class="block img-fluid z-100" id="logo" src="{{settings.logo}}" alt="{{t 'home_page' name=help_center.name}}" />
  {{~#if settings.tagline}}
    <span class="navbar-tagline badge mx-3 white-space-no-wrap">
      {{~#if settings.use_translations}}
        {{dc settings.tagline}}
      {{else}}
        {{settings.tagline}}
      {{/if~}}
    </span>
  {{/if~}}
{{/link}}
```

The tagline can be given a different look-and-feel using utilities or elements, like the [badge style](https://www.zenplates.co/documentation/elements/badges) used in the example above.

## Menu

Use `.menu` on a `.nav` element to create a responsive menu.

Our themes allow you to define when the menu changes from a collapsible mobile menu to a standard navbar menu and what style the mobile menu has. The two built-in options are standard (where the menu fades in and out) and slide-in (where the menu slides in from the left-hand side of the screen).

**Example: Standard navigation menu**

```html
<div x-data="mobileMenu">
  <header class="header relative border-bottom bg-white mb-6" x-data="header({ isFixed: false, isSticky: false })">
    <nav class="navbar container h-full">
     <a href="#" class="navbar-brand mr-auto">
        <img class="block img-fluid z-100" id="logo" src="/assets/images/logo.svg" alt="" />
      </a>
      <button class="navbar-toggle ml-2 md:hidden" x-ref="toggle" x-bind:aria-expanded="isOpen && 'true'" @click="toggle" x-on:keydown.escape="toggle">
        <span></span>
        <span class="sr-only">Toggle navigation</span>
      </button>
      <div class="nav menu menu-standard md:flex md:font-size-md md:menu-expanded md:justify-content-end" x-cloak x-show="isOpen" :class="{ 'text-header': isOpen }"
        x-transition:enter="transition-fast"
        x-transition:enter-start="opacity-0"
        x-transition:enter-end="opacity-100"
        x-transition:leave="transition-fast"
        x-transition:leave-start="opacity-100 text-header"
        x-transition:leave-end="opacity-0 text-header"
      >
        <div class="hidden search search-sm text-base mx-4 mb-4 flex-first md:max-w-13 md:flex-1 md:mx-5 md:mb-0 md:hidden" x-data="search">
          <form role="search" class="form-field mb-0" autocomplete="off">
            <input type="search" name="query" id="query" placeholder="Search..." autocomplete="off" />
          </form>
          <svg class="search-icon fill-current transition" xmlns="http://www.w3.org/2000/svg" focusable="false" viewBox="0 0 12 12" aria-hidden="true">
            <circle cx="4.5" cy="4.5" r="4" fill="none" stroke="currentColor"/>
            <path stroke="currentColor" stroke-linecap="round" d="M11 11L7.5 7.5"/>
          </svg>
        </div>
        
          <a class="nav-link" href="#">
            Community
          </a>
        
          <a class="nav-link" href="#">
            Submit a Request
          </a>
        
          <a class="nav-link" href="#">
            Sign in
          </a>
        
      </div>
    </nav>
  </header>
</div>
```
