Navbar.MenuToggle and Navbar.Menu provide a built-in mobile dropdown. Use hidden md:flex on desktop-only groups and keep the toggle visible below the breakpoint:
<Navbar> <Navbar.Header> <Navbar.MenuToggle className="md:hidden" /> <Navbar.Brand>…</Navbar.Brand> {/* Desktop-only nav */} <Navbar.Content className="hidden md:flex"> <Navbar.Item href="/features">Features</Navbar.Item> <Navbar.Item href="/pricing">Pricing</Navbar.Item> </Navbar.Content> </Navbar.Header> {/* Mobile-only menu — animates in when the toggle is pressed */} <Navbar.Menu> <Navbar.MenuItem href="/features">Features</Navbar.MenuItem> <Navbar.MenuItem href="/pricing">Pricing</Navbar.MenuItem> </Navbar.Menu></Navbar>
The menu open state can be controlled via isMenuOpen / onMenuOpenChange on Navbar, or uncontrolled via defaultMenuOpen. By default the navbar locks body scroll while the menu is open — pass shouldBlockScroll={false} to disable.
Scale the entire navbar (paddings, gaps, icon sizes) by overriding the Tailwind v4 --spacing variable on the navbar or a wrapper, and tune the bar height with the height prop:
<Navbar height="2.75rem" size="sm" style={{ "--spacing": "0.22rem" } as React.CSSProperties}> …</Navbar>
--spacing scales every Tailwind spacing utility (gap-*, p-*, size-*) inside the navbar
height overrides the internal --navbar-height CSS variable
size="sm" applies the built-in compact text + padding variants
Navbar.Item renders a real <a> element when href is set (and Navbar.MenuItem does the same for the mobile menu), so it works with any router. You have three ways to integrate client-side routing:
Wrap your app once in React Aria's RouterProvider with your router's navigation function. Every Navbar.Item / Navbar.MenuItem with an href — along with any other Namespace UIKit component that links (e.g. Sidebar.MenuItem) — automatically routes through it, no per-Navbarnavigate prop required. Modifier clicks (⌘/Ctrl-click) still open in a new tab, and external links keep their native behavior.
The RouterProvidernavigate signature differs slightly per framework — see React Aria's client-side routing guide for Next.js, React Router, TanStack Router, Remix, and others.
When you don't have (or don't want) a global provider, pass your router's push function directly to Navbar. Every Navbar.Item / Navbar.MenuItem with an href routes through it. An explicit navigate prop always takes precedence over any global RouterProvider — useful when a navbar needs a different router (e.g. an external shell app).
Since Navbar.Item and Navbar.MenuItem are polymorphic, you can swap the rendered element entirely to use a framework-specific <Link> component (preserving prefetch, scroll restoration, and any router-level behaviors):
import Link from "next/link";import { Navbar } from "@thenamespace/uikit";export function AppNavbar() { return ( <Navbar> <Navbar.Header> <Navbar.Content> <Navbar.Item href="/features" render={(props) => <Link href="/features" {...props} />} > Features </Navbar.Item> </Navbar.Content> </Navbar.Header> </Navbar> );}
Same works for Navbar.MenuItem in the mobile menu and for React Router's Link, TanStack Router's Link, etc.
Combine both approaches if you like — render owns the element/prefetch, and navigate is used as the fallback for programmatic navigations (e.g. closing the mobile menu and pushing to the href).
External URLs (starting with http:// or https://) are automatically opened in a new tab via window.open(href, "_blank", "noopener,noreferrer"). For internal links that need a full page reload instead of client-side navigation, use the forceReload prop:
Navigation resolution order: an explicit navigate prop wins, then a navigate inherited from an enclosing AppLayout, then a global React Aria RouterProvider, and finally the browser's default navigation if none are present.
The root <nav> landmark and the context provider. Accepts all <nav> props.
Prop
Type
Default
Description
position
"sticky" | "static" | "floating"
"sticky"
How the navbar is anchored to the page.
size
"sm" | "md" | "lg"
"md"
Applies the matching size variants to the header, items, and menu toggle.
maxWidth
"sm" | "md" | "lg" | "xl" | "2xl" | "full"
"lg"
Caps the header's content width via --navbar-max-width.
height
string
"4rem"
CSS height for the bar. Sets --navbar-height inline.
hideOnScroll
boolean
false
Hide the navbar when scrolling down and reveal on scroll up. Uses a spring transform so layout stays intact.
parentRef
RefObject<HTMLElement | null>
window
Scroll container used by hideOnScroll. Defaults to the window.
isMenuOpen
boolean
—
Controlled mobile menu open state.
defaultMenuOpen
boolean
false
Initial mobile menu open state (uncontrolled).
onMenuOpenChange
(isOpen: boolean) => void
—
Callback when the mobile menu state changes.
shouldBlockScroll
boolean
true
Lock body scroll while the mobile menu is open.
navigate
(href: string) => void
—
Programmatic navigation function used by Navbar.Item / Navbar.MenuItem when pressed. If omitted, the Navbar defers to a global React Aria RouterProvider when present, then to native browser navigation.
A single nav link or action. Renders an <a> when href is set, otherwise a <button>. Polymorphic via the render prop.
Prop
Type
Default
Description
href
string
—
Destination URL. Uses the parent Navbar's navigate (or a global React Aria RouterProvider) for client-side routing, or the browser's default navigation as a fallback. External URLs (http://, https://) open in a new tab.
isCurrent
boolean
false
Marks the item as the current page. Sets aria-current="page" and data-current="true".
forceReload
boolean
false
Skip the navigate callback and use window.location.href for this item.
render
(props) => ReactElement
—
Override the rendered element (e.g. to render a Next.js / React Router <Link>).