Controls

Dropdown Menu

Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Dropdown Menu

Dropdown Menu

A menu of actions that blooms from its trigger.

Installation

npx shadcn@latest add ikislay/pixel-ui/dropdown-menu

How to use

import { DropdownMenu } from "@/components/ui/dropdown-menu"
export function Demo() {
return (
<DropdownMenu
trigger={<button type="button">Options</button>}
items={[
{ label: "Rename", onSelect: () => console.log("rename") },
"separator",
{ label: "Delete", destructive: true },
]}
/>
)
}

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
trigger*
ReactElement

One focusable element that toggles the menu.

items*
({ label: ReactNode; icon?: ReactNode; shortcut?: string; onSelect?: () => void; destructive?: boolean; disabled?: boolean } | "separator")[]

The actions, in order. A separator draws a thin line; destructive turns an action red.

align
startend

Which edge of the trigger the menu lines up with.

onFeedback
(event: "open" | "close" | "select") => void

Called at each semantic moment, for wiring sound or haptics.

className
string

Merged onto the menu.