What Are ImGuiWindowFlags and How to Use Them in Dear ImGui
ImGuiWindowFlags are bit-field constants defined in imgui.h that control the appearance, sizing, and interaction model of ImGui windows, which you combine with the bitwise OR operator (|) and pass to ImGui::Begin() or ImGui::BeginChild().
In the ocornut/imgui repository, ImGuiWindowFlags provide the primary mechanism for customizing how a window behaves when created with ImGui::Begin(). These flags let you remove title bars, disable resizing, enable auto-fit, and fine-tune navigation without subclassing or overriding rendering code.
Where ImGuiWindowFlags Are Defined
In imgui.h (around line 1171), Dear ImGui declares the ImGuiWindowFlags_ enum and exposes it through the ImGuiWindowFlags type. Each constant is defined as a single bit shift (1 << n), so multiple flags can be merged into one bitmask without overlap.
Common ImGuiWindowFlags Values
The public API exposes a broad set of window-level toggles. The most frequently used ImGuiWindowFlags include:
- ImGuiWindowFlags_NoTitleBar — Hides the title bar; useful for borderless pop-up panels.
- ImGuiWindowFlags_NoResize — Removes resize grips and prevents manual resizing.
- ImGuiWindowFlags_NoMove — Locks the window in place, which is ideal for HUD elements.
- ImGuiWindowFlags_NoScrollbar — Hides scrollbars while still allowing programmatic scrolling.
- ImGuiWindowFlags_NoCollapse — Removes the collapse button from the title bar.
- ImGuiWindowFlags_AlwaysAutoResize — Forces the window to fit its contents every single frame.
- ImGuiWindowFlags_MenuBar — Allocates extra space for a menu bar via
ImGui::BeginMenuBar(). - ImGuiWindowFlags_NoBackground — Skips background drawing, producing a transparent overlay effect.
- ImGuiWindowFlags_NoFocusOnAppearing — Prevents the window from stealing focus when it is first shown.
- ImGuiWindowFlags_NoBringToFrontOnFocus — Keeps the window at its current Z-order even when focused.
- ImGuiWindowFlags_HorizontalScrollbar — Adds a horizontal scrollbar for wide content.
- ImGuiWindowFlags_NoNav — Disables keyboard and gamepad navigation entirely inside the window.
How to Combine and Apply ImGuiWindowFlags
You pass the combined bitmask as the third argument of ImGui::Begin() or via the optional window_flags parameter of ImGui::BeginChild(). To request default behavior, pass 0 or ImGuiWindowFlags_None.
Fixed-Size Tool Window Example
ImGui::Begin("Fixed", nullptr,
ImGuiWindowFlags_NoTitleBar |
ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoScrollbar);
ImGui::Text("This window cannot be moved, resized or scrolled.");
ImGui::End();
Auto-Resizing Debug Panel Example
ImGui::Begin("Auto-Resize", nullptr,
ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoCollapse);
for (int i = 0; i < 10; ++i)
ImGui::Text("Line %d", i);
ImGui::End();
Child Window with Flags Example
ImGui::Begin("Parent");
ImGui::BeginChild("Child", ImVec2(0, ImGui::GetContentRegionAvail().y),
ImGuiChildFlags_Borders |
ImGuiChildFlags_AutoResizeX);
ImGui::Text("Child window expands horizontally.");
ImGui::EndChild();
ImGui::End();
Internal Flags to Avoid
Dear ImGui reserves several flags for its own window management logic in imgui.cpp. These include ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_Tooltip, and ImGuiWindowFlags_Popup. Because they drive internal behavior and are not part of the public API, application code should never set them manually; doing so can create silent bugs or break compatibility with future releases.
Key Source Files
imgui.h— Declares theImGuiWindowFlags_enum and theImGui::Begin()/ImGui::BeginChild()signatures that accept the flags.imgui.cpp— Contains the core implementation that interprets the bitmask and applies the corresponding drawing and interaction rules.imgui_demo.cpp— Provides runnable demonstrations; search forBegin(to see how different flag combinations behave in practice.
Summary
- ImGuiWindowFlags are bit-field constants stored in the
ImGuiWindowFlagstype, declared inimgui.h. - Combine multiple flags with the bitwise OR operator (
|) and pass the result toImGui::Begin()orImGui::BeginChild(). - Use
0orImGuiWindowFlags_Nonewhen you want the default window chrome and behavior. - Avoid internal flags such as
ImGuiWindowFlags_ChildWindowbecause they are reserved for internal use insideimgui.cpp.
Frequently Asked Questions
How do I combine multiple ImGuiWindowFlags?
Combine individual constants with the bitwise OR operator (|). Because each value occupies a unique bit, OR-ing them produces a safe bitmask that ImGui::Begin() interprets correctly.
Can I use ImGuiWindowFlags with ImGui::BeginChild()?
Yes. ImGui::BeginChild() accepts an optional ImGuiWindowFlags parameter, so child windows can be configured with the same window-level flags as top-level windows.
What happens if I pass 0 or ImGuiWindowFlags_None?
Passing zero or the explicit ImGuiWindowFlags_None constant yields the default window behavior, including a title bar, resize grips, scrollbars, and collapse button.
Are internal flags such as ImGuiWindowFlags_ChildWindow safe to use?
No. Flags like ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_Tooltip, and ImGuiWindowFlags_Popup are reserved for Dear ImGui's internal implementation. Using them in your application code is unsupported and may break in future versions.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →