logo

Avatar

Avatars can be used to represent people or objects. It supports images, Icons, or letters.

Examples

Three sizes and two shapes are available.

expand code expand code

When an Avatar is populated with a string, the font size will change to autofit the text.

expand code expand code

Avatars can be grouped by utilizing the AvatarGroup container component.

expand code expand code

Image, Icon and letter are supported, and the latter two kinds avatar can have custom colors and background colors.

expand code expand code

Typically used for showing a count of notifications, avatars can be given badges.

expand code expand code

Avatar API#

Property Description Type Default Value
ChildContent ParameterContent to display inside avatar shape. Takes priority over AntDesign.Avatar.Text RenderFragment --
Shape ParameterShape of the avatar AvatarShape? AvatarShape.Circle
Size ParameterSize of the avatar. See AvatarSize for possible values. OneOf<AvatarSize, String> AvatarSize.Default
Text ParameterText string to display in the avatar. Typical use is for displaying initials. String --
Src ParameterImage src for the avatar. If this fails to load, AntDesign.Avatar.Icon and AntDesign.Avatar.ChildContent/AntDesign.Avatar.Text will continue to show. String --
SrcSet ParameterA list of sources to use for different screen resolutions. Passed straight to the img tag. String --
Alt ParameterAlternate text for the image String --
Icon ParameterIcon to display String --
OnError ParameterCallback executed when image passed to AntDesign.Avatar.Src fails to load EventCallback<ErrorEventArgs> --
Id ParameterID for the component's HTML String Uniquely Generated ID
Class ParameterSpecifies one or more class names for an DOM element. String --
Style ParameterSpecifies an inline style for a DOM element. String --
RefBack ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. ForwardRef --

AvatarGroup API#

Property Description Type Default Value
ChildContent ParameterThe child content RenderFragment --
MaxCount ParameterMax avatars to show Int32 --
MaxStyle ParameterThe style of excess avatar style String --
MaxPopoverPlacement ParameterThe placement of excess avatar Popover Placement --
Id ParameterID for the component's HTML String Uniquely Generated ID
Class ParameterSpecifies one or more class names for an DOM element. String --
Style ParameterSpecifies an inline style for a DOM element. String --
RefBack ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. ForwardRef --
Upload Badge
文档已更新,请点击 此处 更新。
A new version of this app is available. Click here to update.