Skip to main content

Badge

Function Badge 

Source
pub fn Badge(_: BadgeProps) -> Element
Expand description

A small mark on something else that says how many, that there is something new, or one short word.

With one child it is attached to that child: an icon, an avatar, a destination. With no child it stands on its own, the count at the end of a list row. Compose calls the first a BadgedBox and the second a Badge; here they are one widget, because whether there is something to attach to is already said by the children.

value is a count and text is a short word. With neither it is a dot. Where it sits on its child, what shape it is, and whether 120 is written out or shortened to 99+ are the design system’s, so there is no property for a corner or a ceiling.

The colour is a role and never a literal, and it defaults to the error role the way every one of these systems draws an unread count. The content is read out as part of the child it is attached to, and never on its own.

§Props

For details, see the props struct definition.