Menu

A customizable menu component for displaying lists of actions or options.

Installation

$ npx shadcn@latest add "/r/menu.json"

Usage

Props

Menu

Root component that manages the menu state.

MenuTrigger

The element that opens the menu.

MenuPopup

The container for the menu items.

PropTypeDefaultDescription
childrenReact.ReactNode-The menu items and separators.
classNamestring-Additional CSS classes.

MenuItem

An individual item in the menu.

PropTypeDefaultDescription
childrenReact.ReactNode-The item content.
classNamestring-Additional CSS classes.
disabledbooleanfalseWhether the item is disabled.

MenuCheckboxItem

A menu item that can be toggled.

PropTypeDefaultDescription
checkedboolean-The checked state.
onCheckedChange(checked: boolean) => void-Callback when the checked state changes.

MenuRadioItem

A menu item that belongs to a radio group.

PropTypeDefaultDescription
valuestring-The value of the radio item.