Skip to main content

Form / Menu

Create a contextual menu component. Useful when you have a lot of links and want to conserve the space.

from h2o_wave import main, app, Q, ui
image = ''commands = [    ui.command(name='profile', label='Profile', icon='Contact'),    ui.command(name='preferences', label='Preferences', icon='Settings'),    ui.command(name='logout', label='Logout', icon='SignOut'),]

@app('/demo')async def serve(q: Q):    if not q.client.initialized:['example'] = ui.form_card(box='1 1 2 3', items=[])        q.client.initialized = True    if 'profile' in q.args and not q.args.show_form:['example'].items = [            ui.text(f'profile={q.args.profile}'),            ui.text(f'preferences={q.args.preferences}'),            ui.text(f'logout={q.args.logout}'),            ui.button(name='show_form', label='Back', primary=True),        ]    else:['example'].items = [  , items=commands),  'Add', items=commands),          ]    await

Tags: โ€‚form โ€‚menu