|
1
|
import { ComponentExample } from "@/components/ComponentExample" |
|
2
|
import { ComponentReference } from "@/components/ComponentReference" |
|
3
|
|
|
4
|
export const metadata = { |
|
5
|
title: `Avatar`, |
|
6
|
} |
|
7
|
|
|
8
|
# {metadata.title} |
|
9
|
|
|
10
|
A component for displaying user avatars with a fallback option. |
|
11
|
|
|
12
|
In this guide, you'll learn how to use the Avatar component. |
|
13
|
|
|
14
|
<ComponentExample name="avatar-demo" /> |
|
15
|
|
|
16
|
## Usage |
|
17
|
|
|
18
|
```tsx |
|
19
|
import { Avatar } from "@medusajs/ui" |
|
20
|
``` |
|
21
|
|
|
22
|
```tsx |
|
23
|
<Avatar |
|
24
|
src="https://avatars.githubusercontent.com/u/10656202?v=4" |
|
25
|
fallback="M" |
|
26
|
/> |
|
27
|
``` |
|
28
|
|
|
29
|
--- |
|
30
|
|
|
31
|
## API Reference |
|
32
|
|
|
33
|
<ComponentReference mainComponent="Avatar" /> |
|
34
|
|
|
35
|
--- |
|
36
|
|
|
37
|
## Examples |
|
38
|
|
|
39
|
### Avatar Variants |
|
40
|
|
|
41
|
<ComponentExample name="avatar-variants" /> |
|
42
|
|
|
43
|
### Avatar Sizes |
|
44
|
|
|
45
|
<ComponentExample name="avatar-sizes" /> |
|
46
|
|
|
47
|
### Avatar Fallback Only |
|
48
|
|
|
49
|
<ComponentExample name="avatar-fallback" /> |
|
50
|
|
|
51
|
### Avatar Custom Styling |
|
52
|
|
|
53
|
<ComponentExample name="avatar-custom-style" /> |
|
54
|
|
|
55
|
### Avatar Accessibility |
|
56
|
|
|
57
|
You can add the `aria-label` prop to the Avatar component for better accessibility. |
|
58
|
|
|
59
|
<ComponentExample name="avatar-accessible" hideFeedback /> |