DropdownMenu
A short list of actions on one item.
$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/dropdown-menu.jsonRow actions
Button trigger
Open state (inline)
When to use
- A short list of actions on one item: a table row (Lihat detail, Ubah, Arsipkan).
- Secondary actions that do not fit as buttons: Ekspor → Unduh Excel / Unduh PDF.
- The account menu and the company switcher in the top bar.
When not to use
- Picking a value for a form → Select.
- Going to another page → ListRow or the rail.
- One or two actions → show them as buttons.
- Choices with ticks or checkboxes → not supported; use ChoiceCard in a Sheet.
Do and don't
Destructive last, after a separator"Arsipkan karyawan" in danger text at the bottom; it opens a destructive Dialog.
Ticks, checkboxes, sub-menusThey hide state in a menu that closes. Name the current item in words, and use a Sheet for choices.
Installation
Add DropdownMenu with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.
API
import { DropdownMenu, DropdownMenuIconTrigger, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from "@/components/ui/dropdown-menu"| Prop | Type | Default | Description |
|---|---|---|---|
DropdownMenuIconTrigger label | string | "Menu lainnya" | Round 44 trigger; label is the aria-label (name the row: "Menu Ayu Wulandari"). |
DropdownMenuIconTrigger variant | "secondary" | "ghost" | "secondary" | ghost in every table / list row (no raised edge, fills on hover, 44 target): many "⋯" in a column stay quiet. secondary when the trigger stands alone (a card header). |
DropdownMenuTrigger render | ReactElement | – | Any trigger, e.g. a Button with a chevron. |
DropdownMenuContent align · sideOffset | "start" | "center" | "end" · number | "end" · 8 | Opens under the trigger. |
DropdownMenuItem destructive | boolean | false | Danger text and icon; no red fill. |
DropdownMenuItem disabled · onClick | boolean · () => void | – | Base UI Menu.Item props. |