popover

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package popover provides floating content anchored to a trigger element.

Popovers display rich content in a floating panel positioned relative to a trigger element. Unlike tooltips, popovers can contain interactive content and are opened by clicking rather than hovering.

Basic usage:

popover.Popover(
    popover.PopoverProps{
        Position: forgeui.PositionBottom,
        Align:    forgeui.AlignStart,
    },
    button.Button(g.Text("Open Popover")),
    html.Div(g.Text("Popover content")),
)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Popover

func Popover(props PopoverProps, trigger g.Node, content ...g.Node) g.Node

Popover creates a popover with floating content anchored to a trigger.

The popover uses Alpine.js for state management and can be positioned on any side of the trigger element (top, right, bottom, left) with different alignments (start, center, end).

Example:

popover.Popover(
    popover.PopoverProps{
        Position: forgeui.PositionRight,
        Align:    forgeui.AlignStart,
    },
    button.Button(g.Text("Settings")),
    html.Div(
        html.H4(g.Text("Quick Settings")),
        html.P(g.Text("Configure your options here")),
    ),
)

func PopoverClose

func PopoverClose(child g.Node) g.Node

PopoverClose wraps an element to close the popover when clicked.

Types

type PopoverProps

type PopoverProps struct {
	// Position specifies where the popover appears relative to trigger
	Position forgeui.Position

	// Align specifies how the popover aligns with the trigger
	Align forgeui.Align

	// ShowArrow displays a pointer arrow
	ShowArrow bool

	// Offset is the distance in pixels from the trigger
	Offset int

	// CloseOnOutsideClick enables closing when clicking outside
	CloseOnOutsideClick bool

	// Class adds additional CSS classes
	Class string
}

PopoverProps defines configuration for a popover

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL