Pop Up windows in streamlit

Hi everyone. Iโ€™m new here and wanna understand is there any way to create pop up windows in basic streamlit module? I see error messages like these below. But I canโ€™t find how to use it

Hi @Bogdan_Gergel . Use st.toast or st.warning. Kfr better understanding follow the docs:-

Happy Streamlit-ing :balloon:

Toasts and warning are different. I wanna understand how to call popup windows like on the pictures

Hi @Bogdan_Gergel

Streamlit does not have this functionality natively as yet.

  1. At the very least, you could try something like:
import streamlit.components.v1 as components

mycode = "<script>alert('This box is me!')</script>"
components.html(mycode, height=0, width=0)
  1. Have a look at this library: GitHub - ObservedObserver/streamlit-shadcn-ui: Using shadcn-ui components in streamlit
    The components you could try are: Card and Alert Dialog, to see they can suit your purpose.


1 Like

This only fires the first time from a button. If you click the button a second time it will not fire the JavaScript.

Toast only accepts a few words and is fixed to disappear after like 5 sec.

st.warning and others pushes things around the screen to show text. A dialog box of sorts would be nice : )

Thanks for the tip on that library.

1 Like