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

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.