← Back to Registry

Nav 01

Blocks

A top bar that shrinks a little as you scroll. On a small screen the links fold into a menu.

View JSONDependencies: motion

Overview

Scroll down. The bar stays put and tightens as the page moves under it.

Work

The name and the links share one row when there's room. Sign in is just whatever you put on the right.

Notes

Shrink the window and the links drop into the menu. Escape closes it.

Props

Nav

defaultOpenfalse

boolean

Whether the mobile menu starts open.

Nav

open—

boolean

Controls the mobile menu. Leave it unset to let the bar manage itself.

Nav

onOpenChange—

(open: boolean) => void

Called when the mobile menu opens or closes.

Nav

className—

string

Classes on the header. Use this for fixed, sticky, or absolute. Any other header prop is passed through too.

NavBrand

href—

string

Where the logo and name go. Pass render to use a different link component.

NavTitle

children—

ReactNode

The name next to the logo.

NavSubtitle

children—

ReactNode

An optional second line under the name. It only shows when the bar has room.

NavLinks

children—

ReactNode

The links. Place them in the bar. They stay inline when there is room, and the same links open in the menu when there is not.

NavLink

href—

string

The link target. Pass render to use a different element. Clicking it closes the menu.

NavMenu

className—

string

The menu button. Place it in the bar. It hides when there is room, and it uses your project's icon set.

NavActions

children—

ReactNode

Anything you want at the end, like a button. Place it in the bar. On a small screen it shows under the links while the menu is open.

Install with the shadcn CLI