Popover
Arbitrary content on the floating layer, anchored to a trigger.
The general form of Select's dropdown, on the same portal primitive: the caller
owns Open, the panel floats 4dp below the anchor, and pressing anywhere else or
Escape closes it.
Installation
Use the module import (the default), or own the source: lotusui add
vendors the component into your app and lotusui update keeps the copy mergeable —
see Registry.
go get github.com/ikaito-com/lotusui
# or vendor the source into your app:
go run github.com/ikaito-com/lotusui/cmd/lotusui add popover
Usage
var pop lotusui.Popover
if trigger.Clicked(gtx) { pop.Open = !pop.Open }
dims := lotusui.Button(th, &trigger, "Open", lotusui.ButtonProps{})(gtx)
pop.Layout(th, gtx, dims.Size, panelContent)
Alignments
Align positions the panel's edge against the anchor:
PopoverCenter (default, shadcn), PopoverStart, PopoverEnd.
pop.Width = 160
pop.Align = lotusui.PopoverEnd
API
| Option | Type | Description |
|---|---|---|
Open | bool | Caller-owned; toggled from the trigger's click. |
Width | unit.Dp | Max panel width; zero matches the anchor. Non-zero: hug content up to Width. |
Align | PopoverAlign | PopoverCenter (default, shadcn), PopoverStart, PopoverEnd against the anchor. |