# How to Contribute to the ImGui Project: A Complete Developer Guide

> Learn how to contribute to the ImGui project. Follow our guide to clone the repository, adhere to coding standards, and submit your pull requests for C++ GUI development.

- Repository: [omar/imgui](https://github.com/ocornut/imgui)
- Tags: how-to-guide
- Published: 2026-07-13

---

**To contribute to the ImGui project, clone the ocornut/imgui repository, follow the 4-space indentation and naming conventions specified in [`docs/CONTRIBUTING.md`](https://github.com/ocornut/imgui/blob/main/docs/CONTRIBUTING.md), and submit pull requests that include minimal, complete changes with updates to [`imgui_demo.cpp`](https://github.com/ocornut/imgui/blob/main/imgui_demo.cpp) for visual verification.**

Dear ImGui is a portable, immediate-mode graphical user interface library written in C++ that powers tools in thousands of game engines and applications. If you want to contribute to the ImGui project, understanding the repository's architecture and submission workflow is essential for getting your changes merged. The contribution process emphasizes focused pull requests, adherence to coding standards, and comprehensive testing through the built-in demo system.

## Understanding the ImGui Repository Structure

Before you contribute to the ImGui project, familiarize yourself with how the codebase is organized. The repository is deliberately modular, separating the core header-only library from platform-specific adapters and example applications.

### Core UI Components

The immediate-mode API and widget logic reside in the root directory. Key files include [`imgui.h`](https://github.com/ocornut/imgui/blob/main/imgui.h) and [`imgui.cpp`](https://github.com/ocornut/imgui/blob/main/imgui.cpp) for the public API and internal state, [`imgui_draw.cpp`](https://github.com/ocornut/imgui/blob/main/imgui_draw.cpp) for rendering primitives, and [`imgui_widgets.cpp`](https://github.com/ocornut/imgui/blob/main/imgui_widgets.cpp) for widget implementations. These files use **4-space indentation**, `snake_case` for local variables, and `CamelCase` for functions, with comments prefixed using `//`.

### Back-ends, Examples, and Documentation

Platform integration lives in `backends/imgui_impl_*.h` and `backends/imgui_impl_*.cpp` files, supporting OpenGL, DirectX, Vulkan, SDL, and others. The `examples/` directory contains minimal integration samples in `examples/*/main.cpp`, while [`imgui_demo.cpp`](https://github.com/ocornut/imgui/blob/main/imgui_demo.cpp) serves as the primary visual testing ground. Documentation files such as [`docs/FAQ.md`](https://github.com/ocornut/imgui/blob/main/docs/FAQ.md) and [`docs/FONTS.md`](https://github.com/ocornut/imgui/blob/main/docs/FONTS.md) must be kept up-to-date when your changes impact user-facing behavior.

## Setting Up Your Development Environment

Start by cloning the repository and creating a feature branch:

```bash
git clone https://github.com/ocornut/imgui.git
cd imgui
git checkout -b my-feature-branch

```

Run the demo application by building any example target and executing `ImGui::ShowDemoWindow()` to verify your environment and explore existing code paths.

## Contribution Workflow and Guidelines for ImGui

The official [`docs/CONTRIBUTING.md`](https://github.com/ocornut/imgui/blob/main/docs/CONTRIBUTING.md) file outlines the complete process for submitting changes to ocornut/imgui.

### Coding Standards

All contributions must follow the project's strict style: **4-space indentation**, `snake_case` for locals, `CamelCase` for functions, and `//` comment prefixes. The core library maintains a header-only design for easy inclusion, so keep changes minimal and focused. Avoid large, unrelated edits in a single pull request.

### Issues vs. Discussions

Use **Issues** for bug reports, concrete feature requests, or help when you have a reproducible example. Use **Discussions** for general questions, brainstorming, or when you cannot build or run ImGui at all. This distinction helps maintainers prioritize development work and track actionable tasks.

### Pull Request Requirements

When you open a pull request, include:
- The Dear ImGui version or branch you based your changes on
- The specific platform or renderer back-ends affected (`imgui_impl_*.cpp`)
- A clear description of the problem and solution
- A minimal, complete, verifiable example (MCVE) when applicable

## Practical Example: Contributing a Custom Widget

Below is a minimal implementation of extending ImGui with a custom widget. First, create a header file following the repository's inline function pattern:

```cpp
// File: imgui_custom.h
#pragma once
#include "imgui.h"

// Custom widget that prints a greeting and returns true when the button is pressed.
inline bool HelloWorld(const char* label)
{
    ImGui::Text("👋 %s", label);
    return ImGui::Button("Say Hello");
}

```

Then integrate it into the demo system in [`imgui_demo.cpp`](https://github.com/ocornut/imgui/blob/main/imgui_demo.cpp) within the `ShowDemoWindow()` function:

```cpp
// File: imgui_demo.cpp (add within ShowDemoWindow())
#include "imgui_custom.h"

if (ImGui::CollapsingHeader("Custom Widgets"))
{
    if (HelloWorld("Dear ImGui"))
        ImGui::OpenPopup("HelloPopup");
    if (ImGui::BeginPopup("HelloPopup"))
    {
        ImGui::Text("Hello, world!");
        ImGui::EndPopup();
    }
}

```

This approach follows the **inline-function** pattern used throughout the codebase, utilizes existing ImGui APIs, and updates the demo so reviewers can instantly verify the functionality.

## Summary

- **Read [`docs/CONTRIBUTING.md`](https://github.com/ocornut/imgui/blob/main/docs/CONTRIBUTING.md)** before starting any work to understand issue versus discussion usage and PR requirements.
- **Modify core files** ([`imgui.cpp`](https://github.com/ocornut/imgui/blob/main/imgui.cpp), [`imgui_widgets.cpp`](https://github.com/ocornut/imgui/blob/main/imgui_widgets.cpp)) for API changes, but keep the header-only architecture intact.
- **Update [`imgui_demo.cpp`](https://github.com/ocornut/imgui/blob/main/imgui_demo.cpp)** whenever you add new widgets or functionality to provide visual verification for reviewers.
- **Respect back-end boundaries** by only modifying `backends/imgui_impl_*.cpp` files when fixing renderer-specific bugs.
- **Follow coding style** strictly: 4-space indentation, `snake_case` locals, `CamelCase` functions, and `//` comments.

## Frequently Asked Questions

### What coding style does ImGui use?

ImGui uses 4-space indentation with `snake_case` for local variables and `CamelCase` for function names, as seen throughout [`imgui.h`](https://github.com/ocornut/imgui/blob/main/imgui.h) and [`imgui.cpp`](https://github.com/ocornut/imgui/blob/main/imgui.cpp). Comments must use `//` prefixes rather than block comments. This consistency is enforced across all files in the repository, including back-ends and examples.

### How do I test my changes to ImGui?

Test your changes by building and running the demo window via `ImGui::ShowDemoWindow()`, typically by compiling one of the example applications in `examples/*/main.cpp`. If you add new widgets or API functionality, update [`imgui_demo.cpp`](https://github.com/ocornut/imgui/blob/main/imgui_demo.cpp) to include your additions so reviewers can visually verify the behavior.

### Should I modify the back-end files?

Only modify the back-end files (`backends/imgui_impl_*.h` and `backends/imgui_impl_*.cpp`) when fixing renderer-specific bugs or adding support for new platforms. The core library is designed to be platform-agnostic, so new widgets and UI logic belong in the root `imgui_*.cpp` files, not in back-end implementations.

### Where should I ask questions before contributing?

Use GitHub **Discussions** for general questions, brainstorming, or when you cannot build or run ImGui. Reserve **Issues** for concrete bug reports and feature requests that include reproducible examples. This distinction helps maintainers focus on code development rather than support triage.