UX4G Logo
Components

Badge

Status labels, notification count pills, verification icons, and widget-anchored badges

Status labels, notification count pills, verification icons, and widget-anchored badges.

Import from com.ux4g.designsystemv1.components.Ux4gBadge.


Interactive Preview

Ux4gBadgeJetpack Compose
CountUX4G Count Badge
IconUX4G Icon Badge
DotUX4G Dot Badge
VerificationUX4G Verification Badge

Kotlin Usage

Compose Example
import androidx.compose.runtime.Composable
import com.ux4g.designsystemv1.components.Ux4gBadge
import com.ux4g.designsystemv1.components.Ux4gBadgeType
import com.ux4g.designsystemv1.components.Ux4gBadgeLimit
import com.ux4g.designsystemv1.foundation.Ux4gColors

@Composable
fun BadgeExample() {
    Ux4gBadge(
        type = Ux4gBadgeType.Label("VERIFIED"),
        containerColor = Ux4gColors.green600
    )
}

Parameters

Ux4gBadge Props

PropTypeDescriptionDefault
type *Ux4gBadgeTypeType configuration: Dot, Count, Label, Icon, or ReadyToUse.—
modifierModifierCompose layout modifier.Modifier
containerColorColorBackground fill color of the badge container.Ux4gColors.primary
contentColorColorColor for text or icon inside the badge.Ux4gColors.white
showBorderBooleanWhether to display outer boundary stroke.false
borderColorColorStroke outline color when showBorder = true.Ux4gColors.neutral300
alignmentUx4gBadgeAlignmentCorner anchor placement when wrapping child content (TopEnd, TopStart, BottomEnd, BottomStart).Ux4gBadgeAlignment.TopEnd
content(@Composable () -> Unit)?Optional child composable to anchor the badge overlay upon.null

Ux4gBadgeType Sealed Class Variants

VariantParametersDescription
Dotsize: Dp = 8.dpSmall circular presence or unread indicator dot.
Count / Textcount: Int, limit: Ux4gBadgeLimitNumeric count badge displaying formatted values (e.g. 9+, 99+).
Labeltext: StringCapsule pill displaying short capitalized label text.
IconiconRes: Int or icon: Ux4gIconSmall icon badge inside rounded container.
ReadyToUseresource: Ux4gBadgeResourcePre-styled official badges (Verification, Star, Shield).

On this page