Skip to main content

A floating chat bubble component for Streamlit apps

Project description

Streamlit Bubble Chat

Floating chat bubble UI for Streamlit apps.
Add a persistent chat window with unread badges, system messages, and optional agent avatars.

CI Python 3.10+ Streamlit component uv build backend License: MIT

Source · Contributing

Bubble chat demo

streamlit-bubble-chat is a drop-in component for adding a floating chat window to a Streamlit app. It works well for support flows, assistant side panels, and multi-agent demos where you want the chat UI available without rearranging the rest of the page.

Installation

uv add streamlit-bubble-chat

Or with pip:

pip install streamlit-bubble-chat

Quick start

import streamlit as st

from streamlit_bubble_chat import bubble_chat


if "messages" not in st.session_state:
    st.session_state.messages = [
        {"role": "assistant", "content": "Hello. How can I help?"},
    ]


def handle_message() -> None:
    text = st.session_state.support_chat.new_message
    if not text:
        return

    st.session_state.messages.append({"role": "user", "content": text})
    st.session_state.messages.append(
        {"role": "assistant", "content": f"Echo: {text}"}
    )


bubble_chat(
    messages=st.session_state.messages,
    key="support_chat",
    on_message=handle_message,
)

Core arguments

bubble_chat(
    messages,
    *,
    type="simple",
    unread_count=0,
    window_title="Chat",
    theme_color=None,
    assistant_config=None,
    name_colors=None,
    key=None,
    on_message=None,
)

Each message is a dictionary with role, content, and an optional name:

{"role": "assistant", "content": "Hello", "name": "Guide"}

Inside on_message, read the submitted text from st.session_state[key].new_message. The component also stores is_open and is_maximized in the same session-state entry.

All color parameters (theme_color, user_icon_bg, values in assistant_config and name_colors) must be #RRGGBB hex strings — invalid values raise ValueError.

Documentation

  • API Reference — full parameter docs, message schema, assistant config, limitations.
  • Architecture — design decisions, state sync, frontend modules.
  • Customization — theming, avatars, colors, dark mode, CSS classes.

What you get

  • Floating chat bubble anchored to the bottom-right corner.
  • simple mode for a clean message list.
  • avatar mode for named assistants with emoji or :material/...: icons.
  • Unread badges and an unread divider when new messages arrive.
  • System messages rendered as centered pills.
  • Theme-aware styling plus optional color overrides.
  • User and assistant avatar customization.

Examples

Example What it shows Command
examples/base_chat.py Simple mode, unread badges, system messages, name colors uv run streamlit run examples/base_chat.py
examples/avatar_chat.py Avatar mode, multiple assistants, Material icons, custom avatar colors uv run streamlit run examples/avatar_chat.py

If you need fresh frontend assets first:

make build-frontend

Limitations

  • Single instance per page — only one bubble_chat() per Streamlit page. Multiple calls share the same DOM.
  • Text only — message content is plain text. No markdown, HTML, or media rendering.
  • Material Icons need internet:material/…: icons load from Google Fonts CDN. Emoji icons work offline.

Development

make setup
make check
make test
make build

make setup installs Python dependencies with uv, frontend dependencies with npm ci, and the configured git hooks with prek.

Contributing

Contribution guidelines live in CONTRIBUTING.md.

Disclaimer

This project was built primarily with AI assistance. If you spot artifacts, inconsistencies, or things that don't make sense, please open an issue.

License

Released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_bubble_chat-0.1.4.tar.gz (22.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_bubble_chat-0.1.4-py3-none-any.whl (22.5 MB view details)

Uploaded Python 3

File details

Details for the file streamlit_bubble_chat-0.1.4.tar.gz.

File metadata

  • Download URL: streamlit_bubble_chat-0.1.4.tar.gz
  • Upload date:
  • Size: 22.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for streamlit_bubble_chat-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2c50fa0c269032a3fd869fb43fba29c7130752f037167540bd444dbbdda094ab
MD5 f9952a8045932a98808a0013c4ca0ce9
BLAKE2b-256 7cba2367989c2f3667598a9507c3cae94d1142fca4d944f57f97c2ef52fd3de6

See more details on using hashes here.

Provenance

The following attestation bundles were made for streamlit_bubble_chat-0.1.4.tar.gz:

Publisher: release.yml on igonro/streamlit-bubble-chat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file streamlit_bubble_chat-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_bubble_chat-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 000263dd98ecfba8bc2c2c8ff5f9eec75c2edb534da367ab21b9da94277eee00
MD5 02500d8426a7d3906b8f0b6398ee5c5d
BLAKE2b-256 91d3b6834d1b13061a9ec883b8aa6a0c138ebed1c3bb49b070888a7fc1dca44e

See more details on using hashes here.

Provenance

The following attestation bundles were made for streamlit_bubble_chat-0.1.4-py3-none-any.whl:

Publisher: release.yml on igonro/streamlit-bubble-chat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page