Base nav
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.
<template>
<NavList>
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
<template>
<Nav>
<NavLink active>
Active
</NavLink>
<NavLink>Link</NavLink>
<NavLink>Link</NavLink>
<NavLink disabled>
Disabled
</NavLink>
</Nav>
</template>
Available styles
Change the style of NavList
s component with modifiers and utilities. Mix and match as needed, or build your own.
Horizontal alignment
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:
<template>
<NavList justify-content="center">
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
Right-aligned with justify-content="end"
attribute:
<template>
<NavList justify-content="end">
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
Vertical
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"
).
<template>
<NavList flex-direction="column">
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
As always, vertical navigation is possible without NavItem
s component, too.
<template>
<NavList flex-direction="column">
<NavLink active>
Active
</NavLink>
<NavLink>Link</NavLink>
<NavLink>Link</NavLink>
<NavLink disabled>
Disabled
</NavLink>
</NavList>
</template>
Tabs
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.
<template>
<NavList nav="tabs">
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
Pills
Take that same HTML, but use nav="pills"
attribute instead:
<template>
<NavList nav="pills">
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
Take that same HTML, but use nav="underline"
attribute instead:
<template>
<NavList nav="underline">
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
Fill and justify
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.
<template>
<NavList
nav="pills"
fill
>
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Much longer nav link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
When using a Nav
component-based navigation, you can safely omit NavItem
compoentnt as only NavLink
comoponent is required for styling NavLink
component elements.
<template>
<Nav
nav="pills"
fill
>
<NavLink active>
Active
</NavLink>
<NavLink>Much longer nav link</NavLink>
<NavLink>Link</NavLink>
<NavLink disabled>
Disabled
</NavLink>
</Nav>
</template>
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.
<template>
<NavList
nav="pills"
justified
>
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItem>
<NavLink>Much longer nav link</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
Similar to the fill
component example using a Nav
component-based navigation.
<template>
<Nav
nav="pills"
justified
>
<NavLink active>
Active
</NavLink>
<NavLink>Much longer nav link</NavLink>
<NavLink>Link</NavLink>
<NavLink disabled>
Disabled
</NavLink>
</Nav>
</template>
Working with flex utilities
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.
<template>
<Nav
nav="pills"
flex-direction="column sm-row"
>
<NavLink
flex-fill="sm"
text-alignment="sm-center"
active
>
Active
</NavLink>
<NavLink
flex-fill="sm"
text-alignment="sm-center"
>
Much longer nav link
</NavLink>
<NavLink
flex-fill="sm"
text-alignment="sm-center"
>
Link
</NavLink>
<NavLink
flex-fill="sm"
text-alignment="sm-center"
disabled
>
Disabled
</NavLink>
</Nav>
</template>
Regarding accessibility
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.
Using dropdowns
Add dropdown menus with a little extra HTML and the dropdowns JavaScript plugin .
Tabs with dropdowns
<template>
<NavList nav="tabs">
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItemDropdown>
<NavItemDropdownToggle>Dropdown button</NavItemDropdownToggle>
<DropdownMenu>
<DropdownItem to="/">
Action
</DropdownItem>
<DropdownItem>Another action</DropdownItem>
<DropdownItemDivider />
<DropdownItem>Something else here</DropdownItem>
</DropdownMenu>
</NavItemDropdown>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
Pills with dropdowns
<template>
<NavList nav="pills">
<NavItem>
<NavLink active>
Active
</NavLink>
</NavItem>
<NavItemDropdown>
<NavItemDropdownToggle>Dropdown button</NavItemDropdownToggle>
<DropdownMenu>
<DropdownItem to="/">
Action
</DropdownItem>
<DropdownItem>Another action</DropdownItem>
<DropdownItemDivider />
<DropdownItem>Something else here</DropdownItem>
</DropdownMenu>
</NavItemDropdown>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>
JavaScript behavior
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.
<template>
<NavList
nav="tabs"
margin="b-3"
tablist
>
<NavItem>
<NavLink
active
toggle="nav"
tab="#home"
>
Home
</NavLink>
</NavItem>
<NavItem>
<NavLink
toggle="nav"
tab="#profile"
>
Profile
</NavLink>
</NavItem>
<NavItem>
<NavLink
toggle="nav"
tab="#contact"
>
Contact
</NavLink>
</NavItem>
</NavList>
<TabContent>
<TabPane
id="home"
active
>
<p>
<strong>
This is some placeholder content the Home tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="profile">
<p>
<strong>
This is some placeholder content the Profile tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="contact">
<p>
<strong>
This is some placeholder content the Contact tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
</TabContent>
</template>
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.
<template>
<NavList
nav="tabs"
margin="b-3"
tablist
>
<NavLink
active
toggle="tab"
tab="#home"
>
Home
</NavLink>
<NavLink
toggle="tab"
tab="#profile"
>
Profile
</NavLink>
<NavLink
toggle="tab"
tab="#contact"
>
Contact
</NavLink>
</NavList>
<TabContent>
<TabPane
id="home"
active
>
<p>
<strong>
This is some placeholder content the Home tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="profile">
<p>
<strong>
This is some placeholder content the Profile tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="contact">
<p>
<strong>
This is some placeholder content the Contact tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
</TabContent>
</template>
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.
<template>
<NavList
nav="pills"
margin="b-3"
tablist
>
<NavItem role="presentation">
<NavLink
active
toggle="nav"
tab="#pills-home"
>
Home
</NavLink>
</NavItem>
<NavItem>
<NavLink
toggle="nav"
tab="#pills-profile"
>
Profile
</NavLink>
</NavItem>
<NavItem>
<NavLink
toggle="nav"
tab="#pills-contact"
>
Contact
</NavLink>
</NavItem>
</NavList>
<TabContent>
<TabPane
id="pills-home"
active
>
<p>
<strong>
This is some placeholder content the Home tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="pills-profile">
<p>
<strong>
This is some placeholder content the Profile tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="pills-contact">
<p>
<strong>
This is some placeholder content the Contact tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
</TabContent>
</template>
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.
<template>
<b-div
flex
align-items="start"
>
<NavList
nav="pills"
margin="e-3"
tablist
>
<NavLink
active
tab="#v-pills-home"
>
Home
</NavLink>
<NavLink tab="#v-pills-profile">
Profile
</NavLink>
<NavLink tab="#v-pills-contact">
Messages
</NavLink>
<NavLink tab="#v-pills-settings">
Settings
</NavLink>
</NavList>
</b-div>
<TabContent>
<TabPane
id="v-pills-home"
active
>
<p>
<strong>
This is some placeholder content the Home tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="v-pills-profile">
<p>
<strong>
This is some placeholder content the Profile tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="v-pills-contact">
<p>
<strong>
This is some placeholder content the Contact tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane id="v-pills-settings">
<p>
<strong>
This is some placeholder content the Settings tab's associated
content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
</TabContent>
</template>
Using data attributes
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.
<template>
<NavList nav="tabs">
<NavItem>
<NavLink
active
tab="#home"
link="dark"
>
Home
</NavLink>
</NavItem>
<NavItem>
<NavLink
tab="#profile"
link="dark"
>
profile
</NavLink>
</NavItem>
<NavItem>
<NavLink
tab="#messages"
link="dark"
>
Link
</NavLink>
</NavItem>
<NavItem>
<NavLink
tab="#settings"
link="dark"
>
Settings
</NavLink>
</NavItem>
</NavList>
<!-- Nav tabs -->
<TabContent>
<TabPane
id="home"
active
>
<b-p>
<strong>
This is some placeholder content the Home tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</b-p>
</TabPane>
<TabPane id="profile">
<b-p>
<strong>
This is some placeholder content the Profile tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</b-p>
</TabPane>
<TabPane id="messages">
<b-p>
<strong>
This is some placeholder content the Messages tab's associated
content.
</strong>
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
<code>.nav</code>
-powered navigation.
</b-p>
</TabPane>
<TabPane id="settings">
<b-p>
<strong>
This is some placeholder content the Settings tab's associated
content.
</strong>
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
<code>.nav</code>
-powered navigation.
</b-p>
</TabPane>
</TabContent>
</template>
Fade effect
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.
<template>
<NavList
nav="tabs"
margin="b-3"
tablist
>
<NavItem>
<NavLink
active
toggle="nav"
tab="#home"
>
Home
</NavLink>
</NavItem>
<NavItem>
<NavLink
toggle="nav"
tab="#profile"
>
Profile
</NavLink>
</NavItem>
<NavItem>
<NavLink
toggle="nav"
tab="#contact"
>
Contact
</NavLink>
</NavItem>
</NavList>
<TabContent>
<TabPane
id="home"
fade
active
>
<p>
<strong>
This is some placeholder content the Home tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane
id="profile"
fade
>
<p>
<strong>
This is some placeholder content the Profile tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
<TabPane
id="contact"
fade
>
<p>
<strong>
This is some placeholder content the Contact tab's associated content.
</strong>
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
<code>.nav</code>
-powered navigation.
</p>
</TabPane>
</TabContent>
</template>
Auto activate
<template>
<NavList nav="pills">
<NavItem>
<NavLink to="/lang-en/components/navs-tabs">
Lang-en
</NavLink>
</NavItem>
<NavItem>
<NavLink to="/lang-ja/components/navs-tabs">
Lang-ja
</NavLink>
</NavItem>
<NavItem>
<NavLink>Link</NavLink>
</NavItem>
<NavItem>
<NavLink disabled>
Disabled
</NavLink>
</NavItem>
</NavList>
</template>