[Python] How to open pop up (st.dialog) after clicking html button in st.markdown?

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am developping streamlit web application.

    The functionality I want to add is :

    When I click the button, I want to show the pop up button

    [​IMG]

    [​IMG]

    Here is the code I did :

    import streamlit as st

    st.title("TEST JS & HTML IN STREAMLIT")
    st.caption('A live demo')

    # Navbar Component
    st.markdown(f"""

    <div class="navbar-buttons">
    <a href="#" class="navbar-text">POP UP BUTTON</a>
    </div>


    """, unsafe_allow_html=True)

    @st.dialog("POP UP WINDOW")
    def show_rgpd_popup():
    st.write("""
    This is pop up window
    """)

    if True :
    show_rgpd_popup()


    I have to keep st.markdown to use html component (st.button or st.navbar I do not want to use)

    But I cannot find a proper solution to realize this functionality.

    Can you help me ?

    Continue reading...

Compartilhe esta Página