How to create a pop-up window for inputs in my streamlit app?

Hello everyone, I have a streamlit app and I want to create a new pop-up so that I can insert new inputs into my app within the created pop-up. However, I would like to customize my pop-up and I would like to define where it will be located on my app screen. Currently I am using the streamlit-modal library, but it does not allow me to make such customizations. Does anyone know how I can customize a pop-up or create a window so I can insert new inputs into my application? If you know other libraries, I’m also open to using them.

Below is an example of using streamlit-modal:

modal = Modal(
    "Demo Modal", 
    key="demo-modal",
    
    # Optional
    padding=20,    # default value
    max_width=744  # default value
)

open_modal = st.button("Open")
if open_modal:
    modal.open()

if modal.is_open():
    with modal.container():
        st.write("Text goes here")

        st.write("Some fancy text")
        value = st.checkbox("Check me")
        st.write(f"Checkbox checked: {value}")

I use version 1.21.0 of streamlit and 3.10.12 of python

Hi @MarcosB99

Check the docs for popover (st.popover - Streamlit Docs), available with streamlit 1.32.

Cheers

3 Likes

Hi @Shawn_Pereira

This is very helpful for my problem. Can I customize texts, fonts, colors, etc.?

Thanks!! :smiley:

Hi @MarcosB99

As also mentioned in the Docs for st.popover the label parameter supports emojis, colored text and Latex expressions.

Hope this helps!

Hi @dataprofessor !!

Thanks! that worked

Cheers

1 Like

That’s great!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

st.experimental_dialog is out now, too!