|
1
|
# Admin Customizations |
|
2
|
|
|
3
|
You can extend the Medusa Admin to add widgets and new pages. Your customizations interact with API routes to provide merchants with custom functionalities. |
|
4
|
|
|
5
|
## Example: Create a Widget |
|
6
|
|
|
7
|
A widget is a React component that can be injected into an existing page in the admin dashboard. |
|
8
|
|
|
9
|
For example, create the file `src/admin/widgets/product-widget.tsx` with the following content: |
|
10
|
|
|
11
|
```tsx title="src/admin/widgets/product-widget.tsx" |
|
12
|
import { defineWidgetConfig } from "@medusajs/admin-sdk" |
|
13
|
|
|
14
|
// The widget |
|
15
|
const ProductWidget = () => { |
|
16
|
return ( |
|
17
|
<div> |
|
18
|
<h2>Product Widget</h2> |
|
19
|
</div> |
|
20
|
) |
|
21
|
} |
|
22
|
|
|
23
|
// The widget's configurations |
|
24
|
export const config = defineWidgetConfig({ |
|
25
|
zone: "product.details.after", |
|
26
|
}) |
|
27
|
|
|
28
|
export default ProductWidget |
|
29
|
``` |
|
30
|
|
|
31
|
This inserts a widget with the text “Product Widget” at the end of a product’s details page. |