Popover
Description
A reusable, anchored overlay surface used to display arbitrary IComponent content next to another component (the anchor). Popovers are the general-purpose primitive on top of which menus, comboboxes, date pickers, color pickers and similar transient surfaces are built.
Usage
API reference
public sealed class PopoverA reusable, anchored overlay surface used to display arbitrary content next to another component (the anchor). Popovers are the general-purpose primitive on top of which menus, comboboxes, date pickers, color pickers and similar transient surfaces are built.
Constructors
public Popover()Creates a new, empty popover. Configure it with and the other fluent setters before calling .
Properties
Methods
public Popover Content(IComponent content)Sets the content displayed inside the popover. Replacing the content while the popover is visible will not retroactively update the rendered element; call and again to apply a new content tree.
public Popover Placement(TooltipPlacement placement)Sets the preferred placement of the popover relative to its anchor. Defaults to . The actual placement may flip automatically when there is not enough room on the preferred side.
public Popover Animation(TooltipAnimation animation)Sets the show/hide animation. Defaults to .
public Popover Arrow(bool arrow = true)Enables or disables the small arrow that points from the popover to the anchor.
public Popover MaxWidth(int pixels)Sets the maximum width of the popover surface, in pixels. Defaults to 350.
public Popover Theme(string theme)Applies a named Tippy theme to the popover (e.g. , ).
public Popover HideOnClickOutside(bool hide = true)Controls whether clicking outside the popover hides it. Enabled by default; disable for popovers that should stay open until explicitly closed by their content.
public Popover HideOnEscape(bool hide = true)Controls whether pressing hides the popover. Enabled by default.
public Popover DelayShow(int milliseconds)Adds a delay (in milliseconds) before the popover shows when is called.
public Popover DelayHide(int milliseconds)Adds a delay (in milliseconds) before the popover hides after is requested.
public Popover OnShown(Action action)Registers a callback that runs once the popover has finished its show animation.
public Popover OnHidden(Action action)Registers a callback that runs once the popover has finished its hide animation.
public Popover OnBeforeHide(Func<bool> shouldHide)Registers a callback that runs immediately before the popover hides. Return from the callback to cancel the hide (useful for guarding against accidental dismissal during editing).
public Popover ShowFor(IComponent anchor)Shows the popover anchored to the rendered element of . If the popover is already visible against a different anchor, that instance is hidden first.
Parameters
- anchor
- The component the popover is positioned relative to.
public Popover ShowFor(HTMLElement anchor)Shows the popover anchored to the given DOM element. Use this overload when you only have an element reference (for example, when reacting to a low-level event).