Wrap text columns in dataframe/data editor

While I have width option for text columns, does it have capability to wrap text such that users can see full text in the same width?

st.data_editor(df,
                column_config={
                      'col1':st.column_config.TextColumn(
                      "Column_name",
                         width=350))
2 Likes

Hi @Himanshu_Gupta

The width parameter for st.column_config.TextColumn accepts ”small”, ”medium” and ”large” as argument values. (See the Docs page for more details st.column_config.TextColumn - Streamlit Docs)

As for text wrapping in columns, can you see this relevant forum post for more details:

Hope this helps!

1 Like

width parameter changes the width and doesn’t wrap the text in a readable format.
this post is suggesting to use st.table, which doesn’t have column config.
I have multiple columns, one is long text and other is a score, where i use ProgressColumn, renaming, tooltip, etc

Is there a better way to do this using st.dataframe and column_config instead. Like using some python wrap function on text columns before passing to streamlit st.dataframe?

st.dataframe(df[['query_summary','sim_score']],
     column_config={
         'query_summary':st.column_config.TextColumn("Summary", width="medium", help="Natural Language Question relevant to entered question"),
         'sim_score':st.column_config.ProgressColumn("Score", width=90, format="%.2f%%",min_value=0,max_value=100, help="Similarity score"),
                 })
1 Like

I’d also like to be able to wrap text using st.dataframe :smiley:
Did anyone find a way to do this?

3 Likes

I’d also like to be able to wrap text in column names.

1 Like