Navbar
ProThe top bar: a logo, links with mega menus and an overflow list, search, account controls, and a drawer on small screens.
Playground
Release 2.4
Overview
Scroll this window to see how the bar behaves.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Release 2.4
Overview
Scroll this window to see how the bar behaves.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Release 2.4
Overview
Scroll this window to see how the bar behaves.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Release 2.4
Overview
Scroll this window to see how the bar behaves.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Release 2.4
Overview
Scroll this window to see how the bar behaves.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Release 2.4
Overview
Scroll this window to see how the bar behaves.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Release 2.4
Overview
Scroll this window to see how the bar behaves.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Release 2.4
Overview
Scroll this window to see how the bar behaves.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Installation
Navbar comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import {
Navbar,
BottomTabBar,
MobileNav,
NavbarLink,
NavbarLinkProps,
NavbarMenu,
NavbarMenuFeatured,
NavbarMenuGroup,
NavbarMenuLink,
NavbarMenuProps,
NavbarMode,
NavbarProps,
NavbarSearch,
NavbarSearchField,
NavbarSearchProps,
NotificationBell,
ThemeToggle,
UserMenu,
} from "@wunderui/react"Then use it:
import { Navbar, NavbarLink } from "@wunderui/react"
export function Header() {
return (
<Navbar logo={<span className="text-sm font-semibold text-foreground">WunderUI</span>}>
<NavbarLink href="/overview" active>Overview</NavbarLink>
<NavbarLink href="/projects">Projects</NavbarLink>
<NavbarLink href="/reports">Reports</NavbarLink>
</Navbar>
)
}Expected result: You see a 64 px bar with the logo and three links; Overview is tinted indigo. Scroll and the bar gets a shadow, and below 36rem the links give way to a menu button.
When to use
Use Navbar for
- The links across the top of a site or an app, with mega menus for grouped destinations
- Search, a command trigger, notifications and an account menu on the right
- A bar that reacts to scrolling: sticky, hiding or transparent over a hero
Use something else for
- Sidebar for a long list of app sections, with groups and a collapsible rail
- App Layout for the frame that holds the bar, a sidebar and the content
- Tabs for switching views inside one page, not navigating between pages
Items
Pass links and menus as direct children, and links that do not fit move into a More list. A mega menu is a disclosure of links, never a menu of commands.
Current page: Overview.
Click Products, or hover it for 150 ms.
Current page: Overview. Links that do not fit move into More.
Search
Search takes an inline field that widens from its icon, and command takes a trigger for your command palette. The bar never binds the shortcut, so the key is yours.
The icon widens into a field. Enter searches, Escape closes it.
The trigger only reports the click; the palette is yours.
The icon widens into a field. Enter searches, Escape closes it.
Actions
The actions slot is the cluster on the right. Name each control, because the bar shows icons.
Theme: light. The toggle only reports the value; applying it is yours.
Small screens
The bar reads its own width, not the window: below 36rem the links move behind a menu button. MobileNav and BottomTabBar are separate pieces for a phone layout.
Below 36rem the links sit behind the menu button.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Dashboard
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Keyboard interactions
Every control is a native link or button, so the browser handles focus and activation. The mega menu is a disclosure: its panel is not modal and arrow keys do nothing.
- TaborShift+Tab
- Moves through the menu buttons, the links, More, the search icon, the command trigger and the actions in reading order. Focus shows as an indigo border with a 2 px ring. A closed mega menu panel is not in the tab order.
- EnterorSpace
- On a link: follows it. On a mega menu button: opens or closes the panel. On the search icon: opens the field.
- ArrowRightorArrowLeftorArrowDownorArrowUporHomeorEnd
- On the ThemeToggle: moves to the other theme and chooses it, wrapping around. Tab leaves the group again.
- Tab
- With a mega menu open: walks into the panel, link by link, and on to the next control. The panel is not modal.
- Esc
- Closes an open mega menu and returns focus to its button; hover cannot reopen it until the pointer has left. In the search field: closes it and returns focus to the icon. In the menu drawer: closes it and returns focus to the Open menu button.
- Enter
- In the search field: submits and calls with the text.
ThemeToggle in its icons form is a radio group with one tab stop, the checked radio. Arrow keys, Home and End move between Light and Dark and choose as they go.
Behavior and motion
How the bar reacts to scrolling, to a narrow container and to a menu, and what it leaves to you.
- Modes
- Sticky stays on top with a shadow on scroll, static scrolls away. Hide-on-scroll leaves going down and returns going up; transparent sits over a hero and turns solid after scrolling.
- Scroll signal
- A zero-height marker tells whether the page is at the top, and the scroll direction is read once per frame. Both only set attributes on the header, so scrolling never re-renders React.
- Hide on scroll
- The bar ignores jitter under 6 px and never hides before the page has scrolled by its own height. It stays while focus is inside or a mega menu is open, and with reduced motion it behaves as sticky.
- Overflow
- The row measures every link's natural width. Links that do not fit move, from the end, into a More popover (mega menus never move), and a moved link keeps its current-page marking.
- Order
- Mega menus are drawn before the links, whatever order you pass them in. Put the menus first in your code too, so the code reads like the bar.
- Mega menu
- A mega menu opens on click, or on hover after 150 ms with a mouse, and a hover-opened panel closes 300 ms after the pointer leaves. One panel is open at a time, and a click outside closes it.
- Search field
- The search field is a landmark named Sitewide. It widens from 36 px to 224 px and closes on Escape, or on blur when empty.
- Command trigger
- NavbarSearch is a button that reports its click and does nothing else, so the key that opens your palette is yours to bind. It is hidden below 36rem.
- Small screens
- The bar reads its own width, not the window. Below 36rem the links and command trigger hide and a menu button opens a left Sheet with the logo and every link, while search and actions stay in the bar.
- Container, not window
- Because the bar reads its own width, a preview's Mobile width button narrows it like a phone. Parts that use the window width, such as side padding and the name in UserMenu, follow the window.
- Semantics
- One header (the banner landmark), one nav named by the label, and a search landmark for the field. Icons and chevrons are hidden from assistive technology.
Motion
Every transition uses the motion tokens and only changes transform, opacity, shadow and colour.
- Lift
- Shadow and colours change quickly. Opacity is never animated on the bar, because it would kill the blur of the transparent mode.
- Hide on scroll
- Only the position moves, for the base duration both ways, with an exit ease going out.
- Mega menu
- The panel fades and moves one small step in, and leaves faster. The chevron turns 180 degrees.
- Search field
- The width animates quickly.
- Drawer
- The Sheet slides in from the left; mega menu disclosures inside it open their height.
- Reduced motion
- With reduced motion the bar does not slide (hide-on-scroll is plain sticky), and the shadow, panel, search width and chevron change without a transition.
Anatomy
The figure marks a bar with a search field, a bell and an account button. The mega menu panel, More list, drawer, MobileNav and BottomTabBar are separate parts listed below.
- 1data-slot="navbar-sentinel"
The top bar: a sticky 64 px header with a bottom border. It lays out the logo, the link row and, pushed right, search, command trigger and actions, and the mode sets how it reacts to scrolling.
- 2Optional
The logo at the start of the bar, repeated by the menu drawer in its own header. Use one logo per screen, bar or sidebar.
- 3
A nav named by the label (Main by default) with the mega menus first, then the links. Links that do not fit move into a More list; below 36rem the row gives way to the drawer.
- Optional
A top-level entry, 36 px high: a real link with an href, otherwise a button. The active link gets the indigo tint and is marked as the current page.
- Optional
A mega menu: a button that opens a rounded panel of links under the trigger, three rows by four columns at most (link count balances the columns). Optional footer link (View all) and featured column. It is a disclosure, not a menu role.
- Optional
One entry of a mega menu panel: a title, an optional description and an indigo icon tile. In the drawer it shrinks to the title.
- Optional
A labelled column of a mega menu, like Product or Developers in Figma: a small label over a few links. Use one per column as direct children of NavbarMenu. In the drawer the label sits above its links.
- Optional
The featured column of a mega menu, passed as the featured prop: a gradient or picture over a title and a line of text. Hidden in the drawer.
- Optional
A popover named More links that takes the links which do not fit. It lists links, not commands.
- 4Optional
Inline search: an icon button that widens into a 224 px field, named Sitewide. Enter submits, Escape closes it, and leaving it empty closes it.
- 5Optional
A ghost icon button with a bell. Its name says the count (2 notifications) and a small indigo badge shows it, 99+ above 99.
- data-slot="notification-count"Optional
- 6data-slot="user-menu"Optional
The account trigger: an avatar, an optional name and a chevron. It is a button named Account menu plus the name; use it as a Dropdown Menu trigger.
- data-slot="navbar-search"Optional
A search-shaped button, never an input, for your command palette. It shows a shortcut hint and hides below 36rem, and the bar does not bind the key.
- Optional
Switches light and dark: a radio group of two icon buttons or a labelled switch. It reports the value and applies nothing.
- Optional
A left Sheet below 36rem, opened by the Open menu button. It lists every link, and mega menus become disclosures.
- data-slot="navbar"
- data-slot="mobile-nav"Optional
A separate 56 px bar for a phone screen: a menu button, a logo or title, and actions. It has no drawer of its own.
- data-slot="bottom-tab-bar"Optional
A nav of icon and label tabs at the foot of a phone screen. The current tab is marked as the current page.
Best practices
- Do
Pass NavbarLink and NavbarMenu as direct children, or as an array. The bar measures each child to decide what moves into More or the drawer, and a wrapper component hides them.
- Do
Mark exactly one link as active. That is how a screen reader says where the person is.
- Do
Give a link a real href when it goes to a page, so middle-click and open in a new tab work. Leave it out only for a client-side action.
- Do
Name the landmark with a label as soon as a page has a second navigation. Main next to a sidebar is not enough.
- Do
Give every icon control in the actions a name. The bell and account button name themselves; anything you add needs an aria-label.
- Do
Use hide-on-scroll for long reading pages only. The bar stays while it holds focus or a menu is open, and with reduced motion it is plain sticky.
- Don’t
Don't put commands in NavbarMenu. It is a disclosure of links; use a Dropdown Menu for actions such as Sign out.
- Don’t
Don't repeat the logo in a sidebar on the same screen. One logo per screen: bar or sidebar.
- Don’t
Don't count on the shortcut hint of NavbarSearch. It only shows the keys; binding the key is up to you.
API reference
The Navbar family is plain components, so these tables list every prop. NotificationBell wraps IconButton and takes its props too.
The top bar: a sticky 64 px header with a bottom border. It lays out the logo, the link row and, pushed right, search, command trigger and actions, and the mode sets how it reacts to scrolling.
| Prop | Type | Default | Description |
|---|---|---|---|
| logo | ReactNode | — | The logo at the start of the bar. The menu drawer repeats it in its header. |
| mode | "transparent" | "static" | "sticky" | "hide-on-scroll" | "sticky" | (default), , or . How the bar reacts to scrolling. |
| children | ReactNode | — | and entries, as direct children (an array is fine). Each can move into More or the drawer. |
| actions | ReactNode | — | The cluster on the right: notifications, theme toggle, account menu or your own buttons. |
| search | ReactNode | — | A , placed first among the utilities so it can grow without pushing the icons. |
| command | ReactNode | — | A trigger for your command palette. Hidden below 36rem. |
| label | string | "Main" | The name of the navigation landmark, by default. Set it as soon as the page has a second navigation; it also names the drawer. |
| drawerTheme | "inherit" | "dark" | "inherit" | Theme of the phone drawer (the Sheet's ): for a dark or coloured bar on a light page. Default . |
Inline search: an icon button that widens into a 224 px field, named Sitewide. Enter submits, Escape closes it, and leaving it empty closes it.
| Prop | Type | Default | Description |
|---|---|---|---|
| placeholder | string | "Search" | The label and the placeholder of the field. by default. |
| onSearch | (query) => void | — | Called with the text when the form is submitted. |
A ghost icon button with a bell. Its name says the count (2 notifications) and a small indigo badge shows it, 99+ above 99.
| Prop | Type | Default | Description |
|---|---|---|---|
| count | number | — | The number of unread items. Above zero the name says it and a badge shows it, above 99. |
| size | "lg" | "xl" | "sm" | "md" | "2xl" | — | 32 px, 36 px (default), , or . Use in the 64 px bar. |
| expanded | boolean | — | Marks the trigger of an open popup: sets and the pressed surface. |
| focusableWhenDisabled | boolean | false | Keeps a disabled bell in the tab order. |
| nativeButton | boolean | true | Whether the rendered element is a native . Set when gives another element. |
| pending | boolean | — | Shows a spinner in place of the bell and ignores presses. |
| phase | "error" | "success" | "pending" | "idle" | — | , , or : the same square shows a spinner, a check or a retry icon. |
| shape | "circle" | "rounded" | — | (default) or . |
| variant | "plain" | "gradient" | "outline" | "primary" | "destructive" | "light" | "ghost" | "brand" | "dark" | — | The icon button variant. by default. |
The account trigger: an avatar, an optional name and a chevron. It is a button named Account menu plus the name; use it as a Dropdown Menu trigger.
| Prop | Type | Default | Description |
|---|---|---|---|
| avatar required | ReactNode | — | The avatar at the start, decorative. Name the person in . |
| name | ReactNode | — | The name next to the avatar. Hidden below the breakpoint of the window. It becomes part of the accessible name. |
| variant | "rounded" | "plain" | "rounded" | (default) is a bordered pill, is the avatar and a chevron without a border. |
A top-level entry, 36 px high: a real link with an href, otherwise a button. The active link gets the indigo tint and is marked as the current page.
| Prop | Type | Default | Description |
|---|---|---|---|
| href | string | — | Where the link goes. Without it the entry is a for a client-side action. |
| active | boolean | — | The current page: and the indigo tint. One per bar. |
A mega menu: a button that opens a rounded panel of links under the trigger, three rows by four columns at most (link count balances the columns). Optional footer link (View all) and featured column. It is a disclosure, not a menu role.
| Prop | Type | Default | Description |
|---|---|---|---|
| label required | ReactNode | — | The text of the button that opens the panel. |
| children required | ReactNode | — | entries. Each is wrapped in a list item. |
| featured | ReactNode | — | A featured column at the end of the panel (Figma: Three columns). Pass a NavbarMenuFeatured. Hidden in the drawer. |
| footer | { label: ReactNode; href: string; onClick?: MouseEventHandler<HTMLAnchorElement> } | — | A "View all" link under a separator at the foot of the panel (Figma: Navigation / Item, kind View all link). |
One entry of a mega menu panel: a title, an optional description and an indigo icon tile. In the drawer it shrinks to the title.
| Prop | Type | Default | Description |
|---|---|---|---|
| href required | string | — | Where the entry goes. Required: a mega menu holds links. |
| title required | ReactNode | — | The name of the destination. |
| description | ReactNode | — | One short line under the title. Not shown in the drawer. |
| icon | ReactNode | — | An icon for the 36 px tile at the start. Decorative; not shown in the drawer. |
| onClick | MouseEventHandler<HTMLAnchorElement> | — | Called on click, before the panel closes. Call for client-side routing. |
A labelled column of a mega menu, like Product or Developers in Figma: a small label over a few links. Use one per column as direct children of NavbarMenu. In the drawer the label sits above its links.
| Prop | Type | Default | Description |
|---|---|---|---|
| children required | ReactNode | — | |
| label required | ReactNode | — |
The featured column of a mega menu, passed as the featured prop: a gradient or picture over a title and a line of text. Hidden in the drawer.
| Prop | Type | Default | Description |
|---|---|---|---|
| href required | string | — | |
| title required | ReactNode | — | |
| description | ReactNode | — | |
| media | ReactNode | — | The picture or gradient above the text; defaults to the brand gradient. |
| onClick | MouseEventHandler<HTMLAnchorElement> | — |
A search-shaped button, never an input, for your command palette. It shows a shortcut hint and hides below 36rem, and the bar does not bind the key.
| Prop | Type | Default | Description |
|---|---|---|---|
| placeholder | string | "Search…" | The text of the trigger. by default. |
| shortcut | string | "⌘K" | The key hint on the right, by default. Display only; the bar binds nothing. |
| variant | "plain" | "outline" | "plain" | (default) is a muted pill; is a bordered field. |
Switches light and dark: a radio group of two icon buttons or a labelled switch. It reports the value and applies nothing.
| Prop | Type | Default | Description |
|---|---|---|---|
| value required | "light" | "dark" | — | The current theme, or . |
| onValueChange required | (value) => void | — | Called with the theme the person chose. Applying it is yours. |
| variant | "icons" | "switch" | "icons" | (default) is a radio group with a sun and a moon, one tab stop and arrow-key navigation; is a row with a label and a switch. |
A separate 56 px bar for a phone screen: a menu button, a logo or title, and actions. It has no drawer of its own.
| Prop | Type | Default | Description |
|---|---|---|---|
| logo | ReactNode | — | A logo at the start. Use it or . |
| title | ReactNode | — | A page title instead of a logo, 16 px semibold. |
| actions | ReactNode | — | Buttons at the end of the bar. |
| onMenuClick | () => void | — | Called when the menu button is pressed. The bar has no drawer: open yours. |
| hideMenu | boolean | — | Hides the menu button, for a screen with its own back button. |
A nav of icon and label tabs at the foot of a phone screen. The current tab is marked as the current page.
| Prop | Type | Default | Description |
|---|---|---|---|
| items required | BottomTabBarItem[] | — | The tabs: each. |
| value required | string | — | The value of the current tab. It gets . |
| onValueChange required | (value) => void | — | Called with the value of the tab that was pressed. |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("navbar")The full library index for assistants is at /llms.txt.