Flutter docs
Default skin

Avatar

Used to represent users or things, supporting the display of images, icons, or characters.

When to use

Used to represent users or things, supporting the display of images, icons, or characters.

Examples

Basic

Three sizes and two shapes are available.

Autoset Font Size

For letter type Avatar, when the letters are too long to display, the font size can be automatically adjusted according to the width of the Avatar. You can also use gap to set the unit distance between left and right sides.

Avatar.Group

Avatar group display.

Responsive Size

Avatar size can be automatically adjusted based on the screen size.

Type

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

With Badge

Usually used for reminders and notifications.

maxCount includes overflow

Wrap Avatar.Group with HOC to add overflowInFinal prop. When enabled, max.count represents the total number of elements to display and reserves 1 slot for the overflow indicator.

API

Avatar and Avatar.Group are exported from @ceebee/ui/client.

Avatar

PropertyDescriptionTypeDefaultVersion
altThis attribute defines the alternative text describing the imagestring-—
gapLetter type unit distance between left and right sidesnumber44.3.0
iconCustom icon type for an icon avatarReactNode-—
shapeThe shape of avatarcircle | squarecircle—
sizeThe size of the avatarnumber | large | medium | small | { xs: number, sm: number, ...}medium4.7.0
srcThe address of the image for an image avatar or image elementstring | ReactNode-ReactNode: 4.8.0
srcSetA list of sources to use for different screen resolutionsstring-—
draggableWhether the picture is allowed to be draggedboolean | 'true' | 'false'true—
crossOriginCORS settings attributes'anonymous' | 'use-credentials' | ''-4.17.0
onErrorHandler when img load error, return false to prevent default fallback behavior() => boolean-—

Avatar.Group <Badge>4.5.0+</Badge>

PropertyDescriptionTypeDefaultVersion
maxSet maximum display related configurations{ count?: number; style?: CSSProperties; popover?: PopoverProps }-5.18.0
maxCountDeprecated, please use max={{ count: number }}number-—
maxPopoverPlacementDeprecated, please use max={{ popover: PopoverProps }}top | bottomtop—
maxPopoverTriggerDeprecated, please use max={{ popover: PopoverProps }}hover | focus | clickhover—
maxStyleDeprecated, please use max={{ style: CSSProperties }}CSSProperties-—
sizeThe size of the avatarnumber | large | medium | small | { xs: number, sm: number, ...}medium4.8.0
shapeThe shape of the avatarcircle | squarecircle5.8.0