File size: 1,882 Bytes
2b4d75c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# Breadcrumbs
# #Breadcrumbs should be used as a navigational aid in your app or site.
# They indicate the current page’s location within a hierarchy and help
# the user understand where they are in relation to the rest of that hierarchy.
# They also afford one-click access to higher levels of that hierarchy.
# Breadcrumbs are typically placed, in horizontal form, under the masthead
# or #navigation of an experience, above the primary content area.
# ---
from h2o_wave import main, app, Q, ui
@app('/demo')
async def serve(q: Q):
blurb_items = [ui.button(name='#submenu', label='Go to submenu', link=True)]
blurb_title = 'Welcome to Menu'
breadcrumbs = [ui.breadcrumb(name='#menu', label='Menu')]
if q.args['#'] == 'menu':
blurb_items = [ui.button(name='#submenu', label='Go to submenu', link=True)]
blurb_title = 'Welcome to Menu!'
breadcrumbs = [
ui.breadcrumb(name='#menu', label='Menu'),
]
elif q.args['#'] == 'submenu':
blurb_items = [ui.button(name='#subsubmenu', label='Go to subsubmenu', link=True)]
blurb_title = 'Welcome to Submenu!'
breadcrumbs = [
ui.breadcrumb(name='#menu', label='Menu'),
ui.breadcrumb(name='#submenu', label='Submenu'),
]
elif q.args['#'] == 'subsubmenu':
blurb_items = [ui.text('You cannot go deeper, click on Breadcrumbs above to navigate back')]
blurb_title = 'Welcome to Subsubmenu!'
breadcrumbs = [
ui.breadcrumb(name='#menu', label='Menu'),
ui.breadcrumb(name='#submenu', label='Submenu'),
ui.breadcrumb(name='#subsubmenu', label='Subsubmenu'),
]
q.page['blurb'] = ui.form_card(box='1 2 3 2', title=blurb_title, items=blurb_items)
q.page['breadcrumbs'] = ui.breadcrumbs_card(box='1 1 3 1', items=breadcrumbs)
await q.page.save()
|