Allow user to click on line in table and get popup

Summary

I have a table in a streamlit app.

If a user clicks on the second line, I would like a popup which says “you have clicked on the second line, which contains the element ‘bar’”

Steps to reproduce

Code snippet:

import streamlit as st


st.table(['foo', 'bar', 'baz'])

Is there a way to do that?

Hey @MarcoGorelli, welcome to our forum :balloon:

Popups are not yet supported in Streamlit! But we have something in the oven for interactive dataframes… Now, if you can’t wait, you probably want to have a look at streamlit-aggrid which unlocks a lot of interactivity with dataframes in Streamlit already - although no popup as far as I know! See it in action in this example app (code)

Hope that helps,

2 Likes

Hi @MarcoGorelli,

For popups, you could have a look at this logic:

Cheers

3 Likes

thanks both!