Nav

Navigation bits in Bootstrap all share a general Nav component and styles. Swap variants to switch between each style. The base Nav component is built with flexbox and provide a strong foundation for building all types of navigation components.

This is a pass through component from React-Bootstrap.
See React-Bootstrap for additional documentation.

Basic Usage

Theme Variables (SCSS)#

// Navs
$nav-link-padding-y: .5rem !default;
$nav-link-padding-x: 1rem !default;
$nav-link-color: $gray-700 !default;
$nav-link-disabled-color: $gray-300 !default;
$nav-link-font-weight: 500 !default;
$nav-tabs-border-color: $light-400 !default;
$nav-tabs-border-width: 2px !default;
$nav-tabs-border-radius: 0 !default;
$nav-tabs-link-hover-border-color: transparent transparent $nav-tabs-border-color !default;
$nav-tabs-link-hover-bg: $light-400 !default;
$nav-tabs-link-active-color: $primary-500 !default;
$nav-tabs-link-active-bg: $body-bg !default;
$nav-tabs-link-active-border-color: transparent transparent $primary-500 !default;
$nav-pills-border-radius: $border-radius !default;
$nav-pills-link-active-color: $component-active-color !default;
$nav-pills-link-active-bg: $component-active-bg !default;
$nav-divider-color: theme-color("gray", "background") !default;
$nav-divider-margin-y: calc($spacer / 2) !default;
Nav Props API
  • activeKey string Required | number Required Required

    Marks the NavItem with a matching eventKey (or href if present) as active.

  • as elementType Required

    Set a custom element for this component.

  • fill bool Required

    Have all NavItems proportionately fill all available width.

  • justify bool Required

    Have all NavItems evenly fill all available width.

  • navbar bool Required

    Apply styling an alignment for use in a Navbar. This prop will be set automatically when the Nav is used inside a Navbar.

  • onKeyDown func Required
  • onSelect string Required

    A callback fired when a NavItem is selected.

  • role string Required

    ARIA role for the Nav, in the context of a TabContainer, the default will be set to "tablist", but can be overridden by the Nav when set explicitly.

  • variant enum Required'tabs' | 'pills'

    The visual variant of the nav items.

  • bsPrefix string Required

    Change the underlying component CSS base class name and modifier class names prefix.

NavItem Props API
  • as elementType Required

    Set a custom element for this component.

  • bsPrefix string Required

    Change the underlying component CSS base class name and modifier class names prefix.

NavDropdown Props API
  • id string Required Required

    An html id attribute for the Toggle button, necessary for assistive technologies, such as screen readers.

  • title node Required Required

    The content of the non-toggle Button.

  • active bool Required

    Style the toggle NavLink as active

  • disabled bool Required

    Disables the toggle NavLink

  • menuRole string Required

    An ARIA accessible role applied to the Menu component.

  • menuVariant enum Required'dark'

    Menu color variant. Omitting this will use the default light color.

  • onClick func Required

    An onClick handler passed to the Toggle component

  • renderMenuOnMount bool Required

    Whether to render the dropdown menu in the DOM before the first time it is shown.

  • rootCloseEvent string Required

    Which event when fired outside the component will cause it to be closed.

  • bsPrefix string Required

    Change the underlying component CSS base class name and modifier class names prefix.