Skip to main content

Module popover

Module popover 

Expand description

Popover: the one anchored floating Panel.

It 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 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 the pane it was opened from, and 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) picking one of a short list next to the control that owns the value, the chosen option checked and the highlight the lift of the panel ground rather than an accent fill, with full keyboard navigation and Role::Menu semantics; or any content (Popover::with_content) 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.

Constants§

SHEET_WIDTH
Narrower than this, a panel that stands as a sheet in a narrow window (Popover::set_sheet_when_narrow) does: the width a phone holds a list on, where a panel under its button has no room to be one.