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.