Open JosephMarinier opened 1 week ago
I would like to have the option st.table(df, use_container_width=False).
st.table(df, use_container_width=False)
I appreciate the use_container_width=False in st.dataframe() and I would like to have the option in st.table().
use_container_width=False
st.dataframe()
st.table()
No response
In the meantime, here is a workaround:
import pandas as pd import streamlit as st st.html(""" <style> div[data-testid="stElementContainer"]:nth-child(4) > div[data-testid="stTable"] { max-width: fit-content; } </style> """) df = pd.DataFrame({"x": [0.1, 0.2, 0.3], "y": [0.4, 0.5, 0.6]}) st.code("st.table()") st.table(df) st.table(df) # Equivalent of use_container_width=False done with the CSS above. st.divider() st.code("st.dataframe()") st.dataframe(df) st.dataframe(df, use_container_width=False)
To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.
Your vote helps us identify which enhancements matter most to our users.
Checklist
Summary
I would like to have the option
st.table(df, use_container_width=False)
.Why?
I appreciate the
use_container_width=False
inst.dataframe()
and I would like to have the option inst.table()
.How?
No response
Additional Context
In the meantime, here is a workaround: