Clickable hyperlinks in dataframes

Summary

What is the best way to make cell contents clickable as hyperlinks today?

Various approaches have been put forward over the years but the ag-grid approach seems to have stopped working. cf. How to display a clickable link pandas dataframe - #5 by edsaac – just displays an empty frame. The to_html approach is, frankly, clunky and not very streamlitian (what’s the word for that?)

It looks like the new underlying tech for st.dataframe – glide-data – supports clickable hyperlinks via an @urlcolumn parameter https://github.com/streamlit/streamlit/pull/5972 – but did that make it into 1.19? Is it coming soon in 1.20?

Ideas for best practice going forward? @lukasmasuch ?

Personally I’m pinning streamlit-aggrid==0.3.3, pandas<2.0 and waiting for Streamlit 1.20.

We will release URL columns for st.dataframe within the next few weeks :slight_smile:

6 Likes

I don’t see this in 1.21, will it (likely) be in 1.22?

Still not seeing this in 1.22 @lukasmasuch did I miss it somewhere in release notes? Or is it not out yet?

A little late, but if anyone here is still curious or for anyone else who comes across this thread looking for an answer…

See the LinkColumn configuration.

You can see an example of what this looks like in the ‘Configuring columns’ section here.

Here is a small code snippet of how I am using it:

st.dataframe(
    df,
    column_config={
        "website": st.column_config.LinkColumn()
    }
)

where website corresponds to a column in my DataFrame.

3 Likes

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

Hey everyone, :wave:

Updating here to share the latest update to LinkColumn in dataframes as of Release 1.30.0. You can now display custom text for your links instead of just seeing the raw URL!

Looking forward to hearing what you think and seeing your new dataframes!

1 Like