st-user-info-panel
A polished Streamlit custom component for a floating User Info Panel anchored to the sidebar.
Supports fixed float stick in sidebar, collapsed chip (avatar initials) when the sidebar is collapsed, and usage stats (messages, tokens, cost).
✨ Features
- Floating panel that follows the sidebar width (portal) or sticky at the bottom of the sidebar (inside).
- Collapsed chip: when the sidebar collapses, a small circular chip with initials appears;
- Stats: Messages, Tokens, Cost with optional progress bars if monthly limits are set.
- Compact mode for tighter sidebars.
- Optional fields: Department, Work Location.
- Uncontrolled (default) or Controlled expansion state.
- Robust geometry handling for scrollable sidebars and animated collapse/expand.
📦 Install
Note: Starting from version
0.1.1, the minimum required Python version has been lowered to>=3.10(previously>=3.11), providing broader compatibility!
pip install st-user-info-panel
Import name:
from st_user_info_panel import st_user_info_panel
🚀 Quickstart
import streamlit as st
from st_user_info_panel import st_user_info_panel
st.set_page_config(page_title="AI Chat Assistant Demo", layout="wide", initial_sidebar_state="expanded")
if "user_panel_expanded" not in st.session_state:
st.session_state.user_panel_expanded = False
with st.sidebar:
st.title("🤖 AI Assistant")
st.subheader("Recent Conversations")
for i in range(20):
st.markdown(f"• Chat {i+1}")
st.markdown("---")
st.subheader("Settings")
st.selectbox("Model", ["GPT-4", "Claude", "Gemini"])
st.slider("Temperature", 0.0, 2.0, 0.7)
result = st_user_info_panel(
name="Sarah Johnson",
job_title="Senior Data Scientist",
email="sarah.johnson@techcorp.com",
department="Data Platform",
work_location="Jakarta",
messages_count=340, monthly_messages_limit=500,
tokens_this_month=3_200_000, monthly_tokens_limit=10_000_000,
cost_usd=42.35, monthly_cost_limit=200.0,
show_detailed_stats=True,
compact=True,
stats_style="rows",
show_progress=False,
side_padding_px=12,
bottom_offset_px=16,
controlled=False,
expanded=st.session_state.user_panel_expanded,
key="user-panel",
)
if result:
evt = result.get("event")
if evt == "toggle":
st.session_state.user_panel_expanded = result["expanded"]
elif evt == "logout":
st.session_state.user_panel_expanded = False
st.warning("Logout clicked")
elif evt == "chip":
pass
⚙️ API
st_user_info_panel(...) -> dict | None
Identity
| Prop | Type | Default | Notes |
|---|---|---|---|
name |
str |
"John Doe" |
Used for initials |
job_title |
str |
"Data Scientist" |
|
email |
str |
"john.doe@company.com" |
Wraps for long values |
avatar_color |
str |
"#FE5556" |
Any CSS color |
department |
Optional[str] |
None |
Optional |
work_location |
Optional[str] |
None |
Optional |
Stats (neutral)
| Prop | Type | Default | Notes |
|---|---|---|---|
messages_count |
int |
0 |
|
monthly_messages_limit |
int |
0 |
0 = unlimited |
tokens_this_month |
int |
0 |
|
monthly_tokens_limit |
int |
0 |
0 = unlimited |
cost_usd |
float |
0.0 |
|
monthly_cost_limit |
float |
0.0 |
0 = unlimited |
show_detailed_stats |
bool |
True |
|
show_progress |
bool |
True |
Layout & Behavior
| Prop | Type | Default | Notes |
|---|---|---|---|
info_grid_columns |
str |
"110px 1fr" |
Grid ratio for info card (e.g., "30% 70%" or "1fr 2fr") |
color_mode |
Literal["auto","light","dark"] |
"auto" |
Force light/dark theme, or auto-detect Streamlit theme |
side_padding_px |
int |
12 |
|
bottom_offset_px |
int |
16 |
|
border_radius_px |
int |
12 |
|
compact |
bool |
False |
|
stats_style |
Literal["rows","cards"] |
"rows" |
rows is compact |
logout_label |
str |
"Logout" |
Text label for the logout button |
logout_icon |
Optional[str] |
"🚪" |
Icon for logout button. Supports :material/icon_name: |
logout_color |
Optional[str] |
None |
Custom button color. Defaults to Streamlit theme color |
logout_text_size |
str |
"14px" |
Text size for the logout button |
State control
| Prop | Type | Default | Notes |
|---|---|---|---|
controlled |
bool |
False |
If True, follows expanded prop |
expanded |
bool |
False |
|
key |
Optional[str] |
None |
Stable key recommended |
Return (events)
{
"event": "toggle" | "logout" | "chip",
"expanded": bool,
}
Metadata
Release files for st-user-info-panel 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| st_user_info_panel-0.1.6.tar.gz | 15.2 kB | With provenance | Details for st_user_info_panel-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| st_user_info_panel-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for st_user_info_panel-0.1.6-py3-none-any.whl |
Total release size: 30.9 kB
Release files / st_user_info_panel-0.1.6.tar.gz
| Download URL | st_user_info_panel-0.1.6.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8eda756fd4f0624e05b54d4d27737da327c0329ad695bb3fc3304f6ee624a835
|
|
BLAKE2b-256 checksum How to use checksums |
32958ce8f14fd7584a2ccf89dd35dd91859935a3e37e51e2f78fe46e1b7eae1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logRelease files / st_user_info_panel-0.1.6-py3-none-any.whl
| Download URL | st_user_info_panel-0.1.6-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66c03365b50e589ba9e7f1caf0fccd507f4f57e8f706fc56bd9586055531f0fa
|
|
BLAKE2b-256 checksum How to use checksums |
9d0fe6d55d0d79b2450614f4160c9f3ce24edca2eabea3ca95fd0d67a304e897
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logSecurity for st-user-info-panel 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for st_user_info_panel-0.1.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.