Hover Card
Displays rich content in a card when hovering over a trigger. Uses Popover for the popup and positioning.
@templ
A HTML templating language for Go with great developer tooling.
Installation
templui add hovercardLoad the script once in your layout:
<head>
@hovercard.Script()
</head>Examples
Positions
Opens on Top
Opens on Right
Opens on Bottom
Opens on Left
API Reference
Root
Groups one trigger with one hover card content element.
| Name | Type | Default |
|---|---|---|
Optional root ID for the JavaScript API. | | - |
Additional CSS classes to apply to the root wrapper. | | - |
Additional HTML attributes to apply to the root wrapper. | | - |
Trigger
Element that opens the hover card on hover.
| Name | Type | Default |
|---|---|---|
Optional HTML id for the trigger element. | | - |
Additional CSS classes to apply to the trigger. | | - |
Additional HTML attributes to apply to the trigger element. | | - |
Content
The hover card surface. Placement and hover delays are configured here.
| Name | Type | Default |
|---|---|---|
Optional HTML id for the content element. | | - |
Additional CSS classes to apply to the content. Override the default width here. | | |
Additional HTML attributes to apply to the content element. | | - |
Position of the card relative to trigger. Options: 'top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end'. | | |
Distance in pixels between the trigger and card. | | |
Whether to show an arrow pointing to the trigger element. | | |
Delay in milliseconds before showing the card on hover. | | |
Delay in milliseconds before hiding the card on hover out. | | |