Dropdown Menu

Menu on Radix Dropdown Menu with items, checkboxes, radio groups, submenus, labels and shortcuts on a flat card.

Installation

pnpm dlx shadcn@latest add @ward/dropdown-menu

Add the Ward registry to components.json once:

"registries": {
  "@ward": "https://ward.so/r/{name}.json"
}

Or install from the URL with no configuration: npx shadcn@latest add https://ward.so/r/dropdown-menu.json

Usage

import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Button } from "@/components/ui/button";
<DropdownMenu>
  <DropdownMenuTrigger asChild><Button variant="outline">Options</Button></DropdownMenuTrigger>
  <DropdownMenuContent align="end">
    <DropdownMenuLabel>Item</DropdownMenuLabel>
    <DropdownMenuItem>Edit<DropdownMenuShortcut>E</DropdownMenuShortcut></DropdownMenuItem>
    <DropdownMenuItem>Duplicate</DropdownMenuItem>
    <DropdownMenuSeparator />
    <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
  </DropdownMenuContent>
</DropdownMenu>

Props

PropTypeDefaultDescription
openboolean-Whether the menu is open, when the parent controls it.
onOpenChange(open: boolean) => void-Called when the menu opens or closes.
DropdownMenuTrigger asChildbooleanfalseUse the child element as the trigger instead of rendering a button.
DropdownMenuContent sideOffsetnumber4Gap in pixels between the trigger and the menu.
DropdownMenuContent align"start" | "center" | "end""center"Edge of the trigger the menu lines up with.
DropdownMenuItem variant"default" | "destructive""default"Use destructive for actions that remove something.
DropdownMenuItem insetbooleanfalseIndent the item to line up with items that have a check or radio indicator.
DropdownMenuItem onSelect(event: Event) => void-Called when the item is chosen; call event.preventDefault() to keep the menu open.
DropdownMenuCheckboxItem checkedboolean-Whether the item is ticked.
DropdownMenuCheckboxItem onCheckedChange(checked: boolean) => void-Called when the item is toggled.
DropdownMenuRadioGroup valuestring-Value of the selected radio item.
DropdownMenuRadioGroup onValueChange(value: string) => void-Called when another radio item is chosen.
DropdownMenuRadioItem valuestring-Value this item stands for inside its group.

Ward · Version 1.0.0 · Registry manifest