{"id":9342,"library":"streamlit-feedback","title":"Streamlit Feedback Component","description":"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.","status":"active","version":"0.1.4","language":"en","source_language":"en","source_url":"https://github.com/Chocrates/streamlit-feedback","tags":["streamlit","feedback","ui-component","data-collection","user-experience"],"install":[{"cmd":"pip install streamlit-feedback","lang":"bash","label":"Install library"}],"dependencies":[{"reason":"This library is a component designed to run exclusively within a Streamlit application and requires Streamlit as its core framework dependency. Version >=1.20.0 is typically required.","package":"streamlit","optional":false}],"imports":[{"symbol":"st_feedback","correct":"from streamlit_feedback import st_feedback"}],"quickstart":{"code":"import streamlit as st\nfrom streamlit_feedback import st_feedback\n\nst.set_page_config(layout=\"wide\")\n\nst.header(\"User Feedback Example\")\n\n# Basic thumbs up/down feedback\nfeedback_thumbs = st_feedback(\n    feedback_type=\"thumbs\",\n    optional_text_label=\"Tell us more (optional):\"\n)\n\nif feedback_thumbs:\n    st.success(f\"Thumbs Feedback received: {feedback_thumbs}\")\n    # In a real application, you would store this feedback (e.g., to a database).\nelse:\n    st.info(\"Please provide your thumbs feedback.\")\n\nst.markdown(\"--- \")\n\n# Faces feedback with a custom key\nst.subheader(\"Rate your experience\")\nfeedback_faces = st_feedback(\n    feedback_type=\"faces\",\n    feedback_options=[\"😀 Excellent\", \"🙂 Good\", \"😐 Neutral\", \"🙁 Poor\", \"😞 Very Poor\"],\n    key=\"experience_feedback\" # Unique key is crucial for multiple widgets\n)\n\nif feedback_faces:\n    st.success(f\"Faces Feedback received: {feedback_faces}\")\nelse:\n    st.info(\"Please rate your experience.\")\n\nst.caption(\"To run this app, save it as `app.py` and execute: `streamlit run app.py`\")\n","lang":"python","description":"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`."},"warnings":[{"fix":"Always launch your application using the `streamlit run` command.","message":"The `st_feedback` component must be executed within a Streamlit application (`streamlit run your_app.py`). Running the script as a standalone Python file will not display the UI component and may result in errors related to missing Streamlit context.","severity":"gotcha","affected_versions":"All"},{"fix":"Provide a unique string for the `key` parameter for every `st_feedback` call, e.g., `st_feedback(..., key='unique_id_1')`.","message":"When using `st_feedback` multiple times on the same Streamlit page, each instance *must* be assigned a unique `key` parameter. Failing to do so will cause a `StreamlitAPIException` due to key conflicts.","severity":"gotcha","affected_versions":"All"},{"fix":"Always check `feedback_result['feedback_type']` before trying to access `feedback_result['score']` or `feedback_result['text']` to ensure correct data parsing, as not all fields are present for all types.","message":"The structure of the dictionary returned by `st_feedback` when feedback is submitted varies based on the `feedback_type` (e.g., 'thumbs', 'faces', 'text'). Developers must inspect the `feedback_type` field and conditionally access fields like `score` or `text`.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Assign a unique string to the `key` parameter for each `st_feedback` call, e.g., `st_feedback(..., key=\"feedback_section_1\")`.","cause":"You have multiple `st_feedback` components (or other Streamlit widgets) on the same page without unique `key` arguments, causing a conflict.","error":"streamlit.errors.StreamlitAPIException: st.text_input() was called with a key='...' that is already in use. Each widget must have a unique key."},{"fix":"Install the library using pip: `pip install streamlit-feedback`.","cause":"The `streamlit-feedback` library is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'streamlit_feedback'"},{"fix":"Ensure your script is launched with `streamlit run your_script_name.py`. Verify that the `st_feedback` call is executed unconditionally, or that its conditional logic is met. Check the terminal for any Python or Streamlit-specific errors that might be preventing rendering.","cause":"This often occurs if the Streamlit app is not being run correctly, if the component call is inside an un-met conditional block, or if there's an earlier error preventing rendering. It also might not appear until a certain interaction happens.","error":"My feedback component doesn't appear in my Streamlit app when I run it."}]}