pub fn Badge(_: BadgeProps) -> ElementExpand 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.
weight:Option<f32>width:Option<f32>height:Option<f32>padding:Option<f32>padding_role:Option<SpaceRole>background:Option<Paint>shape_role:Option<ShapeRole>corner_radius:Option<f32>border_width:Option<f32>border_color:Option<Paint>elevation:Option<f32>fill_max_width:boolfill_max_height:boolvalue:Option<u32>How many. Leave it out for a dot or a word: no count is not the same as a count of nothing, and only the screen knows which one it means.
text:Option<String>One short word, shown where a count would be. A count wins where both are given.
color:Option<ColorRole>The role the mark is filled with. The error role where it is not given.
children:Element