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.

Deactivate responsiveness of st.columns

See original GitHub issue

Hi, I’m using st.columns on st.form.

In mine desktop the widgets align. But in the mobile version not.

I did some tests here and discovered that in the mobile version the app don’t create the columns. Here are the app link and the app repo

Desktop version:

image

Mobile version: image

The code:

import streamlit as st
with st.form("Test"):
    col1, col2, col3 = st.columns(3)
    with col1:
        st.write("col1")
        st.form_submit_button("Button 1")
    with col2:
        st.write("col2")
        st.form_submit_button("Button 2")
    with col3:
        st.write("col3")
        st.form_submit_button("Button 3")

Accept sugestions to solve this bug, maybe using css or markdown.


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:5
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
LukasMasuchcommented, Jul 20, 2022

@wizzioficial Thanks for reporting this! st.columns are built to be responsive, meaning that it will switch to rendering the columns underneath each other at a certain display size. So, this is more of an enhancement request to add some capabilities to deactivate the responsiveness of columns.

1reaction
sfc-gh-kbregulacommented, Oct 12, 2022

As workaround, you can use CSS style:

st.write('''<style>

[data-testid="column"] {
    width: calc(33.3333% - 1rem) !important;
    flex: 1 1 calc(33.3333% - 1rem) !important;
    min-width: calc(33% - 1rem) !important;
}
</style>''', unsafe_allow_html=True)
Read more comments on GitHub >

github_iconTop Results From Across the Web

St.columns not working on mobile version - Using Streamlit
Hi, I'm using st.columns on st.form. ... of an enhancement request to add some capabilities to deactivate the responsiveness of columns.
Read more >
Disable responsive behavior site-wide
We don't recommend disabling responsive behavior entirely. Here are some alternatives: You can prevent columns from stacking by setting custom ...
Read more >
How to reduce the number of columns in a responsive layout?
Its simple you can use media Query and Reduce the padding from left and right. e.g : @media screen and (max-width:500px){ .wrapper ...
Read more >
Creating responsive columns in Elementor - Artbees themes
2. Click on the column settings icon in upper-left corner of the column in your layout so that a new dashboard on the...
Read more >
CSS · Bootstrap
You can disable zooming capabilities on mobile devices by adding ... In addition to column clearing at responsive breakpoints, you may need to...
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