Ver código fonte

add notification type demo

Rodja Trappe 2 anos atrás
pai
commit
240b7e7311
1 arquivos alterados com 12 adições e 0 exclusões
  1. 12 0
      website/more_documentation/notify_documentation.py

+ 12 - 0
website/more_documentation/notify_documentation.py

@@ -1,5 +1,17 @@
 from nicegui import ui
 
+from ..documentation_tools import text_demo
+
 
 def main_demo() -> None:
     ui.button('Say hi!', on_click=lambda: ui.notify('Hi!', close_button='OK'))
+
+
+def more() -> None:
+    @text_demo('Notification Types', '''
+        There are different types that can be used to indicate the nature of the notification.
+    ''')
+    def notify_colors():
+        ui.button('negative', on_click=lambda: ui.notify('error', type='negative'))
+        ui.button('positive', on_click=lambda: ui.notify('success', type='positive'))
+        ui.button('warning', on_click=lambda: ui.notify('warning', type='warning'))