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:
- Basic Avatar (
Ux4gAvatar): Standard profile picture, initials, or icon fallback. - Profile Avatar (
Ux4gProfileAvatar): Base avatar with bottom-right verification badges or interactive action buttons. - Avatar Group (
Ux4gAvatarGroup): Stacked overlapping or spaced avatar group with automatic+Noverflow limit counters. - 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
2. Profile Avatar (Ux4gProfileAvatar)
Ux4gProfileAvatar (Badges & Actions)Jetpack Compose
3. Avatar Group (Ux4gAvatarGroup)
Ux4gAvatarGroup (Overlapping Stacks & Limits)Jetpack Compose
4. Status Avatar (Ux4gStatusAvatar)
Ux4gStatusAvatar (Online, Busy, Warning, Offline)Jetpack Compose
Kotlin Usage
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
| Prop | Type | Description | Default |
|---|---|---|---|
modifier | Modifier | Compose layout modifier applied to avatar container. | Modifier |
size | Ux4gAvatarSize | Dimension token: XS, S, M, L, XL, XXL, XXXL. | Ux4gAvatarSize.M |
shape | Shape | Clip boundary shape (defaults to circle). | CircleShape |
imageUrl | Any? | Remote image URL, drawable resource ID, or file model. | null |
initials | String? | 1-2 character initials displayed when image is absent. | null |
icon | Ux4gIcon? | Fallback vector icon when neither image nor initials are provided. | Ux4gIcons.Person |
containerColor | Color? | Custom background fill color override. | null |
contentColor | Color? | Color applied to initials typography text. | null |
iconColor | Color? | Tint color applied to fallback icon. | null |
2. Ux4gProfileAvatar Props
| Prop | Type | Description | Default |
|---|---|---|---|
modifier | Modifier | Compose layout modifier. | Modifier |
size | Ux4gAvatarSize | Base avatar dimension token. | Ux4gAvatarSize.M |
imageUrl | Any? | Remote image URL or model. | null |
initials | String? | Initials text fallback. | null |
avatarIcon | Ux4gIcon? | Icon fallback. | Ux4gIcons.Person |
variant | Ux4gProfileAvatarVariant? | Overlay badge or interactive action placed at bottom-right. | null |
badgeSize | Dp? | 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 Type | Class / Object | Description |
|---|---|---|
| Badge | Ux4gProfileAvatarVariant.Badge.Verified | Blue checkmark shield badge for authenticated citizens. |
| Badge | Ux4gProfileAvatarVariant.Badge.Star | Gold star badge for VIP / officer status. |
| Badge | Ux4gProfileAvatarVariant.Badge.Admin | Official shield badge for administration officers. |
| Badge | Ux4gProfileAvatarVariant.Badge.Custom(iconRes) | Custom drawable badge icon resource. |
| Action | Ux4gProfileAvatarVariant.Action.Edit | Edit pencil button for profile avatar changes. |
| Action | Ux4gProfileAvatarVariant.Action.Camera | Photo camera button for taking new profile pictures. |
| Action | Ux4gProfileAvatarVariant.Action.Remove | Red trash / remove action indicator. |
| Action | Ux4gProfileAvatarVariant.Action.Custom(icon, ...) | Custom action button with specific icon and colors. |
3. Ux4gAvatarGroup Props
| Prop | Type | Description | Default |
|---|---|---|---|
items * | List<Ux4gAvatarGroupItem> | Ordered list of avatar models to render in the group stack. | — |
modifier | Modifier | Compose layout modifier applied to the group container. | Modifier |
size | Ux4gAvatarSize | Uniform dimension size for all avatars in group. | Ux4gAvatarSize.M |
maxLimit | Int? | Maximum visible avatars before rendering +N remaining counter pill. | null |
collapsed | Boolean | When true, avatars overlap with border cutout rings. When false, avatars are spaced. | true |
borderColor | Color? | Ring cutout stroke color in collapsed mode (defaults to surface). | null |
borderWidth | Dp | Cutout stroke border thickness. | 2.dp |
onRemainingClick | (() -> Unit)? | Click handler callback when citizen taps the +N count pill. | null |
Ux4gAvatarGroupItem Data Class
| Prop | Type | Description | Default |
|---|---|---|---|
imageUrl | Any? | Remote image URL or model for the item. | null |
initials | String? | Initials fallback text for the item. | null |
icon | Ux4gIcon? | Icon fallback for the item. | Ux4gIcons.Person |
onClick | (() -> Unit)? | Individual click callback when this specific avatar is tapped. | null |
4. Ux4gStatusAvatar Props
| Prop | Type | Description | Default |
|---|---|---|---|
modifier | Modifier | Compose layout modifier. | Modifier |
size | Ux4gAvatarSize | Base avatar dimension token. | Ux4gAvatarSize.M |
imageUrl | Any? | Remote image URL or model. | null |
initials | String? | Initials text fallback. | null |
avatarIcon | Ux4gIcon? | Icon fallback. | Ux4gIcons.Person |
variant | Ux4gStatusAvatarVariant | Presence status dot indicator placed at bottom-right. | Ux4gStatusAvatarVariant.Online |
statusSize | Dp? | Custom dimension size for the status presence dot. | null |
Ux4gStatusAvatarVariant Sealed Class
| Variant | Color Token | Description |
|---|---|---|
Online | Green (#22C55E) | User is currently active and online. |
Offline | Neutral Gray (#111827 @ 50%) | User is offline or disconnected. |
Busy | Red (#DC2626) | User is engaged in an active authentication or session. |
Warning | Orange (#F97316) | Temporary connection issue or pending verification. |
Success | Green (#22C55E) | Verified presence state. |
Error | Red (#DC2626) | Verification failed or error state. |
Custom | User-defined Color | Custom presence color token. |
Ux4gAvatarSize Tokens
| Token | Outer Diameter | Initials Typography | Icon Size | Indicator Size |
|---|---|---|---|---|
XS | 24.dp | 10.sp Medium | 14.dp | 12.dp |
S | 32.dp | 14.sp Medium | 16.dp | 14.dp |
M | 40.dp | 16.sp Medium | 20.dp | 16.dp |
L | 48.dp | 20.sp Medium | 24.dp | 18.dp |
XL | 64.dp | 24.sp Medium | 32.dp | 24.dp |
XXL | 80.dp | 32.sp Medium | 40.dp | 30.dp |
XXXL | 120.dp | 48.sp Medium | 60.dp | 42.dp |