Create internal link inside a dataframe

Hello, I have an app containing a simple dataframe displaying characteristics of some smartphones. The goal would be to be able to create an internal link inside the “Modèle de téléphone” column in order to send the user into a new page displaying more characteristics about the specific phone.

I guess we could use st.column_config.LinkColumn() to create a link towards a real web page for the smartphone, but my goal is to stay in the app by basically creating a “new page” for each smartphone.

Is that even possible currently? Here is an image of my displayed dataframe.

Thanks for the help!

You could direct the links in the dataframe to the app’s own URL with some query parameters.

link_to_query_param

Code
import streamlit as st

APP_URL = "http://localhost:8501"
query_model = st.query_params.get("model", None)

df = dict(
    Model=["Pear", "Banana"],
    Brand=["SONY", "Motorola"],
    Price=[1_000, 2_000],
    Link=[f"{APP_URL}/?model=Pear", f"{APP_URL}/?model=Banana"],
)

# App: 
if query_model:
    st.image(f"https://placehold.co/200x100?text={query_model }")
    st.button("Go back", on_click=st.query_params.clear)

else:
    st.dataframe(df, column_config=dict(Link=st.column_config.LinkColumn()))