ActionMenu - Admin Components
Note: This component is available since Medusa v2.21.0.
The ActionMenu component shows a dropdown of actions when the user clicks a trigger, which is a three-dot icon button by default. The Medusa Admin uses it in page headers, section headers, and table rows.
Example#
Use ActionMenu in a widget or UI route to show the actions of a record:
import { ActionMenu } from "@medusajs/dashboard/components"
import { PencilSquare, Trash } from "@medusajs/icons"
const BrandActions = ({ brand, onDelete }) => {
return (
<ActionMenu
groups={[
{
actions: [
{
icon: <PencilSquare />,
label: "Edit",
to: `/brands/${brand.id}/edit`,
},
],
},
{
actions: [
{
icon: <Trash />,
label: "Delete",
onClick: () => onDelete(brand.id),
disabled: brand.is_default,
disabledTooltip:
"You can't delete the default brand.",
},
],
},
]}
/>
)
}
Medusa shows a separator between every two groups, and it doesn't render a group that has an empty actions array.
Props#
The component accepts the type:
Loading...
Related Components#
- SectionRow: pass an
ActionMenuas the row'sactions.
Was this page helpful?