Ship faster with goilerplate templUI Pro

Popover

Displays rich content in a floating layer. Powered by Floating UI.

Source Tailwind CSS JavaScript

Installation

  1. Install the component

    templui add popover
  2. Add the JavaScript to your layout

    @popover.Script()
    

    Call this template in your base layout file (e.g., in the <head> section).

Examples

Trigger & Closing

Positions

API Reference

Required parameter
Hover for description

Trigger

Element that triggers the popover when interacted with.

Name Type Default
ID
string
-
Class
string
-
Attributes
templ.Attributes
-
For
string
-
TriggerType
TriggerType
click

Content

Container for the popover content with positioning and behavior options.

Name Type Default
ID
string
-
Class
string
-
Attributes
templ.Attributes
-
Placement
Placement
bottom
Offset
int
4 (or 8 with arrow)
DisableClickAway
bool
false
DisableESC
bool
false
ShowArrow
bool
false
HoverDelay
int
0
HoverOutDelay
int
0
MatchWidth
bool
false
Exclusive
bool
false

JavaScript API

// Open a popover programmatically
window.tui.popover.open("popover-id");

// Close a popover
window.tui.popover.close("popover-id");

// Close all popovers (optionally except one)
window.tui.popover.closeAll(); // Closes all
window.tui.popover.closeAll("popover-id"); // Closes all except "popover-id"

// Toggle popover state
window.tui.popover.toggle("popover-id");

// Check if popover is open (returns true/false)
const isOpen = window.tui.popover.isOpen("popover-id");