Header navigation components

FREE

Free and open-source React header navigation components built for modern applications and websites. These header navigations are built using React Aria and styled with Tailwind CSS.

Installation

You can add this header navigation component using our CLI or manually:

npx untitledui@latest add header-navigation

Header navigation examples

Below are examples and variations of this header navigation component:

API reference

HeaderNavigationBase

Import HeaderNavigationBase from @/components/application/app-navigation/header-navigation. Renders MobileNavigationHeader.

HeaderNavigationBase props
PropTypeDefaultDescription
items* (required)NavItem[]—List of items to display.
activeUrlstring—URL of the currently active item.
subItemsNavItem[]—List of sub-items to display.
hideBorderbooleanfalseWhether to hide the bottom border.
actionsReactNode—Replaces the entire right-side actions (icon buttons + account dropdown). When provided, the default actions are ignored.
centeredbooleanfalseCenters the primary nav items between the logo and actions.
secondaryType
"buttons""tabs"
"buttons"Controls how the secondary header renders sub-items.
  • "buttons" — NavButton pills (default).
  • "tabs" — Underline tabs.

MobileNavigationHeader

Import MobileNavigationHeader from @/components/application/app-navigation/base-components/mobile-header. Renders React Aria’s DialogTrigger — all of its props are supported.

MobileNavigationHeader props
PropTypeDefaultDescription
childrenReactNode——

FAQs

Please refer to our frequently asked questions page for more.

HeaderNavigationBase takes items as an array of nav objects. Each one needs a label and an href, and can optionally carry an icon component, a badge node, a current boolean to force the active state, and a nested items array of sub-items for the second tier. The desktop header only renders each item's label; icon and badge show up in the mobile drawer.

Pass the current path to the activeUrl prop and the header derives the active item for you: an item matches when its href equals activeUrl exactly, or when activeUrl starts with href + "/" so nested routes keep the parent highlighted. The one exception is a root href of "/", which is excluded from the prefix rule and only ever matches exactly — otherwise it would stay highlighted on every page. To override the match for one item, set current on that item.

There are two ways. Either nest an items array inside the top-level item that should own the second tier — it renders automatically when that item is active — or pass a separate subItems array to HeaderNavigationBase to control the second row directly. The secondary row is only rendered when there is at least one sub-item.

Yes. The secondaryType prop accepts "buttons" (the default, which renders NavButton pills) and "tabs", which renders the sub-items as underline tabs using the Tabs and TabList components. The tabs only receive each sub-item's label, not its href, so handle navigation yourself if you use "tabs".

Pass your own markup to the actions prop. When it is provided the built-in actions — the search, settings and notification NavButtons plus DropdownAccountButton — are skipped entirely, so you are responsible for rendering everything on that side.

Set centered to true. It defaults to false, which pins the nav items next to the logo; when enabled, the logo and actions each take equal space so the nav sits in the middle. Note that in the centered layout the search input in the buttons-style secondary row is not rendered.

Yes. The full header is hidden below the lg breakpoint, and MobileNavigationHeader renders a compact bar with a menu button that opens a dismissable React Aria modal drawer. The drawer reuses the same items array through NavList and adds a search input, Support, Settings and Open in browser links, and a NavAccountCard. activeUrl is not passed to the drawer's NavList, so items there are not highlighted as active unless you add it.