Expand description
PopoverWidget<T> — a generic trigger that opens a popover when
activated, plus the PopoverButton / PopoverIconButton aliases.
Wraps a caller-built trigger (T: PopoverTrigger) with overlay
wiring: owns a popover_open: Signal<bool> toggled on activate /
dismiss, sets has_popup and expanded_when on the inner trigger so
AT announces the disclosure state, pre-builds the popover content as a
dormant subtree, and shows / hides it via [OverlayRequest]. The
set_dormant + activate + show_overlay sequence and the
dismiss-callback shape match DateEdit
so behavior across the disclosure family stays consistent.
// Text trigger (HasPopup::Dialog by default, no caret):
let _w = PopoverButton::new(Button::new(lit!("Choose…")).variant(ButtonVariant::Plain))
.content(TextWidget::new(lit!("Pick")));
// Icon trigger (HasPopup::Menu by default, corner caret on):
let _w = PopoverIconButton::new(IconButton::add().toolbar())
.content(MenuList::new().item(MenuItem::new(lit!("New file"))));§Trigger configuration overrides
build() configures the inner trigger by calling has_popup,
expanded_when, and on_activate_fn (and share_interaction when a
caret is shown). These replace any previous values the caller set
— in particular any on_activate_fn set before ::new is discarded,
because the activate slot is owned by the popover wiring. Use
on_open / on_close, or observe open_signal, for side effects.
§Per-trigger differences (the PopoverTrigger trait)
Button and IconButton differ only in: the default has_popup
kind, whether the disclosure caret shows by default, whether the
caret is suppressed (IconButton at Compact), and how the caret’s
color is derived. Those four points live behind PopoverTrigger;
everything else is shared by the generic.
Structs§
- Popover
Widget - A trigger paired with a popover surface. See the module docs for the
contract on which trigger properties get overridden during
build(). Use thePopoverButton/PopoverIconButtonaliases for the concrete trigger types.
Traits§
- Popover
Trigger - A trigger widget usable with
PopoverWidget. Implemented forButtonandIconButton. Captures the few points where the two triggers differ; everything else is handled by the generic wrapper.
Type Aliases§
- Popover
Button - A
Buttonthat opens a popover when activated. Alias forPopoverWidget<Button>—HasPopup::Dialog, no caret by default. - Popover
Custom - A popover whose trigger is an arbitrary widget, wrapped in
OverlayTrigger. - Popover
Icon Button - An
IconButtonthat opens a popover when activated. Alias forPopoverWidget<IconButton>—HasPopup::Menu, corner caret on by default (skipped atCompact).