Skip to content

Streamlit component to execute javascript code on the client side and get back the result

License

Notifications You must be signed in to change notification settings

thunderbug1/streamlit-javascript

Repository files navigation

Streamlit javascript execution

GitHub PyPI

Installation

pip install streamlit-javascript

Getting started

from streamlit_javascript import st_javascript

st.subheader("Javascript API call")

return_value = st_javascript("""await fetch("https://reqres.in/api/products/3").then(function(response) {
    return response.json();
}) """)

st.markdown(f"Return value was: {return_value}")
print(f"Return value was: {return_value}")

Demo

example image

About

Streamlit component to execute javascript code on the client side and get back the result

Topics

Resources

License

Stars

Watchers

Forks