thunderbug1 / streamlit-javascript

Streamlit component to execute javascript code on the client side and get back the result
MIT License
111 stars 3 forks source link

added whitespace when st_javascript is being called #11

Open vincent-larisma opened 1 year ago

vincent-larisma commented 1 year ago

how do I fix this issue when my streamlit web app runs and the streamlit_javascript code runs in the background gives me white space i.e. it gives additional space when called. I use streamlit_javascript for local storage

binste commented 1 year ago

For me the following worked:

st.markdown(
"""
<style>
    .element-container:has(
        iframe[title="streamlit_javascript.streamlit_javascript"]
    ) {
        display: none
    }
</style>
""",
    unsafe_allow_html=True,
)

It selects all ._element-container which have an iframe child with a title attribute set to "streamlit_javascript.streamlit_javascript". I don't know how well this works with older browsers and how reliable the title attribute is but hope it helps.