|
1
|
export const metadata = { |
|
2
|
title: `Install Medusa UI for Medusa Admin Customizations`, |
|
3
|
} |
|
4
|
|
|
5
|
# {metadata.title} |
|
6
|
|
|
7
|
In this guide, you'll learn how to use Medusa UI for building Medusa Admin customizations. |
|
8
|
|
|
9
|
## Use Medusa UI in Medusa Admin |
|
10
|
|
|
11
|
The `@medusajs/ui` and `@medusajs/icons` packages are already installed as dependencies of the `@medusajs/admin-sdk` package in your Medusa project. They're installed by default in your Medusa plugins as well. |
|
12
|
|
|
13
|
So, you can import the packages and use them in your Medusa Admin customizations without any additional installation steps. |
|
14
|
|
|
15
|
For example, to use the UI and icon packages in a UI route: |
|
16
|
|
|
17
|
```tsx title="src/admin/routes/custom/page.tsx" |
|
18
|
import { defineRouteConfig } from "@medusajs/admin-sdk" |
|
19
|
import { ChatBubbleLeftRight } from "@medusajs/icons" |
|
20
|
import { Container, Heading } from "@medusajs/ui" |
|
21
|
|
|
22
|
const CustomPage = () => { |
|
23
|
return ( |
|
24
|
<Container className="divide-y p-0"> |
|
25
|
<div className="flex items-center justify-between px-6 py-4"> |
|
26
|
<Heading level="h2">This is my custom route</Heading> |
|
27
|
</div> |
|
28
|
</Container> |
|
29
|
) |
|
30
|
} |
|
31
|
|
|
32
|
export const config = defineRouteConfig({ |
|
33
|
label: "Custom Route", |
|
34
|
icon: ChatBubbleLeftRight, |
|
35
|
}) |
|
36
|
|
|
37
|
export default CustomPage |
|
38
|
``` |
|
39
|
|
|
40
|
In this example, you use the [Container](../../components/container/page.mdx) and [Heading](../../components/heading/page.mdx) components in the UI route. You also use the `ChatBubbleLeftRight` icon from the [Icons package](../../icons/overview/page.mdx) for the UI route's sidebar item. |
|
41
|
|
|
42
|
--- |
|
43
|
|
|
44
|
## Related Resources |
|
45
|
|
|
46
|
If you're building Medusa Admin customizations, check out the following documentation guides: |
|
47
|
|
|
48
|
- [Admin Widgets](!docs!/learn/fundamentals/admin/widgets): Insert custom components into existing Medusa Admin pages. |
|
49
|
- [Admin UI Routes](!docs!/learn/fundamentals/admin/ui-routes): Add new pages to the Medusa Admin. |
|
50
|
- [Admin Components & Layouts](!resources!/admin-components): Use Medusa UI to implement common Medusa Admin components and layouts for a consistent design in your customizations. |