I built some buttons in different columns, and the button will open a modal.
then the modal width is same as column.
import streamlit as st
from streamlit_modal import Modal
modal = Modal(key="Demo Key",title="test")
for col in st.columns(8):
with col:
open_modal = st.button(label='button')
if open_modal:
with modal.container():
st.markdown('testtesttesttesttesttesttesttest')
Every modal’s width is very small and same as column width, is there any other function to build a popup window?
It is hard to tell because your code is not indented, but I guess you are nesting the modal inside the column. Do not do that if that is not what you want.
Oh sorry, I forgot to indent.
Here’s my code, I’m doing this because I need to build different buttons in the column, and click different buttons to display the popup with the related data.
This is the code I used to demonstrate, so I wonder if there is any other way to define a fixed popup and display data, the buttons have different label and data?
I see, but button widget is in the column, I want to click the button to show the popup and have already defined the modal outside, only open the container in column, but there’s still small width.
I have no idea how to move the popup outside after clicking button.
Hello everyone, i am creating an app that help users to insert or update data from a sql table through some widgets, using them as a form, then te user clicks the save button and the modal popup is displayed, but i have some problems regarding the popup:
if the sidebar is opened, the popup is not seen properly (it is behind the sidebar)
If my page layout is wide, the popup adapts to all the frame of the page and i want to avooid it
confirmationEdit = Modal("Atención", key= "popUp_edit")
(...) the widgets
submitted = st.button("Enviar")
if submitted:
confirmationEdit.open()
if confirmationEdit.is_open():
with confirmationEdit.container():
st.markdown(""" ### ¿Deseas guardar los cambios? """)
yes = st.button("Sí")
no = st.button("No")
if yes == True:
(...) format data
confirmationEdit.close()
if no == True:
confirmationEdit.close()
Hi. I am trying to create popup filter window and found small problem here. It looks like box inside not big enough, so the scroll appear in any case. I can’t figure out how to fix it. Could you help me?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.