Modifying the font size of a st.expander label

How can I modify the font size of a st.expander label?

expander = st.expander(label="Targets: ", expanded=True)
with expander:
     st.markdown("""

Hi @doug2023 , see if you can use the logic from here for your purpose:

Cheers

1 Like

Would be the var htmlstr used for change the st.expander label font size? I’m sorry but I don’t understand!

JS code is created and stored in the htmlstr variable. It is then fed into components.html to be run.

The JS code iterates through the document elements to search for the one which has the label that matches the text you pass as a function parameter, and then changes its font size.

Hope this is understandable.

Cheers

Blockquote

1 Like

Amazing!!! It really worked!

I don’t want to abuse your generosity, but is this script used to change the size of the wigdet, in this case the expander or something similar? And I’m new coding. I’ve been learning and testing. And I really liked Streamlit for show data analysis.

Hi @doug2023,

For most widgets, the above code could work. For others, you could try the logic from one of my previous responses:

Give it a shot and try and figure it out - that’s how I learnt.

Cheers

1 Like