|
1
|
--- |
|
2
|
generate_toc: true |
|
3
|
--- |
|
4
|
|
|
5
|
import { ChildDocs } from "docs-ui" |
|
6
|
|
|
7
|
export const metadata = { |
|
8
|
title: `Medusa Admin Components, Hooks, and Utilities`, |
|
9
|
} |
|
10
|
|
|
11
|
# {metadata.title} |
|
12
|
|
|
13
|
In this section of the documentation, you'll find the components, hooks, layouts, and utilities that the `@medusajs/dashboard` package exports, and how to use them in your [admin extensions](!docs!/learn/fundamentals/admin). |
|
14
|
|
|
15
|
Use these exports to build widgets and UI routes that follow the same design conventions as the Medusa Admin, without re-implementing its components. |
|
16
|
|
|
17
|
<Note> |
|
18
|
|
|
19
|
The `@medusajs/dashboard` package exports these components, hooks, and utilities since Medusa [v2.21.0](https://github.com/medusajs/medusa/releases/tag/v2.21.0). Before that version, you had to build the components yourself, as shown in the [archived guides](./archive/page.mdx). |
|
20
|
|
|
21
|
</Note> |
|
22
|
|
|
23
|
The package has the following subpaths: |
|
24
|
|
|
25
|
- `@medusajs/dashboard/components`: React components, such as `ActionMenu` and `DataTable`. |
|
26
|
- `@medusajs/dashboard/hooks`: React hooks, such as `useProducts` and `useComboboxData`. |
|
27
|
- `@medusajs/dashboard/lib`: Utilities, such as `getStylizedAmount` and `defineSearchEntity`. |
|
28
|
|
|
29
|
<Note title="Tip"> |
|
30
|
|
|
31
|
These exports build on the [Medusa UI package](!ui!). Refer to the [Medusa UI documentation](!ui!) for a full list of the underlying components. |
|
32
|
|
|
33
|
</Note> |
|
34
|
|
|
35
|
--- |
|
36
|
|
|
37
|
## Components |
|
38
|
|
|
39
|
These components allow you to use the Medusa Admin's components in your custom UI routes and widgets. |
|
40
|
|
|
41
|
<ChildDocs showItems={["Components"]} onlyTopLevel={false} hideTitle /> |
|
42
|
|
|
43
|
--- |
|
44
|
|
|
45
|
## Layouts |
|
46
|
|
|
47
|
These layout components allow you to set the layout of your [UI routes](!docs!/learn/fundamentals/admin/ui-routes) similar to the layouts used in the Medusa Admin. |
|
48
|
|
|
49
|
<ChildDocs showItems={["Layouts"]} onlyTopLevel={false} hideTitle /> |
|
50
|
|
|
51
|
--- |
|
52
|
|
|
53
|
## Hooks |
|
54
|
|
|
55
|
These hooks allow you to fetch and mutate Medusa resources, and to build admin UI with the same behavior as the Medusa Admin. |
|
56
|
|
|
57
|
<ChildDocs showItems={["Hooks"]} onlyTopLevel={false} hideTitle /> |
|
58
|
|
|
59
|
--- |
|
60
|
|
|
61
|
## Utilities |
|
62
|
|
|
63
|
These utilities allow you to format data, validate forms, and register custom table and search behavior. |
|
64
|
|
|
65
|
<ChildDocs showItems={["Utilities"]} onlyTopLevel={false} hideTitle /> |
|
66
|
|
|
67
|
--- |
|
68
|
|
|
69
|
## Custom Component Guides |
|
70
|
|
|
71
|
These guides show how to build components and pages that the `@medusajs/dashboard` package doesn't export an equivalent for. |
|
72
|
|
|
73
|
<ChildDocs showItems={["Guides"]} onlyTopLevel={false} hideTitle /> |
|
74
|
|
|
75
|
--- |
|
76
|
|
|
77
|
## Archive |
|
78
|
|
|
79
|
These guides show how to build components that Medusa now exports. They're kept for reference only. Refer to the [archive](./archive/page.mdx) for the exported component that replaces each guide. |
|
80
|
|
|
81
|
<ChildDocs showItems={["Archive"]} onlyTopLevel={false} hideTitle /> |