Skip to content

Navbar ​

A responsive navigation bar with desktop and mobile layouts, plus sticky and floating modes. Items can mark themselves active from a single active-url, a subnav slot adds a second-tier row, centered pins the main navigation to the bar's center, and the mobile layout picks itself: an explicit mobile-menu panel, an external mobile-sidebar drawer, or the bar's own items wrapping under the logo. A floating-to-full-width transition runs when floating and sticky are used together.

Keyboard Navigation ​

The mobile toggle announces whether its menu is expanded. Pressing Escape inside an open mobile menu closes it and returns focus to the toggle, so keyboard navigation resumes from a visible control. The menu is nonmodal and does not trap focus.

Position Modes ​

Sticky ​

Full width

Floating ​

Full width

Floating + Sticky Transition ​

When both are set, the navbar starts as floating and switches to full-width sticky once page scroll passes scroll-threshold.

Full width

Active State from the URL ​

Set active-url once and every item resolves itself: an item is active when its href matches exactly, or when the URL nests under it (/docs stays highlighted on /docs/intro). Root / and in-page #anchors match exactly only, so they never light up everywhere. An explicit active on an item always wins, which keeps the escape hatch for forced or derived states.

Full width

Matched items reflect data-active and carry aria-current (page for routes, location for in-page anchors), so assistive tech and your own styling see the same answer.

Second-Tier Navigation ​

The subnav slot renders a quieter row under the bar for section navigation: plain ore-navbar-item pills, scrollable when they overflow. It appears only when it has content.

Full width

Centered Layout ​

centered pins the default-slot content to the bar's true center no matter how much the logo and end regions hold.

Full width

Mobile Layouts ​

The mobile layout resolves in one order:

  1. mobile-menu slot content: a toggle opens the navbar's own overflow panel.
  2. A mobile-sidebar target: the toggle drives that sidebar's drawer.
  3. Neither: the bar's live navigation wraps onto its own scrollable row(s) under the logo. No duplication, no clone that drifts out of sync, and nothing to maintain twice.

The end region still collapses in the wrapped layout: persistent exists precisely to stay visible through the collapse, end to collapse.

Full width

Recommended app-shell pattern:

  • Desktop: keep ore-sidebar visible and use the navbar for top-level context/actions.
  • Mobile: switch sidebar to bottom-nav mode and toggle its drawer from the navbar control, with menu-icon="panel-left-open" and menu-close-icon="panel-left-close" so it reads as the same control as the desktop collapse toggle.
  • Use mobile-sidebar on ore-navbar and bottom-nav-at="(max-width: ... )" on ore-sidebar.
Full width

ore-navbar-item ​

ore-navbar-item renders as an anchor when href is set, otherwise as a button.

Full width

Imperative API ​

js
const navbar = document.querySelector('ore-navbar');

navbar.openMobileMenu();
navbar.closeMobileMenu();
navbar.toggleMobileMenu();

Events ​

js
const navbar = document.querySelector('ore-navbar');

navbar.addEventListener('mobile-menu-change', (e) => {
  console.log('Mobile menu open:', e.detail.open);
});

API Reference ​

ore-navbar Attributes

AttributeTypeDefaultDescription
active-urlstringN/ACurrent page URL; items whose href match it (exact, or nested paths keep the parent) become active automatically; explicit active wins
centeredbooleanfalsePin the default-slot content to the bar's true center
labelstring'Main navigation'Accessible nav landmark label
menu-iconstring'menu'Icon shown while the mobile menu is closed
menu-open-labelstring'Open navigation menu'Accessible label for the closed mobile menu toggle
menu-close-iconstring'x'Icon shown while the mobile menu or the external mobile-sidebar drawer is open
menu-close-labelstring'Close navigation menu'Accessible label for the open mobile menu toggle
stickybooleanfalseEnables sticky mode
floatingbooleanfalseEnables floating mode
scroll-thresholdnumber80Scroll px threshold for floating+sticky transition
breakpointstring'(max-width: 768px)'Media query used for mobile mode
container-breakpointsbooleanfalseEvaluates parseable max-width breakpoints against the navbar container width
variant'flat' | 'solid' | 'bordered' | 'outline' | 'frost'N/ASurface style variant
colorThemeColorN/ATheme color
roundedRoundedSizeN/ABorder radius token
elevation'0' | '1' | '2' | '3' | '4' | '5'N/AElevation shadow level

When variant="frost" has an explicit elevation, that elevation replaces the default frost halo so levels remain visually distinct.

ore-navbar Parts

PartDescription
navOuter <nav> landmark element
barMain navbar row container
logoLogo slot container
startLeading (start) content region
centerCenter content region
endTrailing (end) content region
persistentTrailing region kept in the bar through the mobile collapse
subnavSecond-tier row container under the bar
mobile-toggleMobile menu toggle button
mobile-menuMobile overflow panel

ore-navbar Slots

SlotDescription
logoBrand mark/logo
startLeft-aligned desktop content
(default)Center desktop content
endRight-aligned desktop content
persistentTrailing content that stays in the bar through the mobile collapse (global actions, status icons)
subnavSecond-tier row rendered under the bar
mobile-menuMobile-only expandable content panel

ore-navbar Events

EventDetailDescription
mobile-menu-change{ open: boolean }Fired when the navbar's own mobile panel toggles (drawer-driven open/close emits the sidebar's drawer-change instead)

ore-navbar CSS Custom Properties

PropertyDescriptionDefault
--navbar-heightNavbar bar heightTheme-dependent
--navbar-widthMax width of the navbar contentTheme-dependent
--navbar-offsetHorizontal offset for floating/sticky positioningTheme-dependent
--navbar-bgNavbar background colorTheme-dependent
--navbar-colorNavbar text colorTheme-dependent
--navbar-border-colorNavbar border colorTheme-dependent
--navbar-shadowNavbar box shadowTheme-dependent
--navbar-radiusBorder radius (floating/sticky modes)Theme-dependent
--navbar-backdrop-filterBackdrop filter for blur effectTheme-dependent
--navbar-item-colorNav item text colorTheme-dependent
--navbar-item-hover-colorNav item hover text colorTheme-dependent
--navbar-item-hover-bgNav item hover backgroundTheme-dependent
--navbar-item-active-colorNav item active/current text colorTheme-dependent
--navbar-item-active-bgNav item active/current backgroundTheme-dependent

ore-navbar-item Attributes

AttributeTypeDefaultDescription
hrefstringN/ALink URL (renders anchor when set)
activebooleanfalseMarks item as current page (aria-current="page"); wins over the navbar's active-url match
disabledbooleanfalseDisables interaction
relstringN/ALink relationship when href is set
targetstringN/ALink target when href is set

ore-navbar-item Slots

SlotDescription
(default)Item label text
iconOptional leading icon
endOptional trailing content

ore-navbar-item Parts

PartDescription
itemRoot clickable element (anchor or button)
item-iconLeading icon container
item-labelLabel text container
item-endTrailing content container