---
title: Menu
description: A list of actions in a dropdown, enhanced with keyboard navigation.
links:
doc: https://base-ui.com/react/components/menu#api-reference
---
## Installation
CLI
Manual
```bash
npx shadcn@latest add @coss/menu
```
Install the following dependencies:
```bash
npm install @base-ui/react
```
Import the following variables into your CSS file
```css
@theme inline {
--color-destructive-foreground: var(--destructive-foreground);
}
:root {
--destructive-foreground: var(--color-red-700);
}
.dark {
--destructive-foreground: var(--color-red-400);
}
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage
```tsx
import {
Menu,
MenuCheckboxItem,
MenuGroup,
MenuGroupLabel,
MenuItem,
MenuLinkItem,
MenuPopup,
MenuRadioGroup,
MenuRadioItem,
MenuSeparator,
MenuSub,
MenuSubPopup,
MenuSubTrigger,
MenuTrigger,
} from "@/components/ui/menu"
```
```tsx
Open
Profile
Playback
Play
Pause
Shuffle
Repeat
Auto save
Sort by
Artist
Album
Title
Add to playlist
Jazz
Rock
```
## API Reference
### Menu
Root component. Alias for `Menu.Root` from Base UI. Also exported as `DropdownMenu`.
### MenuTrigger
Trigger button that opens the menu. Alias for `Menu.Trigger` from Base UI. Also exported as `DropdownMenuTrigger`.
### MenuPopup
Popup container that displays the menu content. Also exported as `DropdownMenuContent`.
| Prop | Type | Default | Description |
| ------------- | ---------------------------------------------- | ---------- | ------------------------------------------------ |
| `side` | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` | Side of the trigger to position the popup |
| `align` | `"start" \| "center" \| "end"` | `"center"` | Alignment relative to the trigger |
| `sideOffset` | `number` | `4` | Distance from the trigger in pixels |
| `alignOffset` | `number` | - | Offset along the alignment axis |
| `portalProps` | `Menu.Portal.Props` | - | Props forwarded to the internal portal (`keepMounted`, `container`, etc.); see Base UI Menu portal API |
### MenuGroup
Groups related menu items. Alias for `Menu.Group` from Base UI. Also exported as `DropdownMenuGroup`.
### MenuItem
Individual menu item. Also exported as `DropdownMenuItem`.
| Prop | Type | Default | Description |
| --------- | ----------------------------- | ----------- | ------------------------------------------------ |
| `inset` | `boolean` | - | Adds left padding to align with items that have icons |
| `variant` | `"default" \| "destructive"` | `"default"` | Controls the item styling |
**Using `inset`:** When mixing items with and without icons, use `inset` on icon-less items to maintain alignment:
```tsx
Edit
Delete
Profile {/* Aligns with icon items above */}
```
### MenuLinkItem
Link menu item for navigation. **`LinkItem`** renders a native **``** when you pass **`href`**. Styled like **`MenuItem`**.
| Prop | Type | Default | Description |
| -------------- | ----------------------------- | ----------- | ------------------------------------------------ |
| `inset` | `boolean` | - | Adds left padding to align with items that have icons |
| `variant` | `"default" \| "destructive"` | `"default"` | Controls the item styling |
| `closeOnClick` | `boolean` | `true` | Whether the menu closes when the link is clicked |
If you were using **`MenuItem render={ }`**, migrate to **`MenuLinkItem`** but **keep `render`** — do not replace it with **`href`** alone when using a router **`Link`**.
```tsx
}>Docs
```
Use **`href`** only for plain anchor links:
```tsx
Docs
```
### MenuCheckboxItem
Checkbox menu item. Also exported as `DropdownMenuCheckboxItem`.
| Prop | Type | Default | Description |
| --------- | -------------------------- | ----------- | ------------------------------------------------ |
| `variant` | `"default" \| "switch"` | `"default"` | Display style - `switch` shows a toggle switch indicator |
### MenuRadioGroup
Groups radio menu items. Alias for `Menu.RadioGroup` from Base UI. Also exported as `DropdownMenuRadioGroup`.
### MenuRadioItem
Radio menu item. Styled wrapper for `Menu.RadioItem` from Base UI. Also exported as `DropdownMenuRadioItem`.
### MenuGroupLabel
Label for a menu group. Also exported as `DropdownMenuLabel`.
| Prop | Type | Default | Description |
| ------- | --------- | ------- | ------------------------------------------------ |
| `inset` | `boolean` | - | Adds left padding to align with items that have icons |
### MenuSeparator
Visual separator between menu items. Styled wrapper for `Menu.Separator` from Base UI. Also exported as `DropdownMenuSeparator`.
### MenuShortcut
Displays keyboard shortcut text. Custom component (not a Base UI wrapper). Also exported as `DropdownMenuShortcut`.
### MenuSub
Submenu container. Alias for `Menu.SubmenuRoot` from Base UI. Also exported as `DropdownMenuSub`.
### MenuSubTrigger
Trigger for opening a submenu. Also exported as `DropdownMenuSubTrigger`.
| Prop | Type | Default | Description |
| ------- | --------- | ------- | ------------------------------------------------ |
| `inset` | `boolean` | - | Adds left padding to align with items that have icons |
### MenuSubPopup
Popup for submenu content. Also exported as `DropdownMenuSubContent`.
| Prop | Type | Default | Description |
| ------------- | ------------------------------ | --------- | ------------------------------------------------ |
| `align` | `"start" \| "center" \| "end"` | `"start"` | Alignment relative to the trigger |
| `sideOffset` | `number` | `0` | Distance from the trigger in pixels |
| `alignOffset` | `number` | `-5` | Offset along the alignment axis. Defaults to `-5` when `align` is not `"center"` |
## Examples
### Open on Hover
### With Checkbox
### With Switch
`MenuCheckboxItem` supports a `variant="switch"` prop that displays a decorative switch indicator instead of a checkmark. This is a purely visual variant - the component remains a checkbox item with the same functionality.
### With Radio Group
### With Link
### With Group Label
### Nested Menu
### Close on Click
### Open a Dialog