Skip to content

Commit

Permalink
#747 add a context menu demo
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Apr 13, 2023
1 parent ac120a5 commit 450991b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions website/more_documentation/menu_documentation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from nicegui import ui

from ..documentation_tools import text_demo


def main_demo() -> None:
with ui.row().classes('w-full items-center'):
Expand All @@ -12,3 +14,16 @@ def main_demo() -> None:
lambda: result.set_text('Selected item 3'), auto_close=False)
ui.separator()
ui.menu_item('Close', on_click=menu.close)


def more() -> None:
@text_demo('Custom Context Menu', '''
Using Quasar's `context-menu` and `touch-position` props, you can create custom context menus.
''')
def custom_context_menu() -> None:
with ui.image('https://picsum.photos/id/377/640/360'):
with ui.menu().props('context-menu touch-position'):
ui.menu_item('Flip horizontally')
ui.menu_item('Flip vertically')
ui.separator()
ui.menu_item('Reset')

0 comments on commit 450991b

Please sign in to comment.