Badge

A small label component with four theme variants, an optional dot mode, and support for custom background color and corner radius.

Badge renders a small pill-shaped label with 11sp semibold text. When content is omitted, it renders as a minimal 6 dp filled dot — useful as a notification indicator. The roundedSize parameter controls corner radius, and backgroundColor overrides the variant's default fill color.

Basic usage

Variants

Secondary

Destructive

Outline

Notification badge

Omit content to render a 6 dp dot. Pair it with Material3's BadgedBox to overlay it on another component.

Custom background and shape

Override the fill color with backgroundColor and adjust corner rounding with roundedSize. Both work independently of the variant.

API reference

Badge

ParameterTypeDefaultDescription
modifierModifierModifierApplied to the badge container.
variantBadgeVariantBadgeVariant.DefaultDetermines background, text, and border colors when backgroundColor is not set.
backgroundColorColor?nullExplicit fill color. Overrides the variant's default background when non-null.
roundedSizeDpMaterialTheme.radius.fullCorner radius of the badge shape.
contentDescriptionString?nullAccessibility label for screen readers. Set this for notification counts or the content-less dot badge, which otherwise carry no meaning to TalkBack/VoiceOver.
content(@Composable () -> Unit)?nullBadge label. When null, renders as a 6 dp filled dot with no padding.

BadgeVariant

ValueDescription
DefaultPrimary background with primary-foreground text.
SecondarySecondary background with secondary-foreground text.
DestructiveDestructive background with destructive-foreground text.
OutlineTransparent background with a 1 dp border and foreground text.
Edit this page on GitHub