Skip to content

Avatar

Used as an avatar, it can be displayed in the form of pictures, icons or characters.

Basic Usage

The basic use of avatars. If the avatar is text, the font size will be automatically adjusted to fit the avatar.

A
TuView
A
avatar

Size

The size of the avatar can be adjusted by setting the size field. The default size is 40px. Set the shape field, you can set whether the profile picture is a circle or a square.

A
A
A
A
A
A
A
A

Group

Use Avatar.Group to group a list of avatars. size can be used to specify the size of each avatar..

A
B
C
Tu
View
A
B
C
Tu
View
A
B
C
2..

Trigger Icon

You can customize the interactive button through trigger-icon and trigger-type. There are two types: mask and button.

A
avatar

Auto Fix Font Size

If the avatar content is text, the font size will be automatically adjusted to fit the content in the avatar.

A

Custom Avatar Path

Custom Avatar Path

avatar

Failed to load:

avatar

Effects

Card provide five different themes: outset、inset、bordered、outlined and flat. Using effect to change, default is outset.

A
A
A
A
A

Avatar API

Avatar Attributes

NameDescriptionTypeDefault
shapeThe shape of the avatar, there are two kinds of circle (circle) and square (square)Stringcircle
imageUrlCustom avatar image address. If this attribute is passed in, the img tag will be rendered by defaultString-
sizeThe size of the avatar, the unit is px. Use size 40px in styles when not filledNumber-
auto-fix-font-sizeWhether to automatically adjust the font size according to the size of the avatar.Booleantrue
triggerTypeClickable avatar interaction typeStringmask
trigger-icon-styleInteractive icon styleCSSProperties-
effectEffectStringoutset

Avatar Event

NameDescriptionType
clickCallback when clickedFunction
errorImage load error-
loadImage load success-

Avatar Slots

NameDescription
trigger-iconClickable avatar interaction icon

AvatarGroup API

AvatarGroup Attributes

NameDescriptionTypeDefault
shapeThe shape of the avatar in the group, there are two kinds of circle (circle) and square (square)Stringcircle
sizeThe size of the avatar in the group, the unit is pxNumber-
auto-fix-font-sizeWhether to automatically adjust the font size according to the size of the avatar.Booleantrue
max-countThe maximum number of avatars displayed in the avatar group. The excess avatars will be displayed in the form of +x.Number0
z-index-ascendThe avatar z-index in the avatar group increases, and the default is decreasing.Booleanfalse
max-styleStyle for +x.CSSProperties-