Column width in `st.dataframe` not properly calculated for long text columns
Author: marfelCreated Sep 17, 2026Updated Sep 17, 2026
Labelstype:enhancementarea:frontendfeature:st.dataframe
Checklist
- I have searched the existing issues for similar issues.
- I added a very descriptive title to this issue.
- I have provided sufficient information below to help reproduce this issue.
Summary
In a simple dataframe with a long and a short text column, the long column is getting cropped while there is still enough whitespace behind the strings in the short column to manually adjust column width, such that everything fits. Do try varying the browser window size. I suspect it may have something to do with how the length of a proportional font string is estimated?
Reproducible Code Example
import pandas as pd
import streamlit as st
st.set_page_config(
layout="wide",
)
st.sidebar.markdown("# Title")
df = pd.DataFrame(
{
"Short text": [
"Lorem ipsum",
"Dolor sit amet",
"Consectetur adipiscing elit",
],
"Long text (~140 chars)": [
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla ullamco laboris nisi pariatur.",
],
}
)
st.dataframe(df, width="stretch")
Steps To Reproduce
No response
Expected Behavior
No response
Current Behavior
No response
Is this a regression?
- Yes, this used to work in a previous version.
Debug info
- Streamlit version:
- Python version:
- Operating System:
- Browser:
Additional Information
No response
Source: streamlit/streamlit