Avatar

An image element with a fallback for representing the user.

CNER
CNLRER
+3

Basic

A basic avatar component with an image and a fallback.

CN

Badge

Use the AvatarBadge component to add a badge to the avatar. The badge is positioned at the bottom right of the avatar.

CN

Badge with Icon

You can also use an icon inside a badge.

PP

Avatar Group

Use AvatarGroup to group avatars.

CNLRER

Avatar Group Count

Use AvatarGroupCount to add a count to the group.

CNLRER
+3

Avatar Group with Icon

You can also use an icon inside .

CNLRER

Sizes

Use the size prop to change the size of the avatar.

CNCNCN

Dropdown

You can use an Avatar component as a trigger for a dropdown menu.

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;
use singlestage::avatar::*;

#[component]
pub fn AvatarAnatomy() -> impl IntoView {
    view! {
        <Avatar>
            <AvatarImage />
            <AvatarFallback />
        </Avatar>
    }
}

API Reference

Avatar

Contains the contents of an avatar.

Custom Attributes
NameTypeDefaultDescription
sizeString"default"

Set which size avatar to display. Accepted values: "sm" | "default" | "lg".

Implements global attributes.

AvatarBadge

Displays a badge overlay at the bottom right of an avatar.

Implements global attributes.

AvatarFallback

Renders a text fallback inside the avatar.

Implements global attributes.

AvatarGroup

Renders a group of Avatar components.

Implements global attributes.

AvatarGroupCount

Displays a count representing additional hidden avatars.

Implements global attributes.

AvatarImage

Renders an image inside the avatar.

Implements global and img attributes.