Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling streamlit_js_eval creates visible iframe #4

Open
DevDrake opened this issue Feb 12, 2024 · 7 comments
Open

calling streamlit_js_eval creates visible iframe #4

DevDrake opened this issue Feb 12, 2024 · 7 comments

Comments

@DevDrake
Copy link

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

@aghasemi
Copy link
Owner

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

@hoanq1811
Copy link

I also have the same issue with @DevDrake

@shawngiese
Copy link

shawngiese commented Feb 22, 2024

 <style>
                iframe{
                    display: none
                }

@aghasemi
Copy link
Owner

@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)

@liuhang2
Copy link

liuhang2 commented Apr 3, 2024

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

@ZJCODE
Copy link

ZJCODE commented Jun 28, 2024

same question in 1.35.0

@jonn26
Copy link

jonn26 commented Jul 1, 2024

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,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants