Help with Dropdown in Notification with timeout

What I’m trying to do:
I need a notification which have a dropdown inside that and a timeout function which times out the notification based on the n seconds.

What I’ve tried and what’s not working:
n = Notification(RadioButton(), “This is an important message!”, timeout=5)

Welcome to the forum.

You cannot add components inside Notifications. However, you can use alerts for doing that.

1 Like

I know about alerts but couldn’t find out any timeout way in alert to automatically disappear as in notifications after timeout.

You can put a Form inside of the alert. On that form you can have Timer component. In that timer component you can use self.raise_event("x-close-alert") to close the alert.

You can pass a value back as the return from the alert call using self.raise_event("x-close-alert", value=42). Replace 42 with whatever you want returned.

3 Likes