Allow columns inside columns
See original GitHub issueProblem
There’s no way to use st.columns
inside st.columns
right now.
E.g. if you do:
col1, col2 = st.columns(2)
with col1:
subcol1, subcol2 = st.columns(2)
it throws an exception.
Note that this is just an aritificial limitation today. There’s nothing technically preventing columns inside columns. We just limited this to prevent users from creating weird layouts and having them do any kind of layout with columns (just like HTML tables were used in the distant past).
Solution
- Option 1: Just allow columns inside columns. Maybe restrict to one level of nesting and disallow it in the sidebar.
- Option 2: Find another way to create complex layouts, e.g.
st.grid
.
Additional context
See #5266, where this was proposed by @ZeroCool940711.
Some forum posts mentioning this:
- https://discuss.streamlit.io/t/columns-in-a-column/21978/5
- https://discuss.streamlit.io/t/need-help-with-layout-columns-within-columns/12912
- https://discuss.streamlit.io/t/create-nested-columns/18807
- https://discuss.streamlit.io/t/is-there-any-possibility-to-use-st-beta-column-in-st-beta-column/11050
- https://discuss.streamlit.io/t/new-layout-columns/6280
- https://discuss.streamlit.io/t/specific-layout-without-nested-columns/22861
- https://discuss.streamlit.io/t/column-layout/28937
- https://discuss.streamlit.io/t/how-to-create-layout-merge-two-columns-into-one/26359
- https://discuss.streamlit.io/t/support-for-nested-columns/28810
Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.
If you’d like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.
Issue Analytics
- State:
- Created a year ago
- Reactions:26
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Create nested columns
how to create columns inside columns ? col1_repl, ... i want to create a form that allow user to change the values of...
Read more >Add columns to a Word document
On the Page Layout tab, click Columns, then click More Columns. Click Selected text from the Apply to box. Word 2016. You can...
Read more >creating nested columns in Notion
You won't be able to create a layout like this just by dragging and dropping blocks. Notion won't let you create the nested...
Read more >Create Nested Columns (and Columns in Toggles) in Notion
In this video, you'll learn how to create nested columns in Notion. You'll also learn how to create multiple columns inside toggle blocks, ......
Read more >Using and formatting columns in Microsoft Word
Click on More Columns, and you're taken to a dialog box that allows you to set up your columns exactly the way you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For those who want it anyway despite being intentionally disabled by design:
https://github.com/joy13975/streamlit-nested-layout
If you encounter issues there, please don’t bring them over to the official community.
Its an easy trap to fall into. step 1) Write some software that allows people to build what they want step 2) Limit the software so they can’t build what they want
One advantage of not limiting stuff, is that you’ll be constantly amazed by the weird and wonderful things people come up with that you didn’t intend! Some of it will indeed be terrible but so what? I can always design terrible stuff, it doesn’t matter what tools you give me or don’t give me, there’s no end to my ingenuity 😄
We are using Streamlit to implement a complex site that contains elements of analytics , project management, CRM and field work applications, its amazing what we’ve been able to do very quickly! Nested columns would be awesome. Give me those nested columns.