streamlit_js_eval icon indicating copy to clipboard operation
streamlit_js_eval copied to clipboard

calling streamlit_js_eval creates visible iframe

Open DevDrake opened this issue 2 years ago • 7 comments

when i call : streamlit_js_eval(js_expression='window.innerwidth', key='WIDTH') it creates visible iframe in streamlit app: I understand, it has to create something to get the property, but can it have opacity=0 or just a way to setup css on the component form streamlit app ?

image

DevDrake avatar Feb 12 '24 11:02 DevDrake

Hi. I will try to reproduce this and see. It seems the internals of Streamlit custom components have changed recently.

aghasemi avatar Feb 13 '24 09:02 aghasemi

I also have the same issue with @DevDrake

hoanq1811 avatar Feb 16 '24 08:02 hoanq1811

 <style>
                iframe{
                    display: none
                }

shawngiese avatar Feb 22 '24 23:02 shawngiese

@DevDrake @hoanq1811

I cannot reproduce the issue in streamlit 1.31.1. Can you send an example please?

Anyways, the solution by @shawngiese should work. I don't know about further consequences though. It's like this

st.markdown(f"<style>iframe{display: none}</style>",unsafe_allow_html=True)

aghasemi avatar Feb 29 '24 12:02 aghasemi

how to customize css ,backgroud-color like photo, image

liuhang2 avatar Apr 03 '24 12:04 liuhang2

same question in 1.35.0

ZJCODE avatar Jun 28 '24 06:06 ZJCODE

If all of your jscode doesn't need to display anything and you have other iframes(custom components) you don't want to hide, you can use this to hide just streamlit_js_eval iframes

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

jonn26 avatar Jul 01 '24 18:07 jonn26