# Integrate `AnimatedHamburger` from Motion Garden

You are helping me add the **AnimatedHamburger** component to an existing project.
Everything you need is below — full source, dependencies, props and the
behavioural contract. Read it all before writing anything.

- **Component:** AnimatedHamburger
- **Category:** Micro-interactions
- **Summary:** A three-bar hamburger that morphs to an X, driven by a toggle prop.
- **Reference:** https://motion-garden.netlify.app/components/animated-hamburger
- **Full catalog (for you, the agent):** https://motion-garden.netlify.app/llms.txt

## Stack this source assumes

- React 19 with the Next.js App Router (never the `pages/` directory)
- TypeScript, strict
- Tailwind CSS v4, CSS-first config (utilities are inline; no `tailwind.config` needed)

If my project differs, adapt the integration — but do not rewrite the animation math to suit a different stack. Ask me first.

## Dependencies

```bash
bun add motion
```

## Files to create

One file. Paths are as shipped; the component may live anywhere in my project, but keep every peer file at the exact path shown so the import aliases resolve.

### 1. `components/registry/animated-hamburger/animated-hamburger.tsx`

```tsx
'use client'

import { MotionConfig, motion as m } from 'motion/react'

const CLOSED_INSET = '30%'

const HAMBURGER_VARIANTS = {
  top: {
    open: {
      rotate: ['0deg', '0deg', '45deg'],
      top: [CLOSED_INSET, '50%', '50%'],
    },
    closed: {
      rotate: ['45deg', '0deg', '0deg'],
      top: ['50%', '50%', CLOSED_INSET],
    },
  },
  middle: {
    open: { rotate: ['0deg', '0deg', '-45deg'] },
    closed: { rotate: ['-45deg', '0deg', '0deg'] },
  },
  bottom: {
    open: {
      rotate: ['0deg', '0deg', '45deg'],
      bottom: [CLOSED_INSET, '50%', '50%'],
      left: '50%',
    },
    closed: {
      rotate: ['45deg', '0deg', '0deg'],
      bottom: ['50%', '50%', CLOSED_INSET],
      left: '50%',
    },
  },
}

export function AnimatedHamburger({ open }: { open: boolean }) {
  return (
    <MotionConfig transition={{ duration: 0.4, ease: 'easeInOut' }}>
      <m.span
        initial={false}
        animate={open ? 'open' : 'closed'}
        className="relative block size-6"
        aria-hidden
      >
        <m.span
          variants={HAMBURGER_VARIANTS.top}
          className="absolute h-0.5 w-4 rounded-full bg-current"
          style={{ y: '-50%', left: '50%', x: '-50%', top: CLOSED_INSET }}
        />
        <m.span
          variants={HAMBURGER_VARIANTS.middle}
          className="absolute h-0.5 w-4 rounded-full bg-current"
          style={{ left: '50%', x: '-50%', top: '50%', y: '-50%' }}
        />
        <m.span
          variants={HAMBURGER_VARIANTS.bottom}
          className="absolute h-0.5 w-4 rounded-full bg-current"
          style={{
            x: '-50%',
            y: '50%',
            bottom: CLOSED_INSET,
            left: '50%',
          }}
        />
      </m.span>
    </MotionConfig>
  )
}
```


## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `toggle` | `boolean` | `false` | Toggle between the hamburger and the X. |

## Usage

```tsx
import { AnimatedHamburger } from "@/components/registry/animated-hamburger/animated-hamburger";

<AnimatedHamburger toggle={false} />
```

The import path matches the file path above; change it if you move the component. Every value shown is the documented default — pass only what you actually want to change. The snippet lists the tunable props only: if the component's props type in the source requires others (content, handlers, data), pass those too.

## Integration rules

- Keep the `"use client"` directive. This is a client component and will not render as a Server Component.
- It fills its parent. Give the wrapper an explicit height (or a definite grid area) — against a height-auto parent it collapses to nothing.

## Your task

1. Tell me where in my project this should live and why.
2. Create the files above verbatim.
3. Wire the component into the place I point you at, with sensible props for that context.
4. Flag anything in my setup that conflicts with the stack assumptions above.

Do not restyle the component or alter the animation math unless I ask.
