1 ---
2 sidebar_label: "Action Menu"
3 ---
4
5 import { TypeList } from "docs-ui"
6
7 export const metadata = {
8 title: `ActionMenu - Admin Components`,
9 }
10
11 # {metadata.title}
12
13 <Note>
14
15 This component is available since Medusa [v2.21.0](https://github.com/medusajs/medusa/releases/tag/v2.21.0).
16
17 </Note>
18
19 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.
20
21 ```tsx
22 import { ActionMenu } from "@medusajs/dashboard/components"
23 ```
24
25 ---
26
27 ## Example
28
29 Use `ActionMenu` in a [widget](!docs!/learn/fundamentals/admin/widgets) or [UI route](!docs!/learn/fundamentals/admin/ui-routes) to show the actions of a record:
30
31 ```tsx
32 import { ActionMenu } from "@medusajs/dashboard/components"
33 import { PencilSquare, Trash } from "@medusajs/icons"
34
35 const BrandActions = ({ brand, onDelete }) => {
36 return (
37 <ActionMenu
38 groups={[
39 {
40 actions: [
41 {
42 icon: <PencilSquare />,
43 label: "Edit",
44 to: `/brands/${brand.id}/edit`,
45 },
46 ],
47 },
48 {
49 actions: [
50 {
51 icon: <Trash />,
52 label: "Delete",
53 onClick: () => onDelete(brand.id),
54 disabled: brand.is_default,
55 disabledTooltip:
56 "You can't delete the default brand.",
57 },
58 ],
59 },
60 ]}
61 />
62 )
63 }
64 ```
65
66 Medusa shows a separator between every two groups, and it doesn't render a group that has an empty `actions` array.
67
68 ---
69
70 ## Props
71
72 The component accepts the `ActionMenuProps` type:
73
74 <TypeList
75 types={[
76 {
77 name: "groups",
78 type: "`object[]`",
79 optional: false,
80 description:
81 "The groups of actions to show in the dropdown. Medusa shows a separator between every two groups, and it doesn't render a group that has an empty `actions` array.",
82 children: [
83 {
84 name: "actions",
85 type: "`object[]`",
86 optional: false,
87 description:
88 "The actions to show in the group. Each action must have either a `to` or an `onClick` property, but not both.",
89 children: [
90 {
91 name: "icon",
92 type: "`React.ReactNode`",
93 optional: false,
94 description: `The icon to show before the action's label. Use an icon from the [Medusa Icons package](!ui!/icons/overview).`,
95 },
96 {
97 name: "label",
98 type: "`string`",
99 optional: false,
100 description: `The action's label.`,
101 },
102 {
103 name: "to",
104 type: "`string`",
105 optional: true,
106 description:
107 "The path to navigate to when the user clicks the action. Medusa renders the action as a link. Required if `onClick` isn't provided, and can't be used with `onClick`.",
108 },
109 {
110 name: "onClick",
111 type: "`() => void`",
112 optional: true,
113 description:
114 "The function to execute when the user clicks the action. Required if `to` isn't provided, and can't be used with `to`.",
115 },
116 {
117 name: "disabled",
118 type: "`boolean`",
119 optional: true,
120 description: "Whether the action is disabled.",
121 },
122 {
123 name: "disabledTooltip",
124 type: "`string` \\| `React.ReactNode`",
125 optional: true,
126 description:
127 "The tooltip to show when the user hovers over the action while it's disabled. Medusa shows the tooltip to the right of the action.",
128 },
129 ],
130 },
131 ],
132 },
133 {
134 name: "variant",
135 type: '`"transparent"` \\| `"primary"`',
136 optional: true,
137 defaultValue: "transparent",
138 description:
139 "The variant of the default trigger button. Medusa ignores it when you pass your own trigger as `children`.",
140 },
141 {
142 name: "children",
143 type: "`React.ReactNode`",
144 optional: true,
145 description:
146 "A custom trigger element. If you don't pass one, Medusa shows a small icon button with a three-dot icon.",
147 },
148 ]}
149 />
150
151 ---
152
153 ## Related Components
154
155 - [SectionRow](../section-row/page.mdx): pass an `ActionMenu` as the row's `actions`.