Dropdown menu
A list of commands opened from a button, or by a right click on an area.
Examples
- Reading list12 items
- Q3 13F filings8 items
- Climate risk papers21 items
Reading list
12 articles, 3 unread
Saved from the browser and the phone, newest first.
Variants
Reading list
Q3 13F filings
Climate risk papers
States
Reading list
10 of 10 lists used. Delete one to duplicate this list.
Usage
Use it when
- A thing on screen has 2 to 5 commands and no room to show them as buttons: a card, a row, a header.
- You choose one command and the menu goes away.
- An area, a card or a row has commands you expect behind a right click or a long press, and the same commands are already behind its More button. Wrap it in a
ContextMenu.
Use something else when
- You pick a value that stays shown, such as a sort order or a filter. Use Select or SegmentedControl instead.
- The content is a form, a list with its own focus, or anything you read before acting. Use Popover instead.
- The choice is the one next step. Use Button instead, in the view.
Rules
General
Content
Avoid
Limits
Install
npx shadcn@latest add https://kaanarici.com/r/cobalt/dropdown-menu.json https://kaanarici.com/r/cobalt/context-menu.jsonimport { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuSeparator, menuItemClasses } from "@/components/cobalt/ui/dropdown-menu"import { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuSeparator } from "@/components/cobalt/ui/context-menu"