pub struct Avatar { /* private fields */ }Expand description
A round picture of a person or a team, or their initials when there is no picture. The name
is required: it is the image’s alternative text and the source of the initials. When the
name is written right next to the avatar, call .decorative() so screen readers do not hear
it twice.
The picture follows the super::Image rules: a path of the app or an https address on a
host of the app’s img-src; any other picture is left out and the initials are shown.
use zeyn::ui::{Avatar, AvatarSize};
let ada = Avatar::new("Ada Lovelace").image("/img/people/ada.jpg").size(AvatarSize::Large);
let team = Avatar::new("Support team");
let beside_name = Avatar::new("Alan Turing").size(AvatarSize::Small).decorative();Implementations§
Source§impl Avatar
impl Avatar
pub fn new(name: impl Into<Text>) -> Self
Sourcepub fn image(self, src: impl Into<String>) -> Self
pub fn image(self, src: impl Into<String>) -> Self
The picture. Without one, or when it is not allowed, the initials are shown.
pub fn size(self, size: AvatarSize) -> Self
Sourcepub fn decorative(self) -> Self
pub fn decorative(self) -> Self
Hides the avatar from screen readers, for when the name is written next to it.
Trait Implementations§
Source§impl Component for Avatar
impl Component for Avatar
fn render(&self, out: &mut String, r: &Render<'_>)
fn grid(&self) -> Option<&dyn GridSource>
fn form(&self) -> Option<&dyn FormSource>
Source§fn reveal(&self, _field: &str) -> Option<Revealed>
fn reveal(&self, _field: &str) -> Option<Revealed>
The raw value of a masked field this component shows, for an audited reveal. The server
checks the unmask permission before sending it.
Source§fn import(&self) -> Option<&dyn ImportSource>
fn import(&self) -> Option<&dyn ImportSource>
CSV import, for components that import rows (see
crate::Import).Source§fn children(&self) -> &[Node]
fn children(&self) -> &[Node]
Nodes held by a container. Child
i of the node at path p has the path p.i.Source§fn eager_children(&self) -> &[Node]
fn eager_children(&self) -> &[Node]
Children rendered with the page. Others, such as closed lazy tabs, load when first shown.
Auto Trait Implementations§
impl Freeze for Avatar
impl RefUnwindSafe for Avatar
impl Send for Avatar
impl Sync for Avatar
impl Unpin for Avatar
impl UnsafeUnpin for Avatar
impl UnwindSafe for Avatar
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