KAvatar
Avatars can be used to represent people or objects. It supports images, Icons, or characters.
Install
bash
pnpm add @ikun-ui/avatarbash
yarn add @ikun-ui/avatarbash
npm install @ikun-ui/avatarBasic usage
Use size and radius prop to set avatar's size and radius.
Types
It supports images, Icons, or characters.
Fallback
fallback when image load error.
Fit Container
Set how the image fit its container for an image avatar, same as object-fit .
Avatar Props
| Name | Type | Default | Description |
|---|---|---|---|
| icon | string | '' | The class name of the icon, following the unocss standard. |
| src | string | '' | the source of the image for an image avatar.. |
| srcSet | string | '' | native attribute srcset of image avatar. |
| alt | string | '' | native attribute alt of image avatar. |
| fit | fill / contain / cover / none / scale-down | cover | set how the image fit its container for an image avatar. |
| size | string / number | 50px | avatar size, the default unit is px. |
| radius | string / number | 4px | avatar radius, the default unit is px. |
| cls | string | '' | Additional class for component |
| attrs | Record<string, string> | {} | Additional attributes |
Avatar Events
| Name | Description | Type |
|---|---|---|
| error | trigger when image load error. | (event: CustomEvent)=> void |
Avatar Slots
| Name | Description |
|---|---|
| default | Customize default content |