1.3.0 • Published 2 years ago
@illa-design/avatar v1.3.0
Avatar
The Avatar component is used to represent a user and displays the pictures, text or icon.
Installation
yarn add @illa-design/avatarImport component
import { Avatar } from "@illa-design/avatar"API
Avatar Basic Properties
| Props | Desc | Type | Default |
|---|---|---|---|
| colorScheme | Color of avatar | "white" | "blackAlpha" | "gray" | "grayBlue" | "red" | "orange" | "yellow" |"green" |"blue" |"cyan" |"purple" | "gray" |
| src | The image url of avatar | string | string[] | - |
| size | Size of the avatar | "small" | "medium" | "large" | "small" |
| text | The displayed text of the avatar when src is not loaded | string | string[] | - |
| shape | The shape of avatar | "circle" | "square" | "circle" |
| icon | The default avatar when text and src is not specified | ReactNode | - |
Avatar-group Basic Properties
| Props | Desc | Type | Default |
|---|---|---|---|
| colorScheme | Color of avatar group | "white" | "blackAlpha" | "gray" | "grayBlue" | "red" | "orange" | "yellow" | "green" | "blue" | "cyan" | "purple" | "gray" |
| size | Size of avatar group | "small" | "medium" | "large" | "small" |
| maxCount | The max count of avatar group | number | - |
| zIndexAscend | The avatars are z-index ascend or not | boolean | false |
Avatar Events
| Props | Desc | Type | Default |
|---|---|---|---|
| onClick | Callback when click the avatar | () => void | - |
Example
import Sandpack from '@site/src/components/Sandpack'
export const code = `
<>
<Avatar />
<Avatar size="small">Small</Avatar>
<Avatar shape="square" colorScheme="red">Small</Avatar>
<Avatar src='https://bit.ly/dan-abramov' />
<Avatar text="e" />
</>`
export const importStatement = `import { Avatar } from '@illa-design/avatar'`
export const packages = {"@illa-design/avatar":"latest"}
<Sandpack code={code} packages={packages} importStatement={importStatement} template="react-ts"/>Basic usage
<Avatar />Set Avatar's size
<Avatar size="small">Small</Avatar>Set Avatar's shape and color
<Avatar shape="saqure" colorScheme="red">Small</Avatar>Set Avatar's icon
<Avatar icon={<CloseIcon />} />Set Avatar's image
<Avatar src='https://bit.ly/dan-abramov' />Set Avatar's text
<Avatar text="e" />Set Avatar-group's max count
<AvatarGroup maxCount={2}>
<Avatar text="I" />
<Avatar text="L" />
<Avatar text="L" />
<Avatar text="A" />
</AvatarGroup>1.2.0
2 years ago
1.3.0
2 years ago
1.0.29
2 years ago
1.0.28
2 years ago
1.0.27
2 years ago
1.0.30
2 years ago
1.1.0
2 years ago
1.0.22
3 years ago
1.0.21
3 years ago
1.0.26
2 years ago
1.0.25
2 years ago
1.0.24
3 years ago
1.0.23
3 years ago
1.0.19
3 years ago
1.0.18
3 years ago
1.0.17
3 years ago
1.0.20
3 years ago
1.0.16
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago
0.0.10
3 years ago
0.0.11
3 years ago
0.0.12
3 years ago
0.0.13
3 years ago
0.0.14
3 years ago
0.0.15
3 years ago
0.0.9
3 years ago
0.0.16
3 years ago
0.0.17
3 years ago
0.0.8
3 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.1
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1-alpha.0
4 years ago