Photo by Richard Lee
Navigation
Introduction
Natura11y offers an assortment of responsive navigation and menu choices.
All navigation components provide visible hover and focus states for all actionable items.
Learn more about visible hover and focus
Primary Navigation Component
The primary navigation component is a complete header menu system. It's made up of four preassigned areas: logo, main menu, search, and actions. The main menu container includes an optional search field.
There are two distinct placements available for the main menu. The first menu placement is inline with the logo, creating a slim navigation bar:
The second menu placement is below the logo, spanning the full width of the component:
Both menus use the same HTML markup but include a different modifier on their parent selector.
The .primary-nav--inline--{x}
places the menu inline with the logo. In contrast, .primary-nav--below--{x}
selector places the menu below the logo. Here, x equals its breakpoint modifier (e.g., lg for large). At this point the component changes layout from mobile to desktop.
Figure 1 (below) provides the entire HTML for the primary navigation component.
Line # | Details |
---|---|
1 | The It's completed with two modifiers: where x indicates the menu position (below or inline), while y indicates the component's responsive breakpoint. |
3-17 | The It contains the website's logo and home link. When using a single color |
19-47 | The The It is recommended to include |
49-71 | The It contains the website's menu and search buttons (on mobile viewports). The search toggle button is only required within the The The The Learn about collapse. |
73-86 | The The Learn about form entries. |
88-96 | The It contains actions buttons that should persist on every page (e.g. Sign In, Translate). |
Mega Menu
New since version 4x, Natura11y's megamenu component is a large, multi-column dropdown menu. It's designed to display a large amount of content in a structured way.
Megamenu Example
Photo by Aniket Deole
The mountain at a given distance In amber lies
—Excerpt from Delight becomes pictoral
Breadcrumb
A simple breadcrumb navigation to support wayfinding.
Generic Navigation
Create a simple vertical navigation with the .nav
component class added to a <ul>
tag (Figure 3).
For a horizontal menu, apply the .nav--horizontal
modifier class (Figure 4).
Breakpoint Modifiers
The .nav--horizontal
modifier accepts breakpoint modifiers.
With the HTML in Figure 5, the nav starts in the vertical direction. It then changes to the horizontal direction at the large breakpoint.
Justification
Use the flex justify content utilities for centered or right-justified navigation (Figure 6).
Bordered Navigation
Add the .nav--divider
modifier class to a .nav
selector for a vertical, bordered navigation (Figure 7).
Include the aformentioned .nav--horizontal
and .nav--horizontal--{bp}
modifier classes to .nav-divider
selectors. This produces a horizontal (and responsive) bordered menu (Figure 8).
Icons in Navigation
Generic navigation can include icons. Add the .nav--has-icons
modifier class to a .nav
selector. Nav items with icons (<a>
or <button>
) require two child selectors.
The first child is is a <span>
with its combined icon classes. The second child is a <span>
with a .nav__text
class. This holds the nav items's text. Further, the .nav__text
selector is our target for underlining the text on :hover
and :focus
states. It also provides a small margin to separate the text from the icon. See Figure 9.
Dropdown Items
Include dropdown items within .nav
, and .nav--divider
selectors. As well as within the .primary-nav__menu
selector inside the primary navigation component.
To create a dropdown, include the data-toggle="dropdown"
attribute on a <button>
(Figure 8, line 3). Add a sibling <ul>
with the .nav__dropdown
class (Figure 10, line 4).
Dropdowns work as you might expect within vertical navigation:
Related CSS Variables
Further customize by redefining any of their related CSS variables as shown below.