Mohamed-512 / Extra-Streamlit-Components

An all in one place, to find complex or just not available components by default on streamlit.
Apache License 2.0
466 stars 59 forks source link

Extra vertical space when creating new cookie_manager #62

Closed Takher closed 6 months ago

Takher commented 7 months ago

When running this code

import streamlit as st
import extra_streamlit_components as stx

st.write("# Cookie Manager Example")

@st.cache_resource(experimental_allow_widgets=True)
def get_manager():
    return stx.CookieManager()

st.write("Start get manager")
cookie_manager = get_manager()
st.write("done it")

I find that there is an extra vertical space:

image

However, if I remove the experimental_allow_widgets=True option, I get this issue

image

Python 3.9.18 Streamlit, version 1.29.0 extra-streamlit-components 0.1.60

hl5biw commented 6 months ago

I also have same issue.

NathanChen198 commented 6 months ago

I am having the same issue.

lambda-science commented 6 months ago

Same issue, please fix it's horrible

lambda-science commented 6 months ago

@hl5biw @NathanChen198 @Takher Maybe you found a work-around ? :) @Mohamed-512

NathanChen198 commented 6 months ago

Manage to resolve it using css


def RemoveEmptyElementContainer():
    st.markdown(
        f""" 
            <style>
                .element-container:has(iframe[height="0"]) {{ display: none; }}
            </style>
        """, unsafe_allow_html=True
    )
lambda-science commented 6 months ago

Manage to resolve it using css

def RemoveEmptyElementContainer():
    st.markdown(
        f""" 
            <style>
                .element-container:has(iframe[height="0"]) {{ display: none; }}
            </style>
        """, unsafe_allow_html=True
    )

You just saved me, thank you very much !

Mohamed-512 commented 6 months ago

Hey all, thanks for bringing it to my attention, and thanks @NathanChen198 for the fix. I have added it in a new version of the package 0.1.71.