Dropdown Menu
Action menu anchored to a trigger with keyboard navigation.
pnpm dlx @glinui/cli@latest add dropdown-menuInstallation
pnpm dlx @glinui/cli@latest add dropdown-menuPrefer the package?
Usage
Row actions
A trigger menu at the end of a file row.
"use client"
import { BookmarkSimple, Copy, DownloadSimple, FileText, Trash } from "@phosphor-icons/react"import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, IconFrame} from "@glinui/ui"
const CARD = "mx-auto w-full rounded-2xl border border-[var(--line-soft)] bg-[var(--surface-1)] p-5 [box-shadow:var(--elev-1)]"
export function DropdownRowActionsExample() { return ( <div className={`${CARD} max-w-md`}> <div className="flex items-center gap-3"> <IconFrame size="sm"><FileText aria-hidden="true" /></IconFrame> <span className="grid min-w-0 flex-1 text-sm"><span className="font-medium">Vendor agreement.pdf</span><span className="text-xs text-[var(--color-muted)]">2.4 MB, edited yesterday</span></span> <DropdownMenu> <DropdownMenuTrigger asChild><Button size="icon" variant="ghost" aria-label="File actions">...</Button></DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem><DownloadSimple aria-hidden="true" className="size-4" />Download</DropdownMenuItem> <DropdownMenuItem><Copy aria-hidden="true" className="size-4" />Duplicate</DropdownMenuItem> <DropdownMenuItem><BookmarkSimple aria-hidden="true" className="size-4" />Add to favorites</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem className="text-[var(--tone-danger-text)]"><Trash aria-hidden="true" className="size-4" />Delete</DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> </div> </div> )}Variants
Every look of the shared vocabulary: glinr (the default), plain (shadcn), solid, soft, outline, ghost, gradient and glass. Omit `variant` to follow the ambient design style.
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "@glinui/ui"
const variants = ["glinr", "plain", "solid", "soft", "outline", "ghost", "gradient", "glass"] as const
export function Demo() { return ( <div className="flex flex-wrap gap-2"> {variants.map((variant) => ( <DropdownMenu key={variant}> <DropdownMenuTrigger asChild><Button size="sm" variant="outline">{variant}</Button></DropdownMenuTrigger> <DropdownMenuContent variant={variant}> <DropdownMenuItem>Profile<DropdownMenuShortcut>⌘P</DropdownMenuShortcut></DropdownMenuItem> <DropdownMenuItem>Billing</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem>Sign out</DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> ))} </div> )}Glass (opt-in)
Glass is opt-in and needs a colourful or photographic backdrop to read as frosted. Pick one in the stage header.
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@glinui/ui"
export function Demo() { return ( <DropdownMenu> <DropdownMenuTrigger>Glass menu</DropdownMenuTrigger> <DropdownMenuContent variant="glass"> <DropdownMenuItem>Profile</DropdownMenuItem> <DropdownMenuItem>Billing</DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> )}Accessibility
- Built on Radix DropdownMenu with full WAI-ARIA.
- Focus is trapped within the menu when open.
- Supports keyboard navigation, escape, and focus restore.
Keyboard Interactions
| Key | Action |
|---|---|
| Enter / Space | Open the menu or select an item. |
| Arrow Up / Down | Navigate between menu items. |
| Arrow Right | Open a submenu. |
| Arrow Left | Close a submenu. |
| Escape | Close the menu. |
ARIA Attributes
- `role="menu"`
- `role="menuitem"`
- `aria-expanded`
- `aria-haspopup`
Reduced Motion
Open/close transitions respect `prefers-reduced-motion`.
Menu open/close should remain readable without animation.
Affected properties
opacitytransformAPI Reference
DropdownMenu
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
open | boolean | - | - | Controlled open state. |
defaultOpen | boolean | - | - | Initial open state. |
onOpenChange | (open: boolean) => void | - | - | Open state change handler. |
modal | boolean | - | true | Trap focus within the menu. |
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuItemVariants. |
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | "default" | Variant option from dropdownMenuItemVariants. |
DropdownMenuTrigger
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | default | Visual treatment. |
size | "sm" | "md" | "lg" | No | md | Density scale. |
asChild | boolean | - | false | Render as child element. |
DropdownMenuContent
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | ambient style (glinr) | Panel look. Omit it for the ambient design style (glinr shell, raised pill for the highlighted item). `plain` is the shadcn border and shadow, `glass` is opt-in and needs a backdrop. Legacy `default` follows the ambient style. |
size | "sm" | "md" | "lg" | No | md | Density scale. |
sideOffset | number | - | 4 | Distance from trigger in pixels. |
align | "start" | "center" | "end" | - | center | Alignment relative to trigger. |
DropdownMenuItem
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | default | Accepted for backwards compatibility. Items follow the look of their panel. |
inset | boolean | - | false | Adds left padding for icon alignment. |
disabled | boolean | - | false | Prevents interaction. |
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuItemVariants. |
DropdownMenuLabel
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
inset | boolean | - | false | Adds left padding for icon alignment. |
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuItemVariants. |
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | "default" | Variant option from dropdownMenuItemVariants. |
Source
Import directly from the package or browse the source on GitHub. Click any file to view it.
Import
import { DropdownMenu } from "@glinui/ui"Source Files
Dependencies
@glinui/uiGenerated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/dropdown-menu.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata
Primary Props Type
DropdownMenuProps
DropdownMenuCheckboxItemProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuItemVariants. |
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | "default" | Variant option from dropdownMenuItemVariants. |
DropdownMenuContentProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
container | HTMLElement | null | No | - | Element to portal into. Defaults to document.body. |
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuContentVariants. |
variant | PanelVariantProp | No | - | Surface look. Omit for the ambient design style (glinr by default). `glass` is opt-in and needs a rich backdrop. |
DropdownMenuItemProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
inset | boolean | No | - | - |
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuItemVariants. |
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | "default" | Variant option from dropdownMenuItemVariants. |
DropdownMenuLabelProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
inset | boolean | No | - | - |
DropdownMenuProps
No explicit fields extracted for this props type.
DropdownMenuRadioItemProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuItemVariants. |
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | "default" | Variant option from dropdownMenuItemVariants. |
DropdownMenuSeparatorProps
No explicit fields extracted for this props type.
DropdownMenuShortcutProps
No explicit fields extracted for this props type.
DropdownMenuSubContentProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuContentVariants. |
variant | PanelVariantProp | No | - | - |
DropdownMenuSubTriggerProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
inset | boolean | No | - | - |
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuItemVariants. |
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | "default" | Variant option from dropdownMenuItemVariants. |
DropdownMenuTriggerProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
size | "sm" | "md" | "lg" | No | "md" | Variant option from dropdownMenuTriggerVariants. |
variant | "default" | "glass" | "frosted" | "outline" | "ghost" | No | "default" | Variant option from dropdownMenuTriggerVariants. |