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?