Skip to main content

Module popover

Module popover 

Expand description

Popover: the one anchored floating Panel.

A popover opens next to the control that summoned it, on a preferred side, flipping to the opposite side when it would leave the window and sliding along the other axis to stay inside it. It is a floating Panel (super::floating_surface): panel radius, the blurred material, one soft shadow. It paints in the window’s top layer (Widget::draw_overlay), so it is never clipped by, or drawn under, the pane it was opened from. While open it captures input: Escape or a click outside closes it, and the click does not reach what is behind.

Two bodies:

  • An option menu (Popover::new): pick one of a short list of options next to the control that owns the value (a refresh cadence, a unit). The chosen option carries a check; the keyboard and pointer highlight is the lift of the panel ground, never an accent fill. Full keyboard navigation, and Role::Menu semantics.
  • Any content (Popover::with_content): a widget laid out at its own size inside the panel’s padding.

Hosts that draw by hand drive an option menu through Popover::open_at, Popover::item_at, Popover::move_highlight, Popover::select and Popover::take_selection, and reach its paint through their own draw_overlay (or by returning it from children_mut).

Structs§

NoContent
The body of an option menu: no content widget.
Popover
An anchored floating Panel holding an option menu or any content widget. See the module docs for the contract.
PopoverButton
A button that opens a popover anchored to its own rect (crate::widget::Button::with_popover): a filter’s options, a share sheet’s details. A click, Enter or Space opens it and closes it again; the button reads as expanded while it is open.
PopoverPrompt
The body of a prompt popover (Popover::prompt): a caption, one field and a hint under it. Enter submits what was typed; Escape closes the popover without it.

Enums§

PanelAlign
Which edge of its anchor a floating Panel lines up with on the cross axis.
PopoverSide
Which side of its anchor a floating Panel opens on.