pub struct Badge { /* private fields */ }Expand description
A count or a dot pinned to a corner of its child (an icon, an avatar).
let b = Badge![content = "3", color = Color::Danger, Avatar![name = "Ada"]];
assert!(render_static(b).contains(r#"<span class="nr-badge-content nr-badge-tr nr-c-danger nr-badge-md">3</span>"#));Implementations§
Source§impl Badge
impl Badge
pub fn new() -> Self
Sourcepub fn class(self, v: impl Into<String>) -> Self
pub fn class(self, v: impl Into<String>) -> Self
Extra classes for the outer element. They win over the defaults.
Sourcepub fn with(self, part: impl Part) -> Self
pub fn with(self, part: impl Part) -> Self
Add an attribute (class(..), id(..), aria(..), …) or a child.
pub fn color(self, v: Color) -> Self
pub fn size(self, v: Size) -> Self
pub fn placement(self, v: Placement) -> Self
Keep the child, hide the badge (a count of zero).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Badge
impl !Sync for Badge
impl !UnwindSafe for Badge
impl Forget for Badge
impl Freeze for Badge
impl Move for Badge
impl Send for Badge
impl Unpin for Badge
impl UnsafeUnpin for Badge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more