Navigation available in Bootstrap share general markup and styles, from the base `.nav` class to the active and disabled states. Swap modifier classes to switch between each style.
## Contents
* Will be replaced with the ToC, excluding the "Contents" header
{:toc}
## Regarding accessibility
If you are using navs to provide a navigation bar, be sure to add a `role="navigation"` to the most logical parent container of the `<ul>`, or wrap a `<nav>` element around the whole navigation. Do not add the role to the `<ul>` itself, as this would prevent it from being announced as an actual list by assistive technologies.
## Base nav
Roll your own navigation style by extending the base `.nav` component. All Bootstrap's nav components are built on top of this by specifying additional styles. Includes styles for the disabled state, but **not the active state**.
{% example html %}
<ulclass="nav">
<liclass="nav-item">
<aclass="nav-link active"href="#">Active</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link disabled"href="#">Disabled</a>
</li>
</ul>
{% endexample %}
Classes are used throughout, so your markup can be super flexible. Use `<ul>`s like above, or roll your own with say a `<nav>` element. The change in nav item display below **is intentional** as `<li>`s have a different default `display` than regular `<a>` elements.
{% example html %}
<navclass="nav">
<aclass="nav-link active"href="#">Active</a>
<aclass="nav-link"href="#">Link</a>
<aclass="nav-link"href="#">Link</a>
<aclass="nav-link disabled"href="#">Disabled</a>
</nav>
{% endexample %}
## Inline
Space out nav links in a horizontal band with `.nav-inline`. Longer series of links will wrap to a new line.
{% example html %}
<navclass="nav nav-inline">
<aclass="nav-link active"href="#">Active</a>
<aclass="nav-link"href="#">Link</a>
<aclass="nav-link"href="#">Link</a>
<aclass="nav-link disabled"href="#">Disabled</a>
</nav>
{% endexample %}
The same works for a navigation built with lists.
{% example html %}
<ulclass="nav nav-inline">
<liclass="nav-item">
<aclass="nav-link active"href="#">Active</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link disabled"href="#">Disabled</a>
</li>
</ul>
{% endexample %}
## Tabs
Takes the basic nav from above and adds the `.nav-tabs` class to generate a tabbed interface. Use them to create tabbable regions with our [tab JavaScript plugin](#javascript-behavior).
{% example html %}
<ulclass="nav nav-tabs">
<liclass="nav-item">
<aclass="nav-link active"href="#">Active</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link disabled"href="#">Disabled</a>
</li>
</ul>
{% endexample %}
## Pills
Take that same HTML, but use `.nav-pills` instead:
{% example html %}
<ulclass="nav nav-pills">
<liclass="nav-item">
<aclass="nav-link active"href="#">Active</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link disabled"href="#">Disabled</a>
</li>
</ul>
{% endexample %}
### Stacked pills
Add `.nav-stacked` to the `.nav.nav-pills` to stack them vertically. Each `.nav-link` becomes block-level, allowing for larger hit areas via mouse or tap.
{% example html %}
<ulclass="nav nav-pills nav-stacked">
<liclass="nav-item">
<aclass="nav-link active"href="#">Active</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link"href="#">Link</a>
</li>
<liclass="nav-item">
<aclass="nav-link disabled"href="#">Disabled</a>
</li>
</ul>
{% endexample %}
As always, stacked pills are possible without `<ul>`s.
{% example html %}
<navclass="nav nav-pills nav-stacked">
<aclass="nav-link active"href="#">Active</a>
<aclass="nav-link"href="#">Link</a>
<aclass="nav-link"href="#">Link</a>
<aclass="nav-link disabled"href="#">Disabled</a>
</nav>
{% endexample %}
## Using dropdowns
Add dropdown menus with a little extra HTML and the [dropdowns JavaScript plugin]({{ site.baseurl }}/components/dropdowns/#usage).
Use the tab JavaScript plugin—include it individually or through the compiled `bootstrap.js` file—to extend our navigational tabs and pills to create tabbable panes of local content, even via dropdown menus.
<p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
<p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
</div>
</div>
</div>
### Using data attributes
You can activate a tab or pill navigation without writing any JavaScript by simply specifying `data-toggle="tab"` or `data-toggle="pill"` on an element. Use these data attributes on `.nav-tabs` or `.nav-pills`.
Selects the given tab and shows its associated pane. Any other tab that was previously selected becomes unselected and its associated pane is hidden. **Returns to the caller before the tab pane has actually been shown** (i.e. before the `shown.bs.tab` event occurs).
{% highlight js %}
$('#someTab').tab('show')
{% endhighlight %}
### Events
When showing a new tab, the events fire in the following order:
1.`hide.bs.tab` (on the current active tab)
2.`show.bs.tab` (on the to-be-shown tab)
3.`hidden.bs.tab` (on the previous active tab, the same one as for the `hide.bs.tab` event)
4.`shown.bs.tab` (on the newly-active just-shown tab, the same one as for the `show.bs.tab` event)
If no tab was already active, then the `hide.bs.tab` and `hidden.bs.tab` events will not be fired.
<td>This event fires on tab show, but before the new tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
</tr>
<tr>
<td>shown.bs.tab</td>
<td>This event fires on tab show after a tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
</tr>
<tr>
<td>hide.bs.tab</td>
<td>This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use <code>event.target</code> and <code>event.relatedTarget</code> to target the current active tab and the new soon-to-be-active tab, respectively.</td>
</tr>
<tr>
<td>hidden.bs.tab</td>
<td>This event fires after a new tab is shown (and thus the previous active tab is hidden). Use <code>event.target</code> and <code>event.relatedTarget</code> to target the previous active tab and the new active tab, respectively.</td>
</tr>
</tbody>
</table>
{% highlight js %}
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {