Link

Links allow users to navigate to a specified location.

Example

from deephaven import ui

my_link_basic = ui.link("Learn more about Deephaven", href="https://deephaven.io/")

Link Basic Example

Content

The link component accepts other components, such as text and icon, as children.

from deephaven import ui


@ui.component
def ui_link_content_examples():
    return [
        ui.link(ui.icon("github"), href="https://github.com/deephaven"),
        ui.link("Deephaven Website", href="https://deephaven.io/"),
    ]


my_link_content_examples = ui_link_content_examples()

Variants

Links can have different styles to indicate their purpose.

from deephaven import ui


@ui.component
def ui_link_variant_examples():
    return [
        ui.link("Deephaven", href="https://deephaven.io/", variant="primary"),
        ui.link(
            "Contact the team",
            href="https://deephaven.io/contact",
            variant="secondary",
        ),
    ]


my_link_variant_examples = ui_link_variant_examples()

Over background

Links can be placed over a background to add a visual prominence to the link.

from deephaven import ui


my_link_over_background_example = ui.view(
    ui.link(
        "Learn more about pandas here!",
        href="https://en.wikipedia.org/wiki/Giant_panda",
        variant="overBackground",
    ),
    background_color="green-500",
    padding="size-300",
)

Quiet State

The is_quiet prop makes the link “quiet”. This can be useful when the link and its corresponding styling should not distract users from surrounding content.

from deephaven import ui


my_link_is_quiet_example = ui.text(
    "You can ", ui.link("use quiet", is_quiet=True), " links inline."
)

API Reference

A link is used for navigating between locations.

Returns: Element The rendered link element.

ParametersTypeDefaultDescription
*childrenAnyThe content to display in the link.
variantLiteral['primary', 'secondary', 'over_background'] |
None
'primary'The background color of the link.
is_quietbool |
None
NoneWhether the link should be displayed with a quiet style.
auto_focusbool |
None
NoneWhether the element should receive focus on render.
hrefstr |
None
NoneA URL to link to.
targetLiteral['_self', '_blank', '_parent', '_top'] |
None
NoneThe target window for the link.
relstr |
None
NoneThe relationship between the linked resource and the current page.
pingstr |
None
NoneA space-separated list of URLs to ping when the link is followed.
downloadstr |
None
NoneCauses the browser to download the linked URL.
href_langstr |
None
NoneHints at the human language of the linked URL.
referrer_policystr |
None
NoneHow much of the referrer to send when following the link.