How to display information about a word when you click to it?

I want to implement displaying information about a recognized word when clicking on it. I recognize an image on a word and output the recognized text. How can I make sure that when I click on a word, a window appears with its meaning and explanation? Is there plugins for this?

You can use st.expander for this… Alternatively, you could use st.button and modify it with css to not show the button outline and do something like display text when clicked.

import streamlit as st

if st.button("Click me", type="primary"):
    st.write("Clicked")

st.button("Another button!")

st.markdown(
    """
    <style>
    button[kind="primary"] {
        background: none!important;
        border: none;
        padding: 0!important;
        color: black !important;
        text-decoration: none;
        cursor: pointer;
        border: none !important;
    }
    button[kind="primary"]:hover {
        text-decoration: none;
        color: black !important;
    }
    button[kind="primary"]:focus {
        outline: none !important;
        box-shadow: none !important;
        color: black !important;
    }
    </style>
    """,
    unsafe_allow_html=True,
)

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