How to remove st.expander border

Team,

I have used below trick to remove borders of st.expander. It seems like this trick is not working any more. Is there another way to remove the borders in expander?

import streamlit as st

hide_expander_border = """
<style>
.st-bd {border-style: none;}
</style>
"""

if st.checkbox("Remove expander border"):
    st.markdown(hide_expander_border, unsafe_allow_html=True)

with st.expander("Click to expand"):
    st.header("Test")

Try selecting the details tag

hide_expander_border = """
<style>
[data-testid="stExpander"] details {
    border-style: none;
    }
</style>
"""
1 Like

hey hi ! it seem you need to use custom html css in this case this may work

st.markdown(
    <style>
        .streamlit-expander {
            border: none;
            box-shadow: none;
        }

        .streamlit-expanderHeader {
            border-bottom: none;
        }

        .streamlit-expanderClosed .streamlit-expanderHeader,
        .streamlit-expanderClosed .streamlit-expanderContent {
            border: none;
        }
    </style>
    unsafe_allow_html=True
)

this worked thank you!