Glin UI
Primitive / Molecule

Dropdown Menu

Action menu anchored to a trigger with keyboard navigation.

Edit on GitHub

Installation

Install from
pnpm dlx @glinui/cli@latest add dropdown-menu

Prefer the package?

Usage

Row actions

A trigger menu at the end of a file row.

Vendor agreement.pdf2.4 MB, edited yesterday
"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

KeyAction
Enter / SpaceOpen the menu or select an item.
Arrow Up / DownNavigate between menu items.
Arrow RightOpen a submenu.
Arrow LeftClose a submenu.
EscapeClose 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

opacitytransform

API Reference

PropTypeRequiredDefaultDescription
openboolean--Controlled open state.
defaultOpenboolean--Initial open state.
onOpenChange(open: boolean) => void--Open state change handler.
modalboolean-trueTrap 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.
PropTypeRequiredDefaultDescription
variant"default" | "glass" | "frosted" | "outline" | "ghost"NodefaultVisual treatment.
size"sm" | "md" | "lg"NomdDensity scale.
asChildboolean-falseRender as child element.
PropTypeRequiredDefaultDescription
variant"default" | "glass" | "frosted" | "outline" | "ghost"Noambient 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"NomdDensity scale.
sideOffsetnumber-4Distance from trigger in pixels.
align"start" | "center" | "end"-centerAlignment relative to trigger.
PropTypeRequiredDefaultDescription
variant"default" | "glass" | "frosted" | "outline" | "ghost"NodefaultAccepted for backwards compatibility. Items follow the look of their panel.
insetboolean-falseAdds left padding for icon alignment.
disabledboolean-falsePrevents interaction.
size"sm" | "md" | "lg"No"md"Variant option from dropdownMenuItemVariants.
PropTypeRequiredDefaultDescription
insetboolean-falseAdds 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/ui

Generated API Snapshot

Beta

Auto-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

PropTypeRequiredDefaultDescription
size"sm" | "md" | "lg"No"md"Variant option from dropdownMenuItemVariants.
variant"default" | "glass" | "frosted" | "outline" | "ghost"No"default"Variant option from dropdownMenuItemVariants.

DropdownMenuContentProps

PropTypeRequiredDefaultDescription
containerHTMLElement | nullNo-Element to portal into. Defaults to document.body.
size"sm" | "md" | "lg"No"md"Variant option from dropdownMenuContentVariants.
variantPanelVariantPropNo-Surface look. Omit for the ambient design style (glinr by default). `glass` is opt-in and needs a rich backdrop.

DropdownMenuItemProps

PropTypeRequiredDefaultDescription
insetbooleanNo--
size"sm" | "md" | "lg"No"md"Variant option from dropdownMenuItemVariants.
variant"default" | "glass" | "frosted" | "outline" | "ghost"No"default"Variant option from dropdownMenuItemVariants.

DropdownMenuLabelProps

PropTypeRequiredDefaultDescription
insetbooleanNo--

DropdownMenuProps

No explicit fields extracted for this props type.

DropdownMenuRadioItemProps

PropTypeRequiredDefaultDescription
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

PropTypeRequiredDefaultDescription
size"sm" | "md" | "lg"No"md"Variant option from dropdownMenuContentVariants.
variantPanelVariantPropNo--

DropdownMenuSubTriggerProps

PropTypeRequiredDefaultDescription
insetbooleanNo--
size"sm" | "md" | "lg"No"md"Variant option from dropdownMenuItemVariants.
variant"default" | "glass" | "frosted" | "outline" | "ghost"No"default"Variant option from dropdownMenuItemVariants.

DropdownMenuTriggerProps

PropTypeRequiredDefaultDescription
size"sm" | "md" | "lg"No"md"Variant option from dropdownMenuTriggerVariants.
variant"default" | "glass" | "frosted" | "outline" | "ghost"No"default"Variant option from dropdownMenuTriggerVariants.