Documentation
Data display
Avatar

Avatar

Avatar
1 2 3 4 5 6 7 8 9 10 11 12 import React from "react" import { Avatar } from "@creation-ui/react" export const Example = () => ( <Avatar size={"md"} variant={"circle"} src={ "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=250&q=80" } /> )

Custom size avatar

Use size prop to set custom size of avatar in pixels.

10px

20px

30px

40px

50px

60px

100px

AvatarGroup

The AvatarGroup component is used to display a group of avatars.

with max property

The max property limits the number of avatars displayed. The remaining avatars are represented by a +{number} avatar. Also in this example surplusClassName property was useed to add custom styles to the +{number} avatar.

+1

with total property

The total property is used to display the total number of avatars. The remaining avatars are represented by a +{number} avatar.

+321

Component API

Avatar component props.

PropDefaultDescription
variantcircle
circle | rounded | square

The shape of the avatar.

sizemd
sm | md | lg | number

The size of the avatar.

src
string | null

The source of the avatar image.

alt
string

The alt text of the avatar.

badgenull
object

The badge of the avatar.

AvatarGroup component props.

PropDefaultDescription
total0
number

Manually controls the count displayed in last Avatar.

max
number

Amount of avatars to display. Surplus will be rendered as count in an extra (last) Avatar.

children
ReactNode

Avatars.

sizemd
sm | md | lg | number

The size of the avatars and counter.

offsetMultiplier-0.3
number

Multiplier for the offset of Avatars. Controls the overlap.

className
string

Container className

surplusClassName
string

className of surplus displaying Avatar (counter).

renderSurplus
(surplusCount: number) => ReactNode

Custom render function for surplus displaying Avatar (counter).