How to the whiltespace of text element to pre-wrap

Summary

The default value of whitespace of st.text is pre in this file.

I want to set this value to pre-wrap. However, I donโ€™t find anywhere in the installed python package to modify this value.

How can I achieve this? Thanks for any help!

Hi @llan-ml

I see 2 possible approaches for this as the current st.text does not have a parameter that can be set to specify the use of pre-wrap.

  1. Create a custom component (more info on how to do this which also supports the use of Typescript is described in this blog How to build your own Streamlit component)
  2. Customize the CSS styling of the rendered st.text in order to mimic the desired visual display (further info on how to do this in this recent post that I wrote Buttons on top of the chat input - #2 by dataprofessor)

Hope this helps!

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