Nav

Navigation component pack for Seed

Install

npm install seed-nav --save

Dependencies


Example

<nav class="c-nav">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link c-nav__link--right@lg">
    Right Aligned Link
  </a>
</nav>

Modifiers

Tabs

<nav class="c-nav c-nav--tabs">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--tabs">...</nav>

Hover

Changes the background color of the hovered link item.

<nav class="c-nav c-nav--hover">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--hover">...</nav>

Orientation

These size modifier classes support responsive modifiers.

List

<nav class="c-nav c-nav--list">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--list">...</nav>

Stacked

<nav class="c-nav c-nav--stacked">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--stacked">...</nav>

Alignment

These size modifier classes support responsive modifiers.

Left

<nav class="c-nav c-nav--left">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--left">...</nav>

Center

<nav class="c-nav c-nav--center">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--center">...</nav>

Right

<nav class="c-nav c-nav--right">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--right">...</nav>

Items

<nav class="c-nav">
  <a href="#" class="c-nav__link c-nav__link--left">
    Link
  </a>
  <a href="#" class="c-nav__link c-nav__link--right">
    Link
  </a>
</nav>
<nav class="c-nav">
  <a href="#" class="c-nav__link c-nav__link--left"> ... </a>
  <a href="#" class="c-nav__link c-nav__link--right"> ... </a>
</nav>

Sizing

The default size for this component is lg. These size modifier classes support responsive modifiers.

<nav class="c-nav c-nav--xs">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--sm">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--md">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--lg">
  <a href="#" class="c-nav__link is-active">
    Active Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
  <a href="#" class="c-nav__link">
    Link
  </a>
</nav>
<nav class="c-nav c-nav--xs">...</nav>
<nav class="c-nav c-nav--sm">...</nav>
<nav class="c-nav c-nav--md">...</nav>
<nav class="c-nav c-nav--lg">...</nav>

Configurations

Below are the default Sass configuration variables for seed-nav. The variables can be found in the pack’s _config.scss file.

seed-nav/_config.scss
// Namespaces
$seed-nav-namespace: c-nav !default;
$seed-nav-item-namespace: #{$seed-nav-namespace}__item !default;
$seed-nav-link-namespace: #{$seed-nav-namespace}__link !default;
$seed-nav-hover-namespace: #{$seed-nav-namespace}--hover !default;
$seed-nav-tabs-namespace: #{$seed-nav-namespace}--tabs !default;
$seed-nav-link-active-namespace: is-active !default;
$seed-nav-link-disabled-namespace: is-disabled !default;
$seed-nav-link-font-weight: 400 !default;

// Configs
$seed-nav-link-padding: 16px 20px !default;
$seed-nav-link-color: #4f5d6b !default;
$seed-nav-link-active-color: #3197d9 !default;
$seed-nav-link-active-font-weight: 700 !default;
$seed-nav-link-disabled-color: #E3E8EB !default;

$seed-nav-link-hover-background-color: #e3e8eb !default;

$seed-nav-tabs-link-border-width: 2px !default;
$seed-nav-tabs-link-color: #a5b2bd !default;
$seed-nav-tabs-link-active-color: #2a3b47 !default;
$seed-nav-tabs-link-active-border-color: #3197d6 !default;
$seed-nav-tabs-link-active-font-weight: $seed-nav-link-font-weight !default;

// Alignment
$seed-nav-alignment: (
  left: flex-start,
  center: center,
  right: flex-end,
) !default;

// Orientation
$seed-nav-orientation: (
  list: row,
  stacked: column,
) !default;

// Sizes
$seed-nav-sizes: (
  xs: 4px 20px,
  sm: 8px 20px,
  md: 12px 20px,
  lg: $seed-nav-link-padding,
) !default;

// Item Alignment
$seed-nav-item-alignment: (
  left: margin-right,
  right: margin-left,
) !default;