Components / Layers
u:popover
body in a card that stands beside an element, the caret of an editor or a range of its text, on side of it gap points away.
The code
return u:button("hint", { title = "Details" })
root:child(u:popover("hint-card", { anchor = "hint" },
pencere.div():p(12):gap(4):w(270)
:child(pencere.text("postgres"):weight(700))
:child(pencere.text("pid 324, 128.4% CPU, 851 MiB"):color("dim"))))
What it does
body in a card that stands beside an element (anchor: its name), the caret of an editor (pencere.caret_of(editor)) or a range of its text (pencere.range_of(editor, name)), on side of it ("below" by default) gap points away. It leaves the page as it is, the keyboard where it is, and says { kind = "dismiss" } at what dismiss lists ("escape", "away" (a press outside it, not on its anchor), and of an editor's: "edit", "caret", "scroll", "leave"; all of them where it stands by an editor, the first two by an element). hide_delay (0.3) is how long the pointer may be off the word it rested on before "leave" does: it may come onto the card, or rest on another word, within it, and does not close again where the pointer was on the card when it ended: the card then goes at what else dismiss lists. focus = true is the card whose body the keys ↑ ↓ ⇞ ⇟ scroll (commands of the page, while it is open) and Escape closes, with the keyboard staying in the editor.