|
1
|
--- |
|
2
|
sidebar_label: "Icon Avatar" |
|
3
|
--- |
|
4
|
|
|
5
|
import { TypeList } from "docs-ui" |
|
6
|
|
|
7
|
export const metadata = { |
|
8
|
title: `IconAvatar - 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 `IconAvatar` component renders an icon inside an avatar-like container, which the [Avatar](!ui!/components/avatar) component from Medusa UI doesn't support. The Medusa Admin uses it in section headers and sidebar links, such as the location details page. |
|
20
|
|
|
21
|
```tsx |
|
22
|
import { IconAvatar } from "@medusajs/dashboard/components" |
|
23
|
``` |
|
24
|
|
|
25
|
--- |
|
26
|
|
|
27
|
## Example |
|
28
|
|
|
29
|
Show an icon avatar at the top of a widget: |
|
30
|
|
|
31
|
```tsx |
|
32
|
import { defineWidgetConfig } from "@medusajs/admin-sdk" |
|
33
|
import { IconAvatar } from "@medusajs/dashboard/components" |
|
34
|
import { Buildings } from "@medusajs/icons" |
|
35
|
import { Container, Heading } from "@medusajs/ui" |
|
36
|
|
|
37
|
const LocationWidget = () => { |
|
38
|
return ( |
|
39
|
<Container className="flex items-center gap-x-3"> |
|
40
|
<IconAvatar size="large" variant="squared"> |
|
41
|
<Buildings /> |
|
42
|
</IconAvatar> |
|
43
|
<Heading level="h2">Warehouse</Heading> |
|
44
|
</Container> |
|
45
|
) |
|
46
|
} |
|
47
|
|
|
48
|
export const config = defineWidgetConfig({ |
|
49
|
zone: "product.details.before", |
|
50
|
}) |
|
51
|
|
|
52
|
export default LocationWidget |
|
53
|
``` |
|
54
|
|
|
55
|
--- |
|
56
|
|
|
57
|
## Props |
|
58
|
|
|
59
|
<TypeList |
|
60
|
types={[ |
|
61
|
{ |
|
62
|
name: "children", |
|
63
|
type: "`React.ReactNode`", |
|
64
|
optional: false, |
|
65
|
description: `The icon to show in the avatar. Use an icon from the [Medusa Icons package](!ui!/icons/overview).`, |
|
66
|
}, |
|
67
|
{ |
|
68
|
name: "size", |
|
69
|
type: "`\"small\"` \\| `\"large\"` \\| `\"xlarge\"`", |
|
70
|
optional: true, |
|
71
|
defaultValue: "small", |
|
72
|
description: `The avatar's size.`, |
|
73
|
}, |
|
74
|
{ |
|
75
|
name: "variant", |
|
76
|
type: "`\"squared\"` \\| `\"rounded\"`", |
|
77
|
optional: true, |
|
78
|
defaultValue: "rounded", |
|
79
|
description: `The avatar's shape.`, |
|
80
|
}, |
|
81
|
{ |
|
82
|
name: "className", |
|
83
|
type: "`string`", |
|
84
|
optional: true, |
|
85
|
description: `Additional CSS classes to apply to the avatar's container.`, |
|
86
|
}, |
|
87
|
]} |
|
88
|
/> |