Documentation and examples for how to use Bootstrap's included navigation components.
Navigation available in Bootstrap share general markup and styles, from the base NavList
component to the active and disabled states. Swap modifier classes to switch between each style.
The base NavList
component is built with flexbox and provide a strong foundation for building all types of navigation components. It includes some style overrides (for working with lists), some link padding for larger hit areas, and basic disabled styling.
Change the style of NavList
s component with modifiers and utilities. Mix and match as needed, or build your own.
Change the horizontal alignment of your nav with flexbox utilities . By default, navs are left-aligned, but you can easily change them to center or right aligned.
Centered with justify-content="center"
attribute:
Right-aligned with justify-content="end"
attribute:
Stack your navigation by changing the flex item direction with the flex-direction="column"
attribute. Need to stack them on some viewports but not others? Use the responsive versions (e.g., flex-direction="sm-column"
).
As always, vertical navigation is possible without NavItem
s component, too.
Takes the basic nav from above and adds the nav="tabs"
attribute to generate a tabbed interface. Use them to create tabbable regions with our tab JavaScript plugin.
Take that same HTML, but use nav="pills"
attribute instead:
Take that same HTML, but use nav="underline"
attribute instead:
Force your NavList
's contents to extend the full available width one of two modifier classes. To proportionately fill all available space with your NavItem
s component, use fill
attribute. Notice that all horizontal space is occupied, but not every nav item has the same width.
When using a Nav
component-based navigation, you can safely omit NavItem
compoentnt as only NavLink
comoponent is required for styling NavLink
component elements.
For equal-width elements, use justified
attribute. All horizontal space will be occupied by nav links, but unlike the fill
attribute above, every nav item will be the same width.
Similar to the fill
component example using a Nav
component-based navigation.
If you need responsive nav variations, consider using a series of flexbox utilities . While more verbose, these utilities offer greater customization across responsive breakpoints. In the example below, our nav will be stacked on the lowest breakpoint, then adapt to a horizontal layout that fills the available width starting from the small breakpoint.
If you're using navs to provide a navigation bar, be sure to add a role="navigation"
to the most logical parent container of the NavList
component, or wrap a Nav
component around the whole navigation. Do not add the role to the NavList
component itself, as this would prevent it from being announced as an actual list by assistive technologies.
Note that navigation bars, even if visually styled as tabs with the nav="tabs"
attribute, should **not** be given role="tablist"
, role="tab"
or role="tabpanel"
attributes. These are only appropriate for dynamic tabbed interfaces, as described in the . See JavaScript behavior for dynamic tabbed interfaces in this section for an example. The aria-current
attribute is not necessary on dynamic tabbed interfaces since our JavaScript handles the selected state by adding aria-selected="true"
attribute on the active tab.
Add dropdown menus with a little extra HTML and the dropdowns JavaScript plugin .
This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
The tabs plugin also works with pills.
This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
And with vertical pills.
This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Settings tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
You can activate a tab or pill navigation without writing any JavaScript by simply specifying tab
attribute or pill
attribute on an element. Use these data attributes on NavList
component with nav="tabs"
attribute or nav="pills"
attribute.
This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Messages tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Settings tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
To make tabs fade in, add fade
atribute to each TabPane
component. The first tab pane must also have show
attribute to make the initial content visible.
This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.
This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav
-powered navigation.