Set trigger values for custom button components
See original GitHub issueProblem
As far as I know, it is not possible to set a one-time value using JavaScript Component API.
The only method available is Streamlit.setComponentValue()
.
Thus, it is not possible to implement custom buttons easily.
Solution
In native widgets, setting a one-time value is done with setTriggerValue. It’d be great to have this function for components.
Additional context
This issue was already discussed here: https://discuss.streamlit.io/t/button-using-custom-component/7536. In this topic, I’ve provided a temporary solution which triggers two reruns after a button click.
Another temporary solution would be to rely on query parameters. But I haven’t tested this yet.
Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.
If you’d like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top GitHub Comments
Another temporary solution using
st.session_state
:Pushing this one up. I just got in the same situation of @andfanilo and @okld. Needed to implemnt a custom button like component and no other way besides setComponentValue and block component return in python.