Skip to main content

UserAvatar

Function UserAvatar 

Source
pub fn UserAvatar(_: UserAvatarProps) -> Element
Expand description

用户头像:有图显示图,无图回退展示名首字符(accent 软底)。

头像三态(图片 / 首字符)的统一实现,调用方经 class 控制尺寸与形状 (须含 w-* h-* rounded-full 与字号如 text-xs)。使用处:后台侧栏 用户卡片(28px)、个人信息页身份卡(96px,外层按钮带 hover 遮罩)、 前台评论表单身份行(32px)。

Props:

  • name:展示名(用于首字符兜底与 alt 文本)
  • avatar_url:头像 URL;None 或空白串时渲染首字符兜底
  • class:尺寸与形状类;组件内补 object-cover(图片)/ flex 居中(首字符)

§Props

For details, see the props struct definition.