This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.3 instead.
Reason given by maintainers: Bug Fixes
Streamlit Avatar Stack
A selectable avatar stack built with Streamlit Components V2. It supports names, Material Symbols, remote images, data URIs, and local image paths.
Install
pip install streamlit-avatar-stack
For local development:
uv pip install -e .
Usage
import streamlit as st
from streamlit_avatar_stack import avatar_stack
avatars = [
"Ada Lovelace",
":material/engineering:",
"https://example.com/avatar.jpg",
"images/grace.png",
]
selected = avatar_stack(avatars, key="people")
st.write(selected)
The component detects each avatar type automatically. Images are cropped to fill the circle, and invalid images display a fallback icon. Nothing is selected by default; clicking the selected avatar clears it.
API reference
avatar_stack(
avatars,
*,
labels=None,
return_index=True,
default=None,
key=None,
bind=None,
on_change=None,
args=(),
kwargs=None,
size=48,
display_max=None,
horizontal_alignment="right",
overlap_avatars=True,
overlap=12,
random_background=True,
)
Required argument
avatars: A non-empty sequence of names, Material icon strings, image URLs, data URIs, or local image paths.
Optional arguments
labels=None: Tooltip labels in the same order asavatars.return_index=True: Return the selected index; when false, return its label.default=None: Initially selected index.key=None: Unique Streamlit component key.bind=None: Use"query-params"for label-based URL binding.on_change=None: Callback invoked when the selection changes.args=(): Positional callback arguments.kwargs=None: Keyword callback arguments.size=48: Avatar diameter in pixels.display_max=None: Maximum visible avatars before the+Ncontrol.horizontal_alignment="right": Align the stack to"left"or"right".overlap_avatars=True: Control whether regular avatars overlap.overlap=12: Overlap distance in pixels.random_background=True: Use varied avatar backgrounds; false uses the theme’s secondary background color.
Avatars wrap automatically. When collapsed, an off-page selection temporarily replaces the final visible avatar and returns to its original position when cleared.
Labels and URL binding
labels = ["Ada", "Engineering", "Grace", "Assistant"]
selected = avatar_stack(
avatars,
labels=labels,
return_index=False,
key="person",
bind="query-params",
)
Query-parameter binding requires unique labels, return_index=False, and a
key. It synchronizes the selected label in both directions.
Demo
uv run streamlit run main.py
The demo loads 25 records from data/avatars.json, including each avatar’s
label, title, and department, and displays the selected record.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_avatar_stack-0.1.0.tar.gz.
File metadata
- Download URL: streamlit_avatar_stack-0.1.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fddb7415fe87a368724084050d3448485aadf6d7d9a7fd5bfe398f7e8cff8aed
|
|
| MD5 |
b3dd0f7282c66a7e3d1e6a0102c23688
|
|
| BLAKE2b-256 |
ff3d25b98d961be3c2fd777fb46bf1799bd5a297d3a37a0f9f7e9e33f812a793
|
File details
Details for the file streamlit_avatar_stack-0.1.0-py3-none-any.whl.
File metadata
- Download URL: streamlit_avatar_stack-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e7010c22d7068c5904e3e277de286f2f27cb623bc5af3fb46dcb43553fa9387
|
|
| MD5 |
3f5c479734571e34c677859ca4b40ccb
|
|
| BLAKE2b-256 |
42fa2ffb5d3e194008717be96ffffe713ae073c572f534ed301523aa36a531fc
|