streamlit / streamlit

Streamlit — A faster way to build and share data apps.
https://streamlit.io
Apache License 2.0
35.68k stars 3.09k forks source link

Collapsible header #2056

Open karriebear opened 4 years ago

karriebear commented 4 years ago

Right now expander only displays the header as a text field. It would be nice to do this with st.header or st.subheader.

Proposal 1

Perhaps a configuration for header type, i.e. st.expander("header", header_type="header|subheader|text(default)", expanded=True)

Proposal 2

Support markup with header text so that # header will display as a header and so on. This could open up too many possibilities

Source


Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.

If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.

anuplotter commented 2 years ago

Is formatting available in the expander button currently? Or has this not been prioritized?

saedx1 commented 2 years ago

A simple trick for now:

st.markdown(
    """
<style>
.streamlit-expanderHeader {
    font-size: x-large;
}
</style>
""",
    unsafe_allow_html=True,
)
abclution commented 1 year ago

Hi, new here to Streamlit, did encounter this limitation as well.

Found some odd undefined behavior as well.

Using markdown for headers #, ## , ### etc in the st.sidebar.expander in the title act odd.

ex with st.sidebar.expander("# Unchanged Title Size"): with st.sidebar.expander("#### Larger Title Size"):

It ignores all H1-H3 options, but seems to accept H4 (####) which should make the text smaller but in fact makes it larger (and happens to be suitably large for my case.) ;)