Components
Hamburger Navbar
A navbar whose menu icon morphs into a close button.
<HamburgerNavbar brand="Acme" links={links} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/hamburger-navbar.jsonimport { HamburgerNavbar } from "@/components/hamburger-navbar"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A navbar whose links fold into a menu when its container is narrow, using a container query, so it adapts wherever you put it. The menu icon morphs into a close icon, and Escape closes the menu. Narrow the demo to see it.
import { HamburgerNavbar } from "@/components/hamburger-navbar";
export function SiteHeader() {
return <HamburgerNavbar brand="Acme" links={[{ label: "Docs", href: "/docs" }, { label: "Blog", href: "/blog" }]} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
brand | ReactNode | Your logo or name. | |
links | { label, href }[] | The links. | |
current | string | The current page's href. | |
className | string | Classes for the root element. |
With reduced motion, the icon and menu change without animating.