Skip to content

Tooltip

Informative text shown on hover, focus, or click. Four positions (top, bottom, left, right), optional rich description, and hover or click triggers.

Default Rendered example
Usage Example
@tooltip.Tooltip("myTooltip", "Tooltip top", tooltip.WithTriggerLabel("Top"))

With Description

Add a Description for a richer two-line tooltip.

With Description Rendered example
With Description
@tooltip.Tooltip(
    "richTooltip",
    "Tooltip top",
    tooltip.WithDescription("A rich tooltip with longer text."),
)

Click Trigger

Use ActivationClick for a persistent tooltip. Its actual trigger retains aria-describedby and reflects aria-controls and aria-expanded; click, Enter, or Space toggles it, while Escape or an outside click dismisses it without moving focus. Because the content remains a tooltip, the trigger does not use aria-haspopup.

Click Trigger Rendered example
Click Trigger
@tooltip.Tooltip(
    "clickTooltip",
    "Tooltip top",
    tooltip.WithActivation(tooltip.ActivationClick),
    tooltip.WithTriggerLabel("Click Me"),
)

Go API

v0.2.7

The examples above cover behavior and composition. pkg.go.dev is the canonical reference for exported types, functions, methods, and Go documentation.

github.com/araihu/goshtoso/components/tooltip
Open v0.2.7 API