Skip to content

popovers/popover

A small floating panel anchored at a point, collecting a value and resolving a promise with it.

This is the popover counterpart of modals/modal.ts: the same “ask the user for a value, resolve a promise” shape, for the cases a modal cannot serve. A modal dims the screen and is positioned by Obsidian, neither of which suits an editor that must appear at the thing it edits — a clicked link, the caret, or wherever a context menu was raised.

The panel rides Obsidian’s .menu class for its background, border and shadow, so only layout is styled by this library.

Interface Description
ShowPopoverBuildParams The tools handed to ShowPopoverParams.build for populating a popover.
ShowPopoverParams Parameters for showPopover.
Function Description
showPopover Displays a popover at the given anchor and resolves with the built value, or null if it was dismissed without confirming.
Type Description
PopoverValueGetter Reads the value the popover resolves with when it is confirmed.