3.3 KiB
title |
---|
Tabs and Pills |
Tabs and Pills
Tabs and Pills are forms of navigation. Meaning they help the end-user navigate through the site in a user-friendly manner.
Tabs
To achieve bootstrap tabs, first you need an element that has the .nav
class assigned to it. Then you simply add an extra class named .nav-tabs
.
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
Pills
Bootstrap Pills is achieved the same way as Bootstrap Tabs except instead of .nav-tabs
, use .nav-pills
.
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
Pills Stacked
Bootstrap Pills are also vertically stackable by using .nav stacked
in conjunction with .nav-pills
.
<ul class="nav nav-pills nav-stacked">
...
</ul>
Bootstrap Tabs/Pills Justified
Both Bootstrap Tabs and Pills can have equal width of their parent at screens wider than 768px by using .nav-justified
class. On smaller screens, the nav links are stacked.
<ul class="nav nav-tabs nav-justified">
...
</ul>
<ul class="nav nav-pills nav-justified">
...
</ul>
Disabled Links
For any nav component (tabs or pills) add .disabled
for gray links and no hover effects
<ul class="nav nav-pills">
...
<li role="presentation" class="disabled"><a href="#">Disabled link</a></li>
...
</ul>
Tabs with Dropdowns
Add dropdown menus to your nav tabs.
<ul class="nav nav-tabs">
...
<li role="presentation" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Dropdown <span class="caret"></span>
</a>
<ul class="dropdown-menu">
...
</ul>
</li>
...
</ul>
Tabs with Dropdowns
Add dropdown menus to your nav pills.
<ul class="nav nav-pills">
...
<li role="presentation" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Dropdown <span class="caret"></span>
</a>
<ul class="dropdown-menu">
...
</ul>
</li>
...
</ul>