Widget for simulating hyperlink

I have implemented a couple of basic panel apps and am now looking to build something more like a single page web app. I have been reading through the docs, looking at the examples and outside of some more complicated examples using the fast template and widgets, I cannot find what I would would be a most basic core widget - a hyperlink. I’ve looked a the TextWidget, other posts recommending jslink(How to click hyperlink / button to copy text to clipboard? - links here don’t work), which is not what I am looking for either as I want to handle the OnClick event in Python

Since the hyperlink is the most foundational functional element of the web, I feel like I must be missing something very obvious. For this functionality is the only way to use components from fast or some other library?

I don’t entirely follow, but if you wanted to handle on click events you could probably use Button and then adjust the CSS to just keep the text labels.

Or, implement a custom one: Build Components from Scratch — Panel v1.3.6
Build your own custom components with ReactiveHTML

Hi @pjsulin

Welcome to the community.

I’m not sure i follow you either.

If you are looking to create hyperlinks, then the easiest way is via Markdown.

script.py

import panel as pn

pn.extension()

links = pn.pane.Markdown("""
- [Home](./)
- [Script](./script)
- [Panel](https://panel.holoviz.org)
""")

links.servable()
panel serve script.py --autoreload --index script

Then you can navigate between the Home and Script pages as well as the Panel homepage.

image

Thanks, both examples are very helpful. I think I need to dive into one of the templates, try more customization and then play with ReactiveHTML. Panel offers so much that grok’ing it will take me a bit more time and experimentation, but I am loving it so far!

1 Like

Hi @Marc ,
Thanks for the idea. Can we do one for emails?

1 Like

Nevermind, it just work if I apply “mailto:” inside the parenthesis. Thanks.

links = pn.pane.Markdown("""
- [Home](./)
- [Script](./script)
- [Panel](https://panel.holoviz.org)
- [Email](mailto:user@gmail.com)
""")

links.servable()
1 Like