Skip to main content
.badge(value: number | string)
value
number | string
required
The badge content. Pass a number for a count badge, or a string for a text badge.

Support

Usage

Numeric badge on a list row

Text("Inbox")
    .badge(5)

Text badge

Text("Updates")
    .badge("New")

Badge on a tab item

Label("Messages", { systemName: "message" })
    .badge(unreadCount)

Notes

Badges are most commonly used with List rows and TabView items. On iOS, the system renders the badge in a rounded capsule aligned to the trailing edge.

See Also