MicroUI: A Tiny, Portable Immediate-Mode UI Library in ANSI C

MicroUI is a portable, immediate-mode graphical user interface (GUI) library written in ANSI C. It is designed for extreme minimalism, providing a set of core UI controls that can be integrated into any project that can render basic rectangles and text.

Core Technical Specifications

MicroUI is defined by its small footprint and lack of external dependencies. The library consists of approximately 1,100 lines of source code (SLOC) and operates within a fixed-sized memory region, meaning it performs no additional memory allocation during runtime.

The library includes the following built-in controls:

  • Windows
  • Scrollable panels
  • Buttons
  • Sliders
  • Textboxes
  • Labels
  • Checkboxes
  • Word-wrapped text

Portability and Rendering Architecture

MicroUI achieves portability by decoupling the UI logic from the rendering backend. It does not include its own graphics facilities because the C standard library lacks them; instead, it requires the user to provide a renderer backend consisting of a set of C functions capable of drawing rectangles and text.

This architecture allows MicroUI to be used across diverse platforms, including:

  • WebAssembly (WASM): Demos exist showing MicroUI running in a browser via WASM.
  • Cross-Platform Binaries: It has been used in conjunction with Cosmopolitan Libc to create "build once, run anywhere" graphical applications.
  • Game Engines/Frameworks: The library is included in the Odin vendor libraries and is frequently used for creating debug menus in Raylib.

Performance and Binary Size Comparison

When compared to other immediate-mode GUI libraries, MicroUI demonstrates a significantly smaller binary footprint. In a benchmark using sokol headers, the compressed download sizes were as follows:

  • MicroUI: 79.6 KB
  • Nuklear: 155 KB
  • Dear ImGui: 491 KB

Integration and Community Insights

While MicroUI is highly praised for its simplicity and ease of integration, community members have noted several technical trade-offs and limitations:

Maintenance and Stability

Some users describe the project as "abandonware," noting a specific bug involving a draw call iterator that causes misaligned pointer access. This issue can cause panics in environments with strict alignment requirements, such as Zig.

Accessibility and Scope

Critics point out that the library lacks accessibility support, which is a primary requirement for production-grade software. Additionally, the library provides the UI logic but does not interface directly with windowing systems (such as X11 or Win32), leaving that implementation to the developer.

Language Bindings

Because of its simple ANSI C implementation, the library has been ported to other languages. For example, a 1:1 port to Rust exists (microui-rs), and it is integrated into the Odin language ecosystem.

Sources