How to add notifications to Streamlit app?

Please, take a look at the following image. Is it possible to implement such kind of notification in Streamlit?

Screenshot 2021-03-31 at 17.20.12

I just want to inform a user that a Celery task is finished.

Web browser based push notification will work also. Not sure whether it is possible to implement such kind of notification in Streamlit or not.

Same question, wait for response.

Hello @chingyen, @blackout65

As far as I’m aware Push notifications are not yet available but let me suggest them to the team and find out more about it :slight_smile:

Best,
Charly

Hey @chingyen, @blackout65!

I’ve feedback from the Devs! :raised_hands:

If they’re asking for in-browser toasts, I believe we have that planned for this quarter.
But if they want desktop notifications, that’s not scheduled yet.
But a component could easily do it!

So, are you guys up to build a custom components? :wink:
You can start here → Publish a Component - Streamlit Docs

Happy Streamlitin’! :balloon:

Best,
Charly

Hi @Charly_Wargnier ,

Just wanted to share some potential features for notification toasts, which I know are somewhere down the roadmap. Just some thoughts in case they are helpful.

  • Adding a “close” or “X” button so users can dismiss the notification after reading it.

  • Setting height, width, and position (center of screen, top-left, top-right, bottom-left, bottom-right) of the notification toast.

  • Adding to the body of the notification toast not only text, but also a url (e.g., to link to a privacy policy document) or even injecting some html.

  • Choosing if the app in the background is greyed out / disabled or not, when the notification toast shows up.

Thanks, @marduk, for your suggestions! :pray:

I’ve passed them over to the Dev team.

I sincerely apologise as your answer slipped through the net.

Best wishes,
Charly

No problem at all @Charly_Wargnier , just wanted to share some ideas in case the Dev team finds them helpful :slight_smile: Thanks for the reply!

Hi @marduk , have a look at Custom notification alert box

Cheers

Hi @marduk ,
Any code snippet on setting the height width and position for the pop up would be really helpfu;.
I am unable to find the documentation of ToastNotifier().

Thank you.

Hey there @01apoorva10 ,

Notification toasts are not available yet in Streamlit as a native component; in my previous message I was just sharing some ideas for the dev team to consider.

If you don’t want to wait for the Streamlit-native notification toasts, @Shawn_Pereira kindly pointed us to a custom component someone built:

Cheers!

Hi, you could also go to pipi and search for ‘toast’ (Search results · PyPI). There are some packages that you may want to give a try.

Cheers

Thanks for the tip @Shawn_Pereira . Can you please fix the URL in your reply? I guess you meant pypi.org :slight_smile:

Thanks @marduk for pointing that out. :slight_smile:

hello, use this repo: