Navs and tabs
Use the nav shortcode to show a group of multiple tab panes.
Use the nav
shortcode to show a group of multiple tab panes. Add nav-item
inner elements for each tab pane.
show
to the class
argument.{{< nav id="links-1" fade="true" >}}
{{< nav-item header="Nav Item #1" show="true" >}}
This is the first item's nav body. It supports HTML content. The item is shown by adding the value
<code>show</code> to the <code>class</code> argument.
{{< /nav-item >}}
{{< nav-item header="Nav Item #2" >}}
This is the second item's nav body.
{{< /nav-item >}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}
The shortcode supports the following arguments:
Argument | Required | Description |
---|---|---|
id | No | Optional identifier of the tab group, uses a generated sequence if not specified. |
type | No | Optional type of the tab group, either “tabs”, “pills”, or “underline”. Uses links by default. |
vertical | No | Optional flag to show vertical tabs instead of horizontal tabs (default). |
fade | No | Optional flag to make tab panes fade in. |
class | No | Optional class attribute of the tab group, e.g. “nav-fill”. |
Add an inner nav-item
element for each item of the tab group. The nav-item
element supports the following arguments:
Argument | Required | Description |
---|---|---|
header | Yes | Required header of the tab pane. |
class | No | Optional class attribute of the inner tab pane. |
show | No | Optional flag to indicate an item should be shown as expanded (only one can be shown at a time). |
disabled | No | Optional flag to indicate an item should be in a disabled state. |
Change the style of your nav with class attributes and arguments.
By default, navs are left-aligned, but you can easily change them to center or right aligned.
Centered with .justify-content-center
:
{{< nav class="justify-content-center" >}}
{{< nav-item header="Nav Item #1" show="true" />}}
{{< nav-item header="Nav Item #2" />}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}
Right-aligned with .justify-content-end
:
{{< nav class="justify-content-end" >}}
{{< nav-item header="Nav Item #1" show="true" />}}
{{< nav-item header="Nav Item #2" />}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}
Stack your navigation by setting vertical
to true
.
{{< nav vertical="true" >}}
{{< nav-item header="Nav Item #1" show="true" />}}
{{< nav-item header="Nav Item #2" />}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}
Takes the basic nav from above and generates a tabbed interface by setting type
to tabs
. The inner content of each nav-item
is rendered within a linked tab pane. The content supports embedded HTML.
show
to the class
argument.{{< nav type="tabs" id="tabs-1" >}}
{{< nav-item header="Nav Item #1" show="true" >}}
This is the first item's nav body. It supports HTML content. The item is shown by adding the value
<code>show</code> to the <code>class</code> argument.
{{< /nav-item >}}
{{< nav-item header="Nav Item #2" >}}
This is the second item's nav body. It too supports HTML content.
{{< /nav-item >}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}
Take that same HTML, but using pills
instead:
show
to the class
argument.{{< nav type="pills" id="pills-1" >}}
{{< nav-item header="Nav Item #1" show="true" >}}
This is the first item's nav body. It supports HTML content. The item is shown by adding the value
<code>show</code> to the <code>class</code> argument.
{{< /nav-item >}}
{{< nav-item header="Nav Item #2" >}}
This is the second item's nav body. It too supports HTML content.
{{< /nav-item >}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}
Take that same HTML, but using underline
instead:
show
to the class
argument.{{< nav type="underline" id="underline-1" >}}
{{< nav-item header="Nav Item #1" show="true" >}}
This is the first item's nav body. It supports HTML content. The item is shown by adding the value
<code>show</code> to the <code>class</code> argument.
{{< /nav-item >}}
{{< nav-item header="Nav Item #2" >}}
This is the second item's nav body. It too supports HTML content.
{{< /nav-item >}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}
To proportionately fill all available space with your .nav-items
, use .nav-fill
. Notice that all horizontal space is occupied, but not every nav item has the same width.
{{< nav type="pills" class="nav-fill" >}}
{{< nav-item header="Nav Item #1" show="true" />}}
{{< nav-item header="Much longer nav item #2" />}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}
For equal-width elements, use .nav-justified
. All horizontal space will be occupied by nav links, but unlike the .nav-fill
above, every nav item will be the same width.
{{< nav type="pills" class="nav-justified" >}}
{{< nav-item header="Nav Item #1" show="true" />}}
{{< nav-item header="Much longer nav item #2" />}}
{{< nav-item header="Nav Item #3" disabled="true" />}}
{{< /nav >}}