diff --git a/website/documentation/content/dialog_documentation.py b/website/documentation/content/dialog_documentation.py index b2ed76d3b..ad7b09b13 100644 --- a/website/documentation/content/dialog_documentation.py +++ b/website/documentation/content/dialog_documentation.py @@ -48,4 +48,18 @@ def replace(): ui.button('Replace', on_click=replace) +@doc.demo('Events', ''' + Dialogs emit events when they are opened or closed. + See the [Quasar documentation](https://quasar.dev/vue-components/dialog) for more information. +''') +def events(): + with ui.dialog().props('backdrop-filter="blur(8px) brightness(40%)"') as dialog: + ui.label('Press ESC to close').classes('text-3xl text-white') + + dialog.on('show', lambda: ui.notify('Dialog opened')) + dialog.on('hide', lambda: ui.notify('Dialog closed')) + dialog.on('escape-key', lambda: ui.notify('ESC pressed')) + ui.button('Open', on_click=dialog.open) + + doc.reference(ui.dialog)