Hi every1,
I’m building a local Streamlit app that reads a PDF and displays the extracted transactions in a st.data_editor table. The core issue is column width management: the table renders with column widths that are not acceptable for usability.
When I open the column menu (three dots) and click Autosize for a column, it correctly adjusts the width to fit the column’s content. However, I can’t find a way to:
-
trigger Autosize automatically on load, or
-
trigger Autosize via a custom button (e.g., “Autosize all columns”), or
-
access the underlying autosize logic through Python.
Questions:
-
Does Streamlit expose any API for column autosizing (fit-to-content) in
st.data_editor/st.dataframe? -
Is there a documented minimum/maximum width behavior or layout rule that prevents small pixel widths from taking effect?
-
If there is no direct API, what’s the recommended workaround to get consistent fit-to-content widths (e.g., using
width=None, forcing horizontal scroll, or any official component approach)?
I’m happy to share a minimal reproducible example if needed.
Thanks in advance.