UX4G Logo
Components

Avatar

Comprehensive Avatar suite featuring Basic Avatar, Profile Avatar with badges/actions, Avatar Group, and Status Avatar

The UX4G Avatar suite provides 4 modular composable components for citizen profiles, verification badges, status indicators, and collaborative team stacks:

  1. Basic Avatar (Ux4gAvatar): Standard profile picture, initials, or icon fallback.
  2. Profile Avatar (Ux4gProfileAvatar): Base avatar with bottom-right verification badges or interactive action buttons.
  3. Avatar Group (Ux4gAvatarGroup): Stacked overlapping or spaced avatar group with automatic +N overflow limit counters.
  4. Status Avatar (Ux4gStatusAvatar): Online, offline, busy, and warning presence indicators.

Import from com.ux4g.designsystemv1.components.avatar_component.*.


Interactive Previews

1. Basic Avatar (Ux4gAvatar)

Ux4gAvatar (Initials)Jetpack Compose
UX4G Basic Avatar Preview

2. Profile Avatar (Ux4gProfileAvatar)

Ux4gProfileAvatar (Badges & Actions)Jetpack Compose
UX4G Profile Avatar Preview

3. Avatar Group (Ux4gAvatarGroup)

Ux4gAvatarGroup (Overlapping Stacks & Limits)Jetpack Compose
UX4G Avatar Group Preview

4. Status Avatar (Ux4gStatusAvatar)

Ux4gStatusAvatar (Online, Busy, Warning, Offline)Jetpack Compose
UX4G Status Avatar Preview

Kotlin Usage

Avatar Showcase Example
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.avatar_component.Ux4gAvatar
import com.ux4g.designsystemv1.components.avatar_component.Ux4gProfileAvatar
import com.ux4g.designsystemv1.components.avatar_component.Ux4gProfileAvatarVariant
import com.ux4g.designsystemv1.components.avatar_component.Ux4gAvatarGroup
import com.ux4g.designsystemv1.components.avatar_component.Ux4gAvatarGroupItem
import com.ux4g.designsystemv1.components.avatar_component.Ux4gStatusAvatar
import com.ux4g.designsystemv1.components.avatar_component.Ux4gStatusAvatarVariant
import com.ux4g.designsystemv1.components.avatar_component.Ux4gAvatarSize

@Composable
fun AvatarShowcaseScreen() {
    Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(24.dp)) {
        // 1. Basic Avatar
        Ux4gAvatar(
            initials = "AS",
            size = Ux4gAvatarSize.L
        )

        // 2. Profile Avatar with Verified Badge
        Ux4gProfileAvatar(
            initials = "MS",
            size = Ux4gAvatarSize.L,
            variant = Ux4gProfileAvatarVariant.Badge.Verified
        )

        // 3. Avatar Group with Limit
        Ux4gAvatarGroup(
            items = listOf(
                Ux4gAvatarGroupItem(initials = "JD"),
                Ux4gAvatarGroupItem(initials = "AS"),
                Ux4gAvatarGroupItem(initials = "MK"),
                Ux4gAvatarGroupItem(initials = "RJ"),
                Ux4gAvatarGroupItem(initials = "LS")
            ),
            size = Ux4gAvatarSize.M,
            maxLimit = 4,
            collapsed = true
        )

        // 4. Status Avatar
        Ux4gStatusAvatar(
            initials = "RK",
            size = Ux4gAvatarSize.L,
            variant = Ux4gStatusAvatarVariant.Online
        )
    }
}

Parameters

1. Ux4gAvatar Props

PropTypeDescriptionDefault
modifierModifierCompose layout modifier applied to avatar container.Modifier
sizeUx4gAvatarSizeDimension token: XS, S, M, L, XL, XXL, XXXL.Ux4gAvatarSize.M
shapeShapeClip boundary shape (defaults to circle).CircleShape
imageUrlAny?Remote image URL, drawable resource ID, or file model.null
initialsString?1-2 character initials displayed when image is absent.null
iconUx4gIcon?Fallback vector icon when neither image nor initials are provided.Ux4gIcons.Person
containerColorColor?Custom background fill color override.null
contentColorColor?Color applied to initials typography text.null
iconColorColor?Tint color applied to fallback icon.null

2. Ux4gProfileAvatar Props

PropTypeDescriptionDefault
modifierModifierCompose layout modifier.Modifier
sizeUx4gAvatarSizeBase avatar dimension token.Ux4gAvatarSize.M
imageUrlAny?Remote image URL or model.null
initialsString?Initials text fallback.null
avatarIconUx4gIcon?Icon fallback.Ux4gIcons.Person
variantUx4gProfileAvatarVariant?Overlay badge or interactive action placed at bottom-right.null
badgeSizeDp?Optional custom size override for bottom-right indicator.null
onVariantClick(() -> Unit)?Click listener invoked when citizen taps the variant indicator.null

Ux4gProfileAvatarVariant Sealed Class

Variant TypeClass / ObjectDescription
BadgeUx4gProfileAvatarVariant.Badge.VerifiedBlue checkmark shield badge for authenticated citizens.
BadgeUx4gProfileAvatarVariant.Badge.StarGold star badge for VIP / officer status.
BadgeUx4gProfileAvatarVariant.Badge.AdminOfficial shield badge for administration officers.
BadgeUx4gProfileAvatarVariant.Badge.Custom(iconRes)Custom drawable badge icon resource.
ActionUx4gProfileAvatarVariant.Action.EditEdit pencil button for profile avatar changes.
ActionUx4gProfileAvatarVariant.Action.CameraPhoto camera button for taking new profile pictures.
ActionUx4gProfileAvatarVariant.Action.RemoveRed trash / remove action indicator.
ActionUx4gProfileAvatarVariant.Action.Custom(icon, ...)Custom action button with specific icon and colors.

3. Ux4gAvatarGroup Props

PropTypeDescriptionDefault
items *List<Ux4gAvatarGroupItem>Ordered list of avatar models to render in the group stack.—
modifierModifierCompose layout modifier applied to the group container.Modifier
sizeUx4gAvatarSizeUniform dimension size for all avatars in group.Ux4gAvatarSize.M
maxLimitInt?Maximum visible avatars before rendering +N remaining counter pill.null
collapsedBooleanWhen true, avatars overlap with border cutout rings. When false, avatars are spaced.true
borderColorColor?Ring cutout stroke color in collapsed mode (defaults to surface).null
borderWidthDpCutout stroke border thickness.2.dp
onRemainingClick(() -> Unit)?Click handler callback when citizen taps the +N count pill.null

Ux4gAvatarGroupItem Data Class

PropTypeDescriptionDefault
imageUrlAny?Remote image URL or model for the item.null
initialsString?Initials fallback text for the item.null
iconUx4gIcon?Icon fallback for the item.Ux4gIcons.Person
onClick(() -> Unit)?Individual click callback when this specific avatar is tapped.null

4. Ux4gStatusAvatar Props

PropTypeDescriptionDefault
modifierModifierCompose layout modifier.Modifier
sizeUx4gAvatarSizeBase avatar dimension token.Ux4gAvatarSize.M
imageUrlAny?Remote image URL or model.null
initialsString?Initials text fallback.null
avatarIconUx4gIcon?Icon fallback.Ux4gIcons.Person
variantUx4gStatusAvatarVariantPresence status dot indicator placed at bottom-right.Ux4gStatusAvatarVariant.Online
statusSizeDp?Custom dimension size for the status presence dot.null

Ux4gStatusAvatarVariant Sealed Class

VariantColor TokenDescription
OnlineGreen (#22C55E)User is currently active and online.
OfflineNeutral Gray (#111827 @ 50%)User is offline or disconnected.
BusyRed (#DC2626)User is engaged in an active authentication or session.
WarningOrange (#F97316)Temporary connection issue or pending verification.
SuccessGreen (#22C55E)Verified presence state.
ErrorRed (#DC2626)Verification failed or error state.
CustomUser-defined ColorCustom presence color token.

Ux4gAvatarSize Tokens

TokenOuter DiameterInitials TypographyIcon SizeIndicator Size
XS24.dp10.sp Medium14.dp12.dp
S32.dp14.sp Medium16.dp14.dp
M40.dp16.sp Medium20.dp16.dp
L48.dp20.sp Medium24.dp18.dp
XL64.dp24.sp Medium32.dp24.dp
XXL80.dp32.sp Medium40.dp30.dp
XXXL120.dp48.sp Medium60.dp42.dp

On this page