Open menu on hover? #4108
-
QuestionBefore I re-invent the wheel - does anyone have code to expand menu on hover? Current |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
Like this? with ui.button('Menu').on('mouseenter', lambda: menu.open()):
with ui.menu() as menu:
ui.menu_item('Item 1')
ui.menu_item('Item 2')
ui.menu_item('Item 3') |
Beta Was this translation helpful? Give feedback.
-
I started looking at Here's code for a top-level hover menu. Next step, add nested submenus. with ui.row ().classes ('menurow') :
menu = ui.expansion ('menu')
menu.on ('mouseenter', lambda : menu.open ())
menu.on ('mouseleave', lambda : menu.close ())
with menu :
for name, url in menulinks :
ui.link (name , url) One issue is it's part of page layout. Opening the expansion pushes content down the page to make room. I think I can solve that with css though, so only top level affects page flow. |
Beta Was this translation helpful? Give feedback.
Like this?