Vertical navigation
Overview
Vertical navigation - type of navigation that is used in sidebars and has vertical direction. By default navigation includes custom icons based on 16px grid, aligned to the left (to the right in RTL layout) and have absolute position. In mini sidebar navigation text is hidden. In this type of sidebar icons are centered and have static position. Also optional styling is available: different sizes, bordered nav and layout with right aligned icons. Vertical navigation supports the following options:
Option | Description |
---|---|
Navigation placement | Main navigation can be used in any sidebar type - main, secondary, right and content. Please note - collapsed navigation is allowed only in main sidebar, all other sidebars display full sized navigation. Since navigation is a part of sidebar content, it can be mixed with other components and can be placed before or after them depending on the priority. |
Navigation types | Default navigation type is collapsible: when new item is expanded, current level remains opened. This logic works in all navigation levels. Collapsible navigation doesn't require any additional classes. The second navigation type is accordion: when new item is expanded, current level is collapsed. This logic works in all navigation levels as well. In mini sidebar parent level of navigation doesn't have click event and shows child levels on hover, but child levels functionality remains according to the type of navigation. Sidebar navigation supports up to 4 levels of child menus. To use collapsible nav type, add data-nav-type="collapsible" data attribute to .nav-sidebar container. To use accordion nav type, add data-nav-type="accordion" attribute to .nav-sidebar container. |
Additional styling | Vertical navigation supports a few additional styling options: bordered navigation styling adds horizontal lines to nav items in top level; right icons - icons in vertical navigation can be aligned to the left or to the right. To use right aligned icons, add .nav-sidebar-icons-reverse to .nav-sidebar container |
Navigation options
Collapsible and accordion types
Flexible template functionality offers 2 different types of navigation: collapsible and accordion. Both use custom JS code and provide extended control over the child nav items. Default type is collapsible
navigation: open as many child levels as you want, they all will be visible. Second type is accordion
navigation: allows to display only 1 parent level, collapsing all others. Both navigation types have hidden 2nd level in mini sidebar that triggers on hover.
Collapsible navigation markup
<!-- Collapsible navigation markup -->
<ul class="nav nav-sidebar" data-nav-type="collapsible">
<li class="nav-item-header">
<div class="text-uppercase fs-sm lh-sm opacity-50">Group title</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="ph-plus-circle"></i>
Top level link
</a>
</li>
<li class="nav-item nav-item-submenu">
<a href="#" class="nav-link">
<i class="ph-circles-three-plus"></i>
<span>Top level with subnav</span>
</a>
<ul class="nav-group-sub collapse">
<li class="nav-item">
<a href="#" class="nav-link">2nd level item</a>
</li>
...
</ul>
</li>
...
</ul>
<!-- /collapsible navigation markup -->
Accordion navigation markup
<!-- Accordion navigation markup -->
<ul class="nav nav-sidebar" data-nav-type="accordion">
<li class="nav-item-header">
<div class="text-uppercase fs-sm lh-sm opacity-50">Group title</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="ph-plus-circle"></i>
Top level link
</a>
</li>
<li class="nav-item nav-item-submenu">
<a href="#" class="nav-link">
<i class="ph-circles-three-plus"></i>
<span>Top level with subnav</span>
</a>
<ul class="nav-group-sub collapse">
<li class="nav-item">
<a href="#" class="nav-link">2nd level item</a>
</li>
...
</ul>
</li>
...
</ul>
<!-- /accordion navigation markup -->
Icons alignment
Sidebar navigation supports icons in all menu levels. Default icons alignment is left
, this allows the nav links to keep a visual hierarchy: icon > text > arrow (label), but right icons alignment makes usage of arrows useless as they won't be visible. To change icons alignment just add .nav-sidebar-icons-reverse
to the .nav-sidebar
container, CSS will do the rest.
Default left icons alignment
<!-- Left icons -->
<ul class="nav nav-sidebar" data-nav-type="accordion">
...
<li class="nav-item">
<a href="#" class="nav-link">
<i class="ph-plus-circle"></i>
Navigation link #1
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="ph-circles-three-plus"></i>
Navigation link #2
</a>
</li>
...
</ul>
<!-- /left icons -->
Optional right icons alignment
<!-- Right icons -->
<ul class="nav nav-sidebar nav-sidebar-icons-reverse" data-nav-type="accordion">
...
<li class="nav-item">
<a href="#" class="nav-link">
<i class="ph-plus-circle"></i>
Navigation link #1
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="ph-circles-three-plus"></i>
Navigation link #2
</a>
</li>
...
</ul>
<!-- /right icons -->
Bordered navigation
By default, vertical sidebar navigation doesn't have clear visual separation between nav items, it has its own advantages and disadvantages - thanks to bigger vertical padding, nav items are readable enough and match general design theme. But in some cases you might want to highlight them by adding horizontal lines to them. This is where this nav style preset might be handy. To use, simply add .nav-sidebar-bordered
class to main sidebar nav container..
Bordered navigation markup
<!-- Bordered navigation -->
<ul class="nav nav-sidebar nav-sidebar-bordered" data-nav-type="accordion">
<li class="nav-item-header">
<div class="text-uppercase fs-sm lh-sm opacity-50">Group title</div>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="ph-plus-circle"></i>
Navigation link #1
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="ph-circles-three-plus"></i>
Navigation link #2
</a>
</li>
...
</ul>
<!-- /bordered navigation -->
Navigation classes
nav
component classes and adapted for main navigation purposes. Depending on the needs, it supports different options such as collapsing type, icons, badges, combination with other sidebar components etc. This list explains the logic and purpose:
Class | Description |
---|---|
.nav |
Global wrapper for navigation list. It uses default Bootstrap's styles of .nav component and similar markup options. |
.nav-sidebar |
Default navigation class, must be used with any navigation type and color. Responsible for targeting specific style changes and basic styling of item colors, borders and icons. |
.nav-item-header |
Targets optional header element for separating group of nav items. In main sidebar this class is responsible for toggling text in folded sidebar mode. Use text utility classes to style inner content. |
.nav-item-divider |
Navigation item with this class separates groups of related menu items - it adds thick light (dark in light sidebar) line with extra vertical spacing. Useful in long lists. |
.nav-item |
This class is required as an immediate nav link parent in any .nav container. Since active link color is different from hover and initial states color, .nav-item has 1px vertical spacing to separate items that have same background color. Dropdown menu items have same logic. |
.nav-link |
This class is responsible for navigation link styling and is also required as a part of nav list class structure. It's also a target for .active and disabled states. Please note - this class doesn't reset <button> styles, so make sure you use <a> instead. |
.nav-link.active |
Combination of these classes in a single <a> element highlights nav item link and indicates the current page. By default, expanded submenu and active item state color is the same in each level. |
.nav-link.disabled |
Combination of these classes in a single <a> element disables all pointer and click events and mutes out nav link text and background colors. |
.nav-item-submenu |
This class indicates nav list item with children menu levels and needs to be added to .nav-item container. |
.nav-item-expanded |
Responsible for expanding submenu on page load - this class should be added to .nav-item container in all levels. |
.nav-item-open |
This class also should be used in combination with .nav-item and/or .nav-item-expanded classes, since it's responsible for some styling and toggles dynamically. |
.nav-group-sub |
Navigation submenu class - should be used with .nav class in <ul> element in all menu levels. |
.nav-sidebar-icons-reverse |
Add this class to .nav-sidebar container to change icons alignment from left to right . |
.nav-sidebar-bordered |
Add this class to .nav-sidebar container if you want to add horizontal borders to all navigation links on the first level. |
[data-nav-type="collapsible"] |
Default navigation behaviour - when new item is expanded, current level remains opened. Actually navigation container doesn't require this, but is used for the sake of semantic naming. |
[data-nav-type="accordion"] |
Changes default collapsible navigation type to accordion type - when new item is expanded, current level is collapsed. |