Skip to content

Hamburger

Menu button whose three lines cross into an X.

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

From the Nitip template, see it in context.

Studio

Examples

Uneven lines

Three lines of different lengths that grow to the same width as they cross.

Studio
<Hamburger open={open} onOpenChange={setOpen} controls="main-menu" lines="uneven" labels={false} />

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.
lines"even" | "uneven""even"Three equal lines, or right-aligned lines at 75%, 100% and 50% of the width (Ciketo's). Opening, the outer lines of the uneven one grow to the full width before they cross, on a spring with a little bounce.

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).
- A lines prop, "even" by default. "uneven" is a 26 x 14 box with the lines right-aligned at 75%, 100% and 50% of the width;
  opening, the outer lines grow to the full width, meet in the middle and turn ±45° while the middle one fades, on a spring
  with a little bounce (0.2).

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