Skip to main content

AvatarModifiers

Trait AvatarModifiers 

Source
pub trait AvatarModifiers: Sized {
    // Required method
    fn variant<U: Into<AvatarVariant> + Clone + PartialEq + 'static>(
        self,
        variant: impl Res<U> + 'static,
    ) -> Self;

    // Provided method
    fn badge<F>(self, content: F) -> Self
       where F: FnOnce(&mut Context) -> Handle<'_, Badge> { ... }
}
Expand description

Modifiers for changing the appearance and content of an Avatar.

Required Methods§

Source

fn variant<U: Into<AvatarVariant> + Clone + PartialEq + 'static>( self, variant: impl Res<U> + 'static, ) -> Self

Selects the geometric variant of the Avatar. Accepts a value or signal of type AvatarVariant.

Avatar::new(cx, |cx|{
    Svg::new(cx, ICON_USER);
})
.variant(AvatarVariant::Rounded);

Provided Methods§

Source

fn badge<F>(self, content: F) -> Self
where F: FnOnce(&mut Context) -> Handle<'_, Badge>,

Adds a badge to the Avatar.

Avatar::new(cx, |cx|{
    Svg::new(cx, ICON_USER);
})
.badge(|cx| Badge::empty(cx).class("error"));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§