Possible to show Tooltips on hover?

Is there a way to add tooltips in streamlit?

I am building a streamlit app where a user can select different models to use to predict on some data.

Right now I’m using st.radio to select a model. I’d really like to do is show a tooltip on hovering on the different options so I can show an explanation of each model.

something like st.radio(options=list, tooltips=list).

Is this something I can already do using the format_func?

1 Like

Hey @khalido,

This is not somthing supported right now, but is something you could do using the upcoming Custom Components if you’d like to try it out :slight_smile:

Do feel free to file a GH issue though so the eng. team can check if it’s easy to add into native Streamlit.

Fanilo

3 Likes

relevant issue: https://github.com/streamlit/streamlit/issues/1124?_pjax=%23js-repo-pjax-container

I’d offer a bounty for this feature if I could propose such a thing… would be such a value add as a parameter to checkboxes, text input widgets, etc

+1 on the tooltip! :heart:

3 Likes

You can see it is coming here Add tooltips to even more widgets by bh-streamlit · Pull Request #2594 · streamlit/streamlit · GitHub

2 Likes

Hey @khalido ,

I had a similar request for the agraph component.
So I did a little web search and found this library:
wwayne/react-tooltip: react tooltip component (github.com)
If you can’t wait, you can try to write your own component, as @andfanilo suggested.
Hope that helps.

Chris

1 Like

Streamlit added official support for tooltips from version 0.79.0 onwards.
The syntax is st.radio(options=list, help=tooltip_text) where tooltip_text can be any valid markdown text you have defined.

Read more here

3 Likes