-
Notifications
You must be signed in to change notification settings - Fork 9
Component Avatar
MeowLynxSea edited this page Jan 24, 2026
·
6 revisions
Displays a user/avatar image.
Avatar is a small image container with sensible defaults for user icons.
- Default size:
size_10()(theme-sized square) - Default shape:
AvatarShape::Circle - Optional status dot:
.status(color)
use gpui::{Image, px};
use std::sync::Arc;
use yororen_ui::component::{avatar, AvatarShape};
let image: Option<Arc<Image>> = None;
let view = avatar(image).shape(AvatarShape::Circle);- User profile pictures
- Account switchers / user menus
- Small “who is this” identity chips (often combined with
Label)
Not a good fit:
- Arbitrary content thumbnails (use
Image)
-
avatar(Option<Arc<Image>>)/Avatar::new(...): constructor -
shape(AvatarShape):-
Circle(default) Square
-
-
bg(Hsla): background behind the image / fallback -
status(Hsla): render a small status dot (online / busy / etc.)
- When
imageisNone, Avatar renders a simple fallback ("?"). - The status dot is positioned bottom-right and has a border matching
theme.surface.baseso it reads well on top of the avatar.
- Size:
size_10() - Shape:
Circle - Fallback content:
"?"when no image is provided
use gpui::rgb;
use yororen_ui::component::avatar;
let view = avatar(None).status(rgb(0x00FF00));use gpui::rgb;
use yororen_ui::component::{avatar, AvatarShape};
let view = avatar(None)
.shape(AvatarShape::Square)
.bg(rgb(0xEFEFF2));Yororen UI v0.3.0 · repository · Apache-2.0 · This wiki documents Yororen UI v0.3.0.
This wiki documents Yororen UI v0.3.0 — the headless-core, swappable-renderer build.