Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Apple docs
Data displayApple

Floating badge

Overlay a count on an icon button or avatar.

Public APILumenFloatingBadgeApple / SwiftUISwift product: LumenUI

Apple availability

Supported native targets

Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.

iPhone · iOS 16+iPad · iPadOS 16+Mac · macOS 13+Apple TV · tvOS 16+Apple Vision · visionOS 1+Apple Watch · watchOS 9+

Native example

Use Floating badge

Cap large counts, such as 99+.

Floating badge rendered in the iPhone simulator Lumen playground
Captured exampleiPhone simulatorView dark appearance
swift
import LumenUI
import SwiftUI

struct FloatingBadgeExample: View {
    var body: some View {
        HStack(spacing: LumenSpacing.xl) {
            LumenFloatingBadge(count: 12) {
                LumenIconButton(name: .mail, label: "Inbox, 12 unread", intent: .outline) {}
            }
            LumenFloatingBadge(count: 120) {
                LumenIconButton(name: .bell, label: "Alerts, more than 99", intent: .outline) {}
            }
        }
    }
}
Apple
An inbox button with an unread count and an alerts button whose count caps at 99+.

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 NativeAndroid / Compose Web
Apple docsSwiftUI package