As of 1.10: what is best way hyperlinked text cells in dataframes

With the changes to st.dataframe in 1.10 and the switch to a new underlying library, what is now the best way to make text cells in a dataframe into clickable hyperlinks?

Wrt to hyperlinking text cells in dataframes, nothing has changed. Here’s an example that works in earlier versions and 1.10.0:

import streamlit as st
import pandas as pd

def hyperlink(url):
    return f'<a target="_blank" href="{url}">{url}</a>'

df = pd.DataFrame(columns=['page'])
df['page'] = ['https://www.google.com', 'https://www.youtube.com', 'https://www.facebook.com']
df['page'] = df['page'].apply(hyperlink)
df = df.to_html(escape=False)

st.write(df, unsafe_allow_html=True)

dataframe-hyperlink

1 Like

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

Hey there @fredzannarbor,

Know it’s been a while, but wanted to share a recent update for you on this. You can now configure the LinkColumn in dataframes to display custom text! :partying_face:

Check out the docs for more info and feel free to reach out with any questions!

Still timely!