2017-05-28 14:20:59 +08:00
|
|
|
---
|
|
|
|
category: Components
|
|
|
|
type: Data Display
|
|
|
|
title: Avatar
|
|
|
|
---
|
|
|
|
|
2017-09-16 11:29:51 +08:00
|
|
|
Avatars can be used to represent people or objects. It supports images, `Icon`s, or letters.
|
2017-05-28 14:20:59 +08:00
|
|
|
|
|
|
|
## API
|
|
|
|
|
2019-07-11 14:14:33 +08:00
|
|
|
| Property | Description | Type | Default | Version |
|
|
|
|
| --- | --- | --- | --- | --- |
|
2019-08-13 14:07:17 +08:00
|
|
|
| icon | custom icon type for an icon avatar | ReactNode | - | |
|
2019-07-11 14:14:33 +08:00
|
|
|
| shape | the shape of avatar | `circle` \| `square` | `circle` | |
|
2020-01-17 17:23:48 +08:00
|
|
|
| size | the size of the avatar | number \| `large` \| `small` \| `default` | `default` | |
|
2019-07-11 14:14:33 +08:00
|
|
|
| src | the address of the image for an image avatar | string | - | |
|
2019-11-20 20:31:43 +08:00
|
|
|
| srcSet | a list of sources to use for different screen resolutions | string | - | |
|
|
|
|
| alt | This attribute defines the alternative text describing the image | string | - | |
|
|
|
|
| onError | handler when img load error, return false to prevent default fallback behavior | () => boolean | - | |
|