streamlit / streamlit

Streamlit — A faster way to build and share data apps.

Home Page:https://streamlit.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `height` and `key` to `st.columns`

iscoyd opened this issue · comments

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

It would be great if the features of st.columns() and st.container() could be combined in a single API call, say st.columns(). For example, if one wants to create two scrollable fixed-height side-by-side columns one has to first instantiate two columns with cols = st.columns(2), and then create a st.container() within each column for a specified fixed height.

Why?

Presently, st.columns() allows one to create multiple columns side by side, but one can neither make them fixed height scrollable. And with st.container(), one can make the container fixed height & scrollable, but there is no way to place containers side by side. This is frustrating when writing code since one has to remember these two types of behavior for the two functions when they could easily be rolled into a single function.

How?

The present st.columns() API call is:
st.columns(spec, *, gap="small", vertical_alignment="top", border=False)

and the st.container() API call is:
st.container(*, height=None, border=None, key=None)

Simply add to st.columns() three of the parameters of st.container(), namely height, border and key. If you can do this this, there will be no need for st.container(), which will make it far easier for programmers.

Additional Context

No response

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.

Visits

FYI we just added a border parameter to st.columns in 1.41. It's possible we'll also add the height parameter at some point but I'll probably wait with that since we want to do a more general pass at layout features early next year.

I'll update the title of this issue to make it a bit more explicit.

commented

Thank you, that will help greatly!