MicroUI โ A tiny, portable, immediate-mode UI library written in ANSI C
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:
Key Highlights
- Memory Efficiency: Operates within a pre-defined, fixed-size memory block. There is
no dynamic memory allocation(nomalloccalls) 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
| Control | Description |
|---|---|
Window | The primary container for UI elements. |
Scrollable Panel | A region that allows content to be scrolled. |
Button | A clickable trigger. |
Slider | A draggable value adjuster. |
Textbox | An editable text input field. |
Label | Static text display. |
Checkbox | A binary toggle switch. |
Wordwrapped Text | Text 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

๐ Getting Started
To integrate MicroUI into your project, follow these steps:
- Review the detailed instructions in
doc/usage.md. - Explore the
demodirectory 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