Skip to main content
Popups block normal mouse hovering detection behind them. If not modal, they can be closed by clicking anywhere outside them, or by pressing ESCAPE. Their visibility state is held internally instead of being held by the programmer.

Opening Popups

OpenPopup

Mark popup as open (don’t call every frame!).
const char*
Popup identifier string
ImGuiID
Popup identifier ID
ImGuiPopupFlags
default:"0"
Popup flags (see ImGuiPopupFlags_)

OpenPopupOnItemClick

Helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight.
const char*
default:"NULL"
Popup identifier (NULL = use last item’s ID)
ImGuiPopupFlags
default:"0"
Popup flags

CloseCurrentPopup

Manually close the popup we have begin-ed into.

Regular Popups

BeginPopup

Return true if the popup is open, and you can start outputting to it.
const char*
Popup identifier
ImGuiWindowFlags
default:"0"
Window flags
bool
True if popup is open

EndPopup

Close popup. Only call EndPopup() if BeginPopupXXX() returns true.

BeginPopupModal

Block every interaction behind the window, cannot be closed by user, add a dimming background, has a title bar.
const char*
Modal window name/title
bool*
default:"NULL"
Optional pointer to bool to show close button
ImGuiWindowFlags
default:"0"
Window flags
bool
True if modal is open

Context Menu Popups

BeginPopupContextItem

Open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item.
const char*
default:"NULL"
Popup identifier (NULL = use last item’s ID)
ImGuiPopupFlags
default:"0"
Popup flags (default is right mouse button)
bool
True if popup is open

BeginPopupContextWindow

Open+begin popup when clicked on current window.
const char*
default:"NULL"
Popup identifier
ImGuiPopupFlags
default:"0"
Popup flags
bool
True if popup is open

BeginPopupContextVoid

Open+begin popup when clicked in void (where there are no windows).
const char*
default:"NULL"
Popup identifier
ImGuiPopupFlags
default:"0"
Popup flags
bool
True if popup is open

IsPopupOpen

Return true if the popup is open.
const char*
Popup identifier
ImGuiPopupFlags
default:"0"
Query flags
bool
True if popup is open

ImGuiPopupFlags_

Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions.

Advanced Examples

Confirmation Dialog

Custom Positioned Popup

Input Dialog Modal