Avatar

PRO

You can edit 8 Components for free. Get premium for unlimited access.

An image element with a fallback for representing the user.

Jetpack Compose

The Avatar component is used to display profile pictures or provide easy visual access to account settings.

1. Reference

This component inherits props from the Avatar.

Prop
Type
Default
type
AvatarType.icon
AvatarType.image
AvatarType.initials

-

size
AvatarSize.xs
AvatarSize.sm
AvatarSize.md
AvatarSize.lg
AvatarSize.lg
state
AvatarState.default
AvatarState.offline
AvatarState.online
AvatarState.default

2. Type

You can edit the type with the AvatarType.icon, AvatarType.image or AvatarType.initials parameter.

NB
avatar-img
Avatar(
size = AvatarSize.md,
type = AvatarType.icon(R.drawable.profile),
state = AvatarState.default
)

Avatar(
size = AvatarSize.md,
type = AvatarType.initials(text:"Aa"),
state = AvatarState.default
)

Avatar(
size = AvatarSize.md,
type = AvatarType.image(AvatarImage.Drawable(R.drawable.img_person)),
state = AvatarState.default
)

3. Size

You can edit the size with the AvatarSize.xs, AvatarSize.sm, AvatarSize.md or AvatarSize.lg parameter.

Avatar(
size = AvatarSize.lg,
type = AvatarType.icon(R.drawable.profile),
state = AvatarState.default
)

Avatar(
size = AvatarSize.md,
type = AvatarType.icon(R.drawable.profile),
state = AvatarState.default
)

Avatar(
size = AvatarSize.sm,
type = AvatarType.icon(R.drawable.profile),
state = AvatarState.default
)

Avatar(
size = AvatarSize.xs,
type = AvatarType.icon(R.drawable.profile),
state = AvatarState.default
)

4. State

You can edit the state with the AvatarState.default, AvatarState.offline or AvatarState.online parameter.

Avatar(
size = AvatarSize.md,
type = AvatarType.icon(R.drawable.profile),
state = AvatarState.default
)

Avatar(
size = AvatarSize.md,
type = AvatarType.icon(R.drawable.profile),
state = AvatarState.offline
)

Avatar(
size = AvatarSize.md,
type = AvatarType.icon(R.drawable.profile),
state = AvatarState.online
)

Preview

AV
avatar-img
DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.lg,
        presence: DLAvatarPresence.default,
        showPresence: false,
      ),
DLAvatar(
        type: DLAvatarType.initials,
        size: DLAvatarSize.lg,
        presence: DLAvatarPresence.default,
        showPresence: false,
        initials: 'Aa',
      ),
DLAvatar(
        type: DLAvatarType.image,
        size: DLAvatarSize.lg,
        presence: DLAvatarPresence.default,
        showPresence: false,
        imageProvider: memoji,
      )
Copy

Usage

Add this code example to your project to see how the component works.

DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.lg,
        presence: DLAvatarPresence.default,
        showPresence: false,
      )
Copy

Examples

Size

DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.lg,
        presence: DLAvatarPresence.default,
        showPresence: false,
      ),
DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.md,
        presence: DLAvatarPresence.default,
        showPresence: false,
      ),
DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.sm,
        presence: DLAvatarPresence.default,
        showPresence: false,
      ),
DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.xs,
        presence: DLAvatarPresence.default,
        showPresence: false,
      )
Copy

State

DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.lg,
        presence: DLAvatarPresence.default,
        showPresence: false,
      ),
DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.lg,
        presence: DLAvatarPresence.offline,
        showPresence: true,
      ),
DLAvatar(
        type: DLAvatarType.icon,
        size: DLAvatarSize.lg,
        presence: DLAvatarPresence.online,
        showPresence: true,
      )
Copy

Discover more content

You have questions or need help?

E-Mail

You want to try?

Test for free

Save time and money?

Get Pro Version