shadcn.io is not affiliated with official shadcn/ui
Dropdown Menu examples · Actions
Batch Actions Dropdown Dropdown Menu for React
A batch actions menu for several selected items, with a count label and actions to complete, tag, export, archive or delete them.
Select 47 emails or 12 tasks and the same few actions apply to all of them. This dropdown menu opens from a Batch Actions button and starts with a label that counts the selection, then offers Mark as Complete, Mark as Incomplete, Add Tags, Export Selected, Archive Selected and a destructive Delete Selected. It fits email clients, task lists, file browsers and admin tables.
Preview
Installation
FAQ
Where does 3 items selected come from?
It's the text of the DropdownMenuLabel at the top, and the demo hardcodes it. Put your selection count there, and disable the trigger when nothing is selected so the menu can't run on an empty selection.
What actions are in the menu?
Mark as Complete and Mark as Incomplete, then a separator, then Add Tags, Export Selected and Archive Selected, then a separator and Delete Selected. The label and the first two rows share a DropdownMenuGroup, and the menu is w-56.
Which rows show a shortcut?
Export Selected shows ⌘E and Delete Selected shows ⌘⌫, each in a DropdownMenuShortcut at the end of the row. The shortcut only prints the hint: register the keys on the page yourself, since the menu is closed when people press them.
How is Delete Selected marked?
variant="destructive" on that DropdownMenuItem colors the row, after a trash icon. It doesn't ask for confirmation: open an Alert Dialog that says how many items will go before you delete them.
Related
- File Actions Dropdown Dropdown MenuA file's actions menu with view
- Table Row Actions Dropdown MenuA narrow row actions menu for data
- Basic Data Table with CheckboxesA table of products with a checkbox on
- Quick Actions Menu Dropdown MenuA quick actions menu with labeled groups
- Card Actions with Nested Share Dropdown MenuA card's actions menu with Edit
- Alignment Options Dropdown MenuA text alignment picker with Left