Skip to content

Navbar

Responsive top navigation bar. Collapses progressively as viewport shrinks (fullcompactminimalmobile), falling back to an Drawer-based hamburger menu at the mobile stage. Active-item tracking supports route, hash, scroll-spy, or fully manual modes via activeMode.

items accepts either a real array or a JSON string, so it works directly as a plain HTML attribute — no script needed.

<and-navbar
items='[{"id":"home","label":"Home","href":"#"},{"id":"docs","label":"Docs","href":"#"},{"id":"about","label":"About","href":"#"}]'
active-item="home"
></and-navbar>
PropertyAttributeDescriptionTypeDefault
activeItemactive-itemThe active navigation item ID.string''
activeModeactive-modeStrategy used to compute active item (auto, route, hash, scroll, or manual)."auto" | "hash" | "manual" | "route" | "scroll"'auto'
ariaNavLabelaria-nav-labelARIA label for the navigation.string'Main navigation'
autoCollapseauto-collapseAutomatically detect when nav items overflow and switch responsive stage regardless of breakpoints.booleantrue
compactBreakpointcompact-breakpointBreakpoint (px) below which the end section enters compact (icon-only) mode.number1024
itemVariantitem-variantVisual style for individual nav links (default, underline, or filled)."default" | "filled" | "underline"'default'
itemsitemsNavigation items. Accepts an array or a JSON string. Empty → use the nav slot for custom content.NavItem[] | string[]
minimalBreakpointminimal-breakpointBreakpoint (px) below which the main nav moves to the hamburger drawer.number768
mobileBreakpointmobile-breakpointBreakpoint (px) below which the navbar switches to mobile (hamburger) mode.number640
positionpositionPositioning behaviour."fixed" | "static" | "sticky"'static'
routeMatchModeroute-match-modeRoute matching mode used when activeMode resolves through pathname."exact" | "prefix"'prefix'
scrollSpyscroll-spyEnable scroll-spy (auto-detect active section by scroll position). Items must use href starting with #.booleanfalse
scrollSpyOffsetscroll-spy-offsetScroll-spy offset from the top of viewport (px).number100
variantvariantVisual variant."default" | "filled" | "floating" | "glass"'default'
EventDescriptionType
andMobileMenuChangeEmitted when mobile menu state changes.CustomEvent<boolean>
andNavItemClickEmitted when active item changes.CustomEvent<string>
andNavLinkClickEmitted when a navigation link is clicked.CustomEvent<{ id: string; href: string; }>
andResponsiveStageChangeEmitted when responsive stage changes.CustomEvent<"compact" | "full" | "minimal" | "mobile">