badge

Short styled text fragment atom, typically used for inline tags or status chips.

struct Component

source

pub struct Component

A short styled text fragment.

Field Type Description
style Style Style painted over the whole text.
text String Text shown as is, with no padding or truncation.

Implements Display.

Component::new

source

pub fn new(text: impl Into<String>, style: Style) -> Self

Create a badge with the given text and style.

Parameter Type Description
text impl Into<String> the text to show
style Style the style to paint it in
returns Self The badge, ready to display.