lotusui the ikaito design language for Gio — desktop, mobile, web
GitHub

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
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

Go
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.

Go
pop.Width = 160
pop.Align = lotusui.PopoverEnd

API

OptionTypeDescription
OpenboolCaller-owned; toggled from the trigger's click.
Widthunit.DpPanel width cap; zero uses the anchor's width.
AlignPopoverAlignPopoverStart (default), PopoverCenter, PopoverEnd against the anchor.

Every demo on this site is the real Go component compiled to WebAssembly — one gallery app, one bundle, addressed by URL hash.