# Menu

> Dropdown menu primitives (trigger, popup, items).

Registry name: `menu`. HTML docs: https://ui.anuragroy.dev/component/menu.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/menu.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/menu.json`.

Registry JSON: https://ui.anuragroy.dev/r/menu.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/menu.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import {
  Menu,
  MenuItem,
  MenuPopup,
  MenuPortal,
  MenuPositioner,
  MenuTrigger
} from "@/components/ui/menu"
```

## Usage

```tsx
import { Button } from "@/components/ui/button"
import {
  Menu,
  MenuItem,
  MenuPopup,
  MenuPortal,
  MenuPositioner,
  MenuTrigger,
} from "@/components/ui/menu"

export function Example() {
  return (
    <Menu>
      <MenuTrigger render={<Button variant="outline" />}>Menu</MenuTrigger>
      <MenuPortal>
        <MenuPositioner>
          <MenuPopup>
            <MenuItem>New file</MenuItem>
            <MenuItem>Open…</MenuItem>
          </MenuPopup>
        </MenuPositioner>
      </MenuPortal>
    </Menu>
  )
}
```

## API

### Menu

Base UI Menu root.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | boolean | — |  |
| `onOpenChange` | (open: boolean) => void | — |  |

## Notes

- Also exports checkbox/radio items, groups, separators, and submenus.

## See also

- [HTML page](https://ui.anuragroy.dev/component/menu): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/menu.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
