Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
Data displayAndroid

Floating badge

Overlay a count on an icon button or avatar.

Public APILumenFloatingBadgeAndroid / Compose

Native example

Use Floating badge

Cap large counts, such as 99+.

Floating badge rendered in the Android phone emulator Lumen playground
Captured exampleAndroid phone emulatorView dark appearance
kotlin
import androidx.compose.runtime.*
import com.santi020k.lumen.*

@Composable
fun NotificationsButton() {
    var unread by remember { mutableIntStateOf(3) }
    LumenFloatingBadge(count = unread) {
        LumenIconButton(
            name = LumenIconName.Bell,
            contentDescription = "Notifications, $unread unread",
            onClick = { unread = 0 },
            intent = LumenButtonIntent.Outline
        )
    }
}
Android
A decorative unread count on a notifications button whose accessible name carries the count.

Reference

Public API

The primary shared and platform-specific options exposed by LumenFloatingBadge.

APIValues or typeDefaultDescription
count / max / contentnumber / cap / anchorrequired / 99 / requiredCap large counts, such as 99+.

Native behavior

Design and accessibility

When to use it

Cap large counts, such as 99+.

Accessibility

Decorative by default; put the count in the anchor's name.

Shared component

Available on other platforms

React NativeApple / SwiftUI Web
Android docsCompose module