Streamlit Feedback Component

0.1.4 ยท active ยท verified Thu Apr 16

Streamlit-feedback is a Streamlit component that allows developers to easily collect structured or free-form user feedback, such as thumbs up/down, emoji faces, or text comments, directly within their Streamlit applications. It is currently at version 0.1.4 and receives updates for compatibility with new Streamlit versions and feature enhancements, maintaining an active development status.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to integrate `streamlit-feedback` into a basic Streamlit application. It shows both 'thumbs' and 'faces' feedback types, including how to handle the returned feedback and the essential use of the `key` parameter for multiple components. The app must be run using `streamlit run`.

import streamlit as st
from streamlit_feedback import st_feedback

st.set_page_config(layout="wide")

st.header("User Feedback Example")

# Basic thumbs up/down feedback
feedback_thumbs = st_feedback(
    feedback_type="thumbs",
    optional_text_label="Tell us more (optional):"
)

if feedback_thumbs:
    st.success(f"Thumbs Feedback received: {feedback_thumbs}")
    # In a real application, you would store this feedback (e.g., to a database).
else:
    st.info("Please provide your thumbs feedback.")

st.markdown("--- ")

# Faces feedback with a custom key
st.subheader("Rate your experience")
feedback_faces = st_feedback(
    feedback_type="faces",
    feedback_options=["๐Ÿ˜€ Excellent", "๐Ÿ™‚ Good", "๐Ÿ˜ Neutral", "๐Ÿ™ Poor", "๐Ÿ˜ž Very Poor"],
    key="experience_feedback" # Unique key is crucial for multiple widgets
)

if feedback_faces:
    st.success(f"Faces Feedback received: {feedback_faces}")
else:
    st.info("Please rate your experience.")

st.caption("To run this app, save it as `app.py` and execute: `streamlit run app.py`")

view raw JSON โ†’