Responsive Navbar
A site header with links and actions that collapses into a menu on small screens.
Installation
npx shadcn@latest add @venusui/navbar-01Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Files added to your project
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/navbar-01.tsx
Also adds the shadcn button component if your project doesn't have it yet.
Usage
The code behind the preview above.
navbar-01-demo.tsx
import { Navbar01 } from "@/components/navbar-01"
export default function Navbar01Demo() {
return <Navbar01 />
}
API reference
No props. Links are in the links array; logo and actions are in the file.
Requirements
- shadcn
button. The CLI installs it. lucide-react, React 19 and Tailwind CSS v4.
Customization
- Edit the
linksarray and replacehref="#"; use your router’sLinkfor internal pages. - Make it sticky with
sticky top-0 z-40on theheader. - Change where it collapses by replacing
md:with another breakpoint throughout the file.
Accessibility
- The menu button exposes
aria-expandedandaria-controls, and its label switches between open and close. - Escape closes the menu and returns focus to the button. Choosing a link closes it too.
- Only one navigation landmark is visible at a time; the other is hidden with
display: none.
Troubleshooting
- The menu button does nothing.
- The block is a Client Component (
"use client"). Keep that line at the top of the file. Unknown registry "@venusui"- Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (
npx shadcn@latest), install by URL, or register it with its address:npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json. No components.json found- Run
npx shadcn@latest initin your project first.