Skip to main content

streamlit-feedback

A Streamlit component to add user feedback to your apps.

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(feedback_type="thumbs")
feedback

Examples

Here are many examples of how the feedback component can be added to your app. Each function represents a different app.

[!IMPORTANT]
The streamlit_feedback component triggers a page reload when submitted, this is how streamlit components work. The on_submit function is only then run when your app reaches the streamlit-feedback() call on the rerun.

Install

pip install streamlit-feedback

Usage

It can be used with these parameters:

def streamlit_feedback(
    feedback_type,
    optional_text_label=None,
    max_text_length=None,
    review_on_positive=True,
    disable_with_score=None,
    on_submit=None,
    args=(),
    kwargs={},
    align="flex-end",
    key=None,
):
    """Create a new instance of "streamlit_feedback".

    Parameters
    ----------
    feedback_type: str
        The type of feedback; "thumbs" or "faces".
    optional_text_label: str or None
        An optional label to add as a placeholder to the textbox.
        If None, the "thumbs" or "faces" will not be accompanied by textual feedback.
    max_text_length: int or None
        Defaults to None. If set, enables the multi-line functionality and determines the maximum characters the textbox allows. Else, displays the default one-line textbox.
    disable_with_score: str
        An optional score to disable the component. Must be a "thumbs" emoji or a "faces" emoji. Can be used to pass state from one component to another.
    review_on_positive: bool
        Defaults to True. When set to False, it only asks for textual feedback in case of a negative review, i.e., "thumbs down" or less than the happiest "faces" emoji.
    on_submit: callable
        An optional callback invoked when feedback is submitted. This function must accept at least one argument, the feedback response dict,
        allowing you to save the feedback to a database for example. Additional arguments can be specified using `args` and `kwargs`.
    args: tuple
        Additional positional arguments to pass to `on_submit`.
    kwargs: dict
        Additional keyword arguments to pass to `on_submit`.
    align: str
        Where to align the feedback component; "flex-end", "center" or "flex-start".
    key: str or None
        An optional key that uniquely identifies this component. If this is
        None, and the component's arguments are changed, the component will
        be re-mounted in the Streamlit frontend and lose its current state.

    Returns
    -------
    dict
        The user response, with the feedback_type, score and text fields. If on_submit returns a value, this value will be returned by the component.

    """

Here are some more examples:

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(
    feedback_type="thumbs",
    optional_text_label="[Optional] Please provide an explanation",
)
feedback

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(feedback_type="faces")
feedback

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(
    feedback_type="faces",
    optional_text_label="[Optional] Please provide an explanation",
)
feedback

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(feedback_type="thumbs", align="flex-start")
feedback

Contributing

We welcome all contributions. To test & run the streamlit-feedback component locally, you will need to run both the frontend javascript component and the streamlit server.

  1. Run the component frontend
cd streamlit_feedback/frontend && npm run start
  1. Run the server
streamlit run streamlit_feedback/__init__.py

See more details in CONTRIBUTING.md.

Release files for streamlit-feedback 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-feedback 0.1.4
File Size Uploaded
streamlit-feedback-0.1.4.tar.gz 741.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-feedback 0.1.4
File Interpreter ABI Platform
streamlit_feedback-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.4 MB

Release files / streamlit-feedback-0.1.4.tar.gz

Download URL streamlit-feedback-0.1.4.tar.gz
Size 741.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4c34429aaea308cbf902bb353260600ecab6f455bc60faf34b8083492523aa8b
BLAKE2b-256 checksum
How to use checksums
e02f56c1b43a8b5e442248366094699dc74f4fdbcfb84c3b74764562dabb94b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release files / streamlit_feedback-0.1.4-py3-none-any.whl

Download URL streamlit_feedback-0.1.4-py3-none-any.whl
Size 5.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8e760b16ecaf2f7024f277fe6bc94da63e87a132643ecfc462666c4524a3f5b4
BLAKE2b-256 checksum
How to use checksums
5ae467fda9a746aa4d1684dfef7747e9968cc1fb36832cc686dd3276fc4d8bd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page