Skip to main content

Meta / Notification bar / Closable

Display a notification_bar and detect when it's closed.

from h2o_wave import main, app, Q, ui

async def serve(q: Q):
if not q.client.initialized:
# Create an empty meta_card to hold the notification bar['meta'] = ui.meta_card(box='')
# Display a button to show the notification bar['form'] = ui.form_card(box='1 1 2 4', items=[
ui.button(name='show_notification_bar', label='Show notification bar'),
q.client.initialized = True

# Was the show_notification_bar button clicked?
if q.args.show_notification_bar:
# Create a notification bar['meta'].notification_bar = ui.notification_bar(
text='You can close me!',
# Get notified when the notification bar is dismissed.

# Did we get events from the notification bar?
# Was the notification bar dismissed?
# Delete the notification bar['meta'].notification_bar = None


Tags:  metanotification_bar