StylishBadge

fun StylishBadge(modifier: Modifier = Modifier, containerColor: Color = MaterialTheme.colorScheme.error, contentColor: Color = MaterialTheme.colorScheme.onError, shape: Shape = CircleShape, content: @Composable () -> Unit)

A small notification badge that communicates a count or status at a glance. Intended for the badge slot of a navigation item (see StylishNavigationBar) and similar compact contexts such as icon buttons or tab bars.

The content is rendered inside a pill-shaped Surface using the error color scheme by default, with MaterialTheme.typography.labelSmall provided as the default LocalTextStyle so plain Text children pick up the compact badge typography automatically. Text color falls back to contentColor via LocalContentColor.

The root carries the default test tag stylish_badge for UI tests; callers can override it by passing their own Modifier.testTag(...) in modifier.

Parameters

modifier

Modifier applied to the Surface root.

containerColor

Background color of the badge. Defaults to MaterialTheme.colorScheme.error.

contentColor

Default color for the badge content. Defaults to MaterialTheme.colorScheme.onError.

shape

Shape of the badge surface. Defaults to CircleShape (the classic pill).

content

Content inside the badge, typically a short Text such as a count ("3", "99+") or a dot.

See also

StylishNavigationBar