Skip to main content

Module popup

Module popup 

Source
Expand description

Where transient surfaces open, how soon, and what edge they draw.

Dropdowns, menus, hover cards, and toolbars all float above the page, and a reader reads them as one family or as none. This module owns the three things that make them a family: the side they prefer to open on, how long a hover waits before one appears, and the edge that separates a floating surface from the content behind it.

Placement is a preference, not a command. Every surface is positioned through the shared positioner, which flips to the opposite side when the preferred one does not fit and clamps to the window when neither does — so a composer at the bottom of a window opens its menu upward without the caller arranging it. PopupSide::Auto simply states that preference explicitly.

§Example

gpui_ai::init(cx);
gpui_ai::popup::PopupTokens::default()
    .with_side(gpui_ai::popup::PopupSide::Above)
    .set(cx);

Structs§

PopupTokens
The crate’s policy for floating surfaces.

Enums§

PopupSide
The side a floating surface prefers to open on.