question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow columns inside columns

See original GitHub issue

Problem

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:


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:open
  • Created a year ago
  • Reactions:26
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
joy13975commented, Oct 11, 2022

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.

1reaction
steve7734commented, Nov 19, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found