Skip to Content
MavKitOne is in beta. @mav-labs-inc/mavkit-react is not public packages yet.

Navbar

Renders a header.navbar and enhances a hand-authored .navbar-toggle (hamburger) and .navbar-mobile (mobile menu panel) inside it — resize-to-desktop auto-close, scroll shadow, outside-click/Escape, and URL-based active-link detection. A full set of compound subcomponents removes the markup boilerplate, but hand-authoring the raw .navbar-* tree (documented in MARKUP.md) works exactly the same — Navbar only ever looks for .navbar-toggle and .navbar-mobile by class name.

Usage

import { Navbar, NavbarContainer, NavbarBrand, NavbarSpacer, NavbarNav, NavbarLink, NavbarToggle, } from '@mav-labs-inc/mavkit-react' <Navbar> <NavbarContainer> <NavbarBrand href="/" logo="M">MavKit</NavbarBrand> <NavbarSpacer /> <NavbarNav> <NavbarLink href="/">Home</NavbarLink> </NavbarNav> <NavbarToggle /> </NavbarContainer> </Navbar>

Example

Props

PropTypeDefaultDescription
onOpened() => void—
onClosed() => void—
classNamestring—
childrenReactNode—
refRef<NavbarHandle>—{ openMenu(), closeMenu(), toggleMenu(), isOpen }

Required — the only flex/grid row inside Navbar. NavbarBrand, NavbarNav, NavbarToggle, etc. all need to live inside it or they render as unstyled block children.

PropTypeDefaultDescription
layout'flex' | '3col''flex''3col' adds the logo / search / actions 3-column layout (search-bar variant).
classNamestring—
PropTypeDefaultDescription
href*string—
logoReactNode—Rendered inside .navbar-logo — a letter, <img>, or inline SVG.
childrenReactNode—Rendered inside .navbar-wordmark.

Also accepts every native <a> attribute.

PropTypeDefaultDescription
ariaLabelstring'Main navigation'
classNamestring—
PropTypeDefaultDescription
href*string—
activeboolean—Marks this link as the current page. Navbar also auto-detects this by URL match — only needed to override that.
disabledboolean—

Also accepts every native <a> attribute.

Reads open state from the enclosing Navbar; clicks are handled by Navbar itself via event delegation, so no onClick wiring is needed.

PropTypeDefaultDescription
childrenReactNode—Overrides the built-in three-bar hamburger icon.

Also accepts every native <button> attribute except className/type. Pass aria-controls yourself if toggling a hand-authored .navbar-mobile panel.

PropTypeDefaultDescription
classNamestring—

A thin vertical rule between link groups and actions. Accepts only className.

PropTypeDefaultDescription
idstring—Auto-generated if omitted.
labelstring'Search'Visually-hidden accessible label.
iconReactNode—Overrides the built-in magnifier icon.

Also accepts every native <input> attribute except className/type/id.

PropTypeDefaultDescription
ariaLabel*string—The button has no visible text, only the icon.
badgeReactNode—Rendered inside .navbar-badge (e.g. an unread count) — wraps the button in .navbar-icon-wrap automatically.

Also accepts every native <button> attribute except className/type.

flex: 1 — pushes everything after it to the right. Takes no props.

useNavbar()

Access the enclosing Navbar controller ({ isOpen }) — mainly useful for building a custom toggle.

Last updated on