Enhance alerts and notifications

I am looking to inform and alert the user with enhanced display, in respect of the material design.
Is it possible to insert a MessagePill in an alert() or notification() ?

I tried this code, but the MessagePill doesn’t appear:

from anvil_extras import navigation, MessagePill

      MPsuccess = MessagePill.MessagePill(level="success", message="Hello", visible=True)
      result = alert(content=self.add_component(MPsuccess),
               title="An important choice",
               large=True,
               buttons=[
                 ("Yes", "YES"),
                 ("No", "NO"),
                 ("Neither", None)
               ])

an alert takes a component as the content argument
a call to self.add_component(MPsuccess) is not a component

It should probably be

      result = alert(content=MPsuccess,
               title="An important choice",
               large=True,
               buttons=[
                 ("Yes", "YES"),
                 ("No", "NO"),
                 ("Neither", None)
               ])

docs:

Anvil Docs | Alerts and Notifications

2 Likes