{"id":24663,"library":"streamlit-plotly-events","title":"streamlit-plotly-events","description":"A Streamlit component that wraps Plotly charts and enables capturing events (e.g., click, hover, select) from the chart and passing them back to Streamlit for reactive updates. Version 0.0.6 requires Python >=3.6, currently in early/experimental stage with infrequent releases.","status":"active","version":"0.0.6","language":"python","source_language":"en","source_url":"https://github.com/null-jones/streamlit-plotly-events","tags":["streamlit","plotly","events","interactive","component"],"install":[{"cmd":"pip install streamlit-plotly-events","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"Function name is 'plotly_chart', not 'plotly_events'. Many users mistakenly copy the module name.","wrong":"from streamlit_plotly_events import plotly_events","symbol":"plotly_chart","correct":"from streamlit_plotly_events import plotly_chart"}],"quickstart":{"code":"import streamlit as st\nimport plotly.graph_objects as go\nfrom streamlit_plotly_events import plotly_chart\n\nfig = go.Figure(data=[go.Scatter(x=[1,2,3], y=[4,5,6], mode='markers')])\nselected_points = plotly_chart(fig, click_event=True, hover_event=False, select_event=False)\nif selected_points:\n    st.write(selected_points)","lang":"python","description":"Minimal example: render a scatter plot and capture click events. Returns list of dicts with point and curve info."},"warnings":[{"fix":"Always use keyword arguments: plotly_chart(fig, click_event=True)","message":"Event arguments (click_event, hover_event, select_event) must be passed as keyword arguments; they are not positional.","severity":"gotcha","affected_versions":"all"},{"fix":"if selected_points: st.write(selected_points) to avoid AttributeError","message":"The component returns None when no event has occurred. Always check for None before iterating.","severity":"gotcha","affected_versions":"all"},{"fix":"Stick to simple, single-trace figures. Test thoroughly.","message":"The library does not support all Plotly chart types; complex layouts or subplots may cause silent failures or errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace 'import streamlit_plotly_events' (with hyphens) with 'from streamlit_plotly_events import plotly_chart'.","message":"Version 0.0.5 removed the old 'streamlit-plotly-events' import path; use 'streamlit_plotly_events' (underscore).","severity":"breaking","affected_versions":">=0.0.5"},{"fix":"Use click_event, hover_event, select_event instead.","message":"The 'start_event' and 'end_event' parameters were deprecated in 0.0.4 and removed in 0.0.5.","severity":"deprecated","affected_versions":">=0.0.5"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install streamlit-plotly-events' and use import 'from streamlit_plotly_events import plotly_chart'.","cause":"Library not installed or installed incorrectly (e.g., hyphens in name).","error":"ModuleNotFoundError: No module named 'streamlit_plotly_events'"},{"fix":"Always use keyword arguments: plotly_chart(fig, click_event=True)","cause":"Passing click_event as positional argument instead of keyword.","error":"TypeError: plotly_chart() got multiple values for argument 'click_event'"},{"fix":"Check for None: if selected_points: ...","cause":"Trying to iterate over None when no event has occurred.","error":"AttributeError: 'NoneType' object has no attribute 'append' (or similar)"},{"fix":"Use the correct parameters: click_event, hover_event, select_event.","cause":"Incorrect event parameter name (e.g., 'on_click' instead of 'click_event').","error":"streamlit.runtime.scriptrunner.script_runner.ScriptRunnerException"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}