浏览代码

add notification type demo

Rodja Trappe 2 年之前
父节点
当前提交
240b7e7311
共有 1 个文件被更改,包括 12 次插入0 次删除
  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'))