Skip to content

st.avatar to show a standalone avatar image #12475

@lukasmasuch

Description

@lukasmasuch

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

Provide a standalone st.avatar element to show a visual representation of users or things. This should support images (anything supported by `st.image), emojis, material icons, or short text and display it on a background.

Why?

This is a common UI component in many UI frameworks. The recent introduction of flex container makes it feasible to integrate this into many Streamlit apps.

How?

st.avatar(image: image-like, shape: "circle" | "square" | None, size: "small" | "medium" | "large")

Renders the avatar image with an appropriate background (similar to st.chat_message(avatar)). image should support anything supported by `st.image, emojis, material icons, or short text (e.g. initials).

This could be extended with on_click support and the ability to define the background color.

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:elementsRelated to Streamlit elementstype:enhancementRequests for feature enhancements or new featurestype:possible-componentCould be implemented as a custom component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions