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.ButtonOpts{})(gtx)
pop.Layout(th, gtx, dims.Size, panelContent)
Alignments
Align positions the panel's edge against the anchor:
PopoverStart (default), PopoverCenter, 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 | Panel width cap; zero uses the anchor's width. |
Align | PopoverAlign | PopoverStart (default), PopoverCenter, PopoverEnd against the anchor. |