Skip to main content
Neighborhood Design System v5.0.0-rc.2

Navbar

Ready

in progress...

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdNavbar } from '@fbin-web/neighborhood-core';
Usage
<nbhd-navbar>
  <nbhd-text slot="title" variant="subtitle" tag="h3">
    Dolor Tellus Etiam
  </nbhd-text>
  <nbhd-cta slot="cta" variant="primary" href="fun-cta-slide-1" aria-label="Learn more about CTA 1">
    Nibh Fusce
  </nbhd-cta>
  <nbhd-link slot="links" href="nav-link-1">
    Vehicula
  </nbhd-link>
  <nbhd-link slot="links" href="nav-link-2">
    Consectetur
  </nbhd-link>
</nbhd-navbar>

Properties

PropertyAttributeTypeDefaultDescription
layoutlayoutstandardcontainedfullwidthstandardSet the navbar layout mode.
alignmentalignmentstartcenterendcenterHorizontal alignment of the navbar content.
logoSeparatorlogo-separatorbooleanfalseAdd a separator between the primary and secondary logos when both are present.
mobileHiddenmobile-hiddenbooleanfalseHide the navbar below 768px. Only use it when the page provides another way to reach the same navigation on small screens (e.g. a mobile menu), so nothing is lost at 320px (WCAG 1.4.10).
ariaLabelaria-labelstring—Names the nav landmark when a page has more than one, e.g. "Main". Leave out the word "navigation"; screen readers already announce it.
shadowshadowbooleanfalseAdd a shadow to the navbar.
borderborderbooleanfalseAdd a border around the navbar.
stickystickybooleanfalseKeep the navbar pinned to the top of the container while scrolling. When sticky, set `scroll-padding-top` on the page to the navbar height so focused elements aren’t hidden behind it (WCAG 2.4.11).
surfacesurfacenoneprimarysecondaryinverseinverse-secondaryprimarySurface theme applied to the navbar background.
marginTopmargin-topnonesmallmediumlargenoneAdjust margin above the component.
marginBottommargin-bottomnonesmallmediumlargenoneAdjust margin below the component.
paddingToppadding-topdefaultnonesmallmediumlargedefaultAdjust padding above the component.
paddingBottompadding-bottomdefaultnonesmallmediumlargedefaultAdjust padding below the component.

Slots

Named slots for custom content placement within the navigation bar component.

NameDescription
titleCustom content for the navbar title area. Rendered only when a title slot is provided and no logo is present.
contentCustom descriptive content rendered in the content area when no links slot is provided.
logo-mainCustom content for the primary logo area.
logo-secondaryCustom content for the secondary logo area.
linksCustom navigation links rendered in the links group.
ctaCustom call-to-action content rendered in the CTA area.

CSS Parts

Exposed CSS parts for styling specific elements within the navigation bar component.

NameDescription
baseThe main navigation element wrapper.
containerThe container element that wraps the navbar's grid.
gridThe grid layout container for the navbar sections.
titleThe title block that wraps the title slot content.
title-slotThe slot element for title content.
contentThe content block that wraps the content slot.
content-slotThe slot element for content text.
logo-groupThe wrapper for the primary and secondary logo groups.
logo-mainThe main logo block.
logo-secondaryThe secondary logo block.
links-groupThe wrapper for the links slot.
linksThe slot element for custom nav links.
cta-wrapperThe wrapper for the CTA slot content.
ctaThe slot element for CTA content.
nbhd-navbar::part(base) {
  /* your styles */
}

Dependencies

Child components <nbhd-navbar> renders internally. Import them too when you tree-shake.

Esc
↑ ↓ to move↵ to open