State of Compose 2023 results are in! Click here to learn more

← Back to Material Compose

BadgedBox

Component
in
Material
. Since 1.1.0

Overview

Code Examples

A BadgeBox is used to decorate content with a badge that can contain dynamic information, such as the presence of a new notification or a number of pending requests. Badges can be icon only or contain short text.

A common use case is to display a badge with bottom navigation items. For more information, see Bottom Navigation(https://material.io/components/bottom-navigation#behavior)

A simple icon with badge example looks like:

Overloads

BadgedBox

@Composable
fun BadgedBox(
    badge: @Composable BoxScope.() -> Unit,
    modifier: Modifier = Modifier,
    content: @Composable BoxScope.() -> Unit,
)

Parameters

NameDescription
badgethe badge to be displayed - typically a Badge
modifieroptional Modifier for this item
contentthe anchor to which this badge will be positione