โ† Back to news

MicroUI โ€“ A tiny, portable, immediate-mode UI library written in ANSI C

github.com|117 points|37 comments|by peter_d_sherman|Jun 17, 2026

MicroUI: A Minimalist, Portable Immediate-Mode UI Library

MicroUI is a lightweight, immediate-mode user interface library crafted entirely in ANSI C. It is designed for developers who need a portable and unobtrusive UI layer without the overhead of heavy frameworks.

๐Ÿš€ Core Characteristics

The library is defined by its extreme efficiency and simplicity. Its footprint is remarkably small, with a size of approximately: SLOCโ‰ˆ1100\text{SLOC} \approx 1100

Key Highlights

  • Memory Efficiency: Operates within a pre-defined, fixed-size memory block. There is no dynamic memory allocation (no malloc calls) during runtime.
  • Rendering Agnostic: It does not include a built-in renderer. It is compatible with any system capable of rendering basic text and rectangles.
  • Extensible: The architecture is intentionally simple, making it easy for users to implement their own custom widgets.
  • Layout: Features a straightforward system for organizing elements.

Supported UI Elements

ControlDescription
WindowThe primary container for UI elements.
Scrollable PanelA region that allows content to be scrolled.
ButtonA clickable trigger.
SliderA draggable value adjuster.
TextboxAn editable text input field.
LabelStatic text display.
CheckboxA binary toggle switch.
Wordwrapped TextText that automatically wraps to fit the width.

๐Ÿ›  Architecture Flow

The following diagram illustrates how MicroUI interacts with your application:


๐Ÿ’ป Implementation Example

Below is a demonstration of how to define a window with a layout, buttons, and a popup:

if ( mu_begin_window ( ctx , "My Window" , mu_rect ( 10 , 10 , 140 , 86 ))) {
    // Define a row with 2 columns: first is 60px, second takes remaining space
    mu_layout_row ( ctx , 2 , ( int []) { 60 , -1 }, 0 );

    mu_label ( ctx , "First:" );
    if ( mu_button ( ctx , "Button1" )) {
        printf ( "Button1 pressed\n" );
    }

    mu_label ( ctx , "Second:" );
    if ( mu_button ( ctx , "Button2" )) {
        mu_open_popup ( ctx , "My Popup" );
    }

    if ( mu_begin_popup ( ctx , "My Popup" )) {
        mu_label ( ctx , "Hello world!" );
        mu_end_popup ( ctx );
    }

    mu_end_window ( ctx );
}

Important Note: MicroUI does not perform any actual drawing. It expects the developer to provide the input data and handle the resulting drawing commands using their own graphics backend.


๐Ÿ–ผ Visuals

microui example screenshot


๐Ÿ“– Getting Started

To integrate MicroUI into your project, follow these steps:

  • Review the detailed instructions in doc/usage.md.
  • Explore the demo directory for a practical implementation example.
  • Implement the rectangle and text drawing functions for your specific platform.

๐Ÿค Contributing & Licensing

Contributions: The primary goal of this library is to remain lightweight. While it provides a solid foundation for adding custom elements, please note that pull requests adding new built-in features will likely be declined to preserve the library's minimal nature.

License: This project is released as free software under the MIT License, allowing for free redistribution and modification.

Repository Statistics

  • Language: C (100%)
  • Stars: 6.2k
  • Forks: 378
  • Watchers: 87