You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
I have a bunch of tabs which I use for navigation. I want the last one to link to documentation which is an external URL. However, I don't see a way to open an external URL using a tab.
Describe the solution you'd like
Ideally, the ability to specify an external URL in the tab, maybe a property called link just like a button.
Describe alternatives you've considered
For now, external URLs were opened by setting inline script to f'window.open("{external_url}");'. However, this is not ideal since the page has to be re-rendered. Do mention if there are any more elegant solutions to this.
The text was updated successfully, but these errors were encountered:
Introduce a link property in ui.tab, similar to ui.button. When provided, the link property would override the tab's default behavior and redirect users to the specified URL. If not provided, the tab functions as it currently does, emitting an event to the backend.
`from h2o_wave import main, app, Q, ui
@app('/')
async def serve(q: Q):
if not q.client.initialized:
# Example usage of the proposed 'link' property in ui.tab
q.page['tabs'] = ui.tab_card(
box='1 1 4 1',
items=[
ui.tab(name='home', label='Home'), # Regular tab
ui.tab(name='about', label='About'), # Regular tab
ui.tab(name='documentation', label='Documentation', link='https://wave.h2o.ai') # Tab with external link
]
)
q.page['content'] = ui.markdown_card(
box='1 2 4 4',
title='Welcome',
content='Select a tab to navigate.'
)
q.client.initialized = True
# Backend logic for tabs that do not use the 'link' property
if q.args.home:
q.page['content'].content = 'You are on the Home tab.'
elif q.args.about:
q.page['content'].content = 'You are on the About tab.'
await q.page.save()
`
It will Simplifies navigation to external URLs without the need for custom scripts.Enhances the flexibility and usability of the ui.tab component.Reduces re-rendering overhead for static external links.
If this feature is not immediately available, users can achieve similar behavior with ui.inline_script:
Is your feature request related to a problem? Please describe
I have a bunch of tabs which I use for navigation. I want the last one to link to documentation which is an external URL. However, I don't see a way to open an external URL using a tab.
Describe the solution you'd like
Ideally, the ability to specify an external URL in the tab, maybe a property called
link
just like a button.Describe alternatives you've considered
For now, external URLs were opened by setting inline script to
f'window.open("{external_url}");'
. However, this is not ideal since the page has to be re-rendered. Do mention if there are any more elegant solutions to this.The text was updated successfully, but these errors were encountered: