Skip to content

Hamburger

Menu button whose three lines cross into an X.

From the Nitip template — see it in context
Studio

Installation

$ npx shadcn@latest add https://framebrick.co/r/hamburger.json

Usage

import { Hamburger } from "@/components/ui/hamburger";

const [open, setOpen] = useState(false);

<Hamburger open={open} onOpenChange={setOpen} controls="main-menu" />
<nav id="main-menu" hidden={!open}>…</nav>

Props

PropTypeDefaultDescription
openboolean—Open state (controlled).
defaultOpenbooleanfalseInitial state (uncontrolled).
onOpenChange(open: boolean) => void—Called when the button is pressed.
controlsstring—id of the menu this button shows and hides (aria-controls).
labels{ closed, open } | false{ closed: "Menu", open: "Close" }Text beside the lines; false hides it and sets an aria-label instead.

AI prompt

Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.

Create a React + Tailwind CSS + Motion (motion/react) component called Hamburger.
- A button with an optional label ("Menu" / "Close", text-sm font-medium) and three 1px lines in a 16x12 box.
- Open: the top line moves to the middle and rotates 45°, the bottom line moves to the middle and rotates -45°,
  the middle line fades out. Spring with no bounce, duration 0.4s.
- Controlled (open + onOpenChange) or uncontrolled (defaultOpen).
- Accessibility: aria-expanded, aria-controls pointing at the menu, an aria-label when the text label is hidden,
  visible focus ring (ring-[3px] ring-ring/50).

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy