explaingit

rxi/microui

5,880CAudience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

microui is a ~1100-line C library for building immediate-mode user interfaces, you describe your UI in code each frame and it outputs drawing commands that you render with your own graphics system.

Mindmap

mindmap
  root((microui))
    What it does
      Immediate-mode UI
      Draw command output
      Fixed memory use
    Tech stack
      Standard C
    Built-in controls
      Buttons and sliders
      Text boxes
      Checkboxes
      Scrollable panels
    Use cases
      Game debug UI
      Embedded UI
      Custom rendering
    Design
      No drawing code
      Renderer agnostic
      1100 lines total
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a debug panel or settings UI to a C game or graphics app without pulling in a large GUI library.

USE CASE 2

Build tool UIs with buttons, sliders, and checkboxes that render through your existing graphics backend.

USE CASE 3

Embed a lightweight UI layer in a project with strict memory constraints, microui never allocates memory at runtime.

USE CASE 4

Port a UI to a new platform by implementing only the drawing commands microui outputs, without changing UI logic.

Tech stack

C

Getting it running

Difficulty · moderate Time to first run · 1h+

You must implement your own renderer, microui outputs draw commands but does not draw anything itself.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

microui is a very small library for building user interfaces in C. The entire codebase is around 1,100 lines of code, which is unusually compact for a UI toolkit. It is written in standard C, meaning it can be compiled and run on almost any platform without modification. The library follows an approach called immediate-mode UI. Rather than creating persistent objects for each button or panel that live in memory and need to be managed, immediate-mode UI redraws the interface from scratch every frame by calling functions in sequence. Each call both defines what a widget looks like and checks whether the user interacted with it. The code example in the README shows this clearly: a window, two labels, two buttons, and a popup are all described by a handful of function calls inside a loop. The built-in controls include windows, scrollable panels, buttons, sliders, text boxes, labels, checkboxes, and word-wrapped text. The library handles layout automatically and lets developers add custom controls if needed. One design constraint worth noting is that microui does not draw anything itself. It produces a list of drawing commands, and the developer is responsible for feeding those commands to whatever graphics system the application already uses. This makes it compatible with any rendering setup that can draw rectangles and text. Memory usage is fixed at startup, meaning the library never allocates additional memory at runtime. The project is open source under the MIT license.

Copy-paste prompts

Prompt 1
Show me how to create a window with two buttons in microui that toggles a boolean on click, with the draw commands printed to verify the output.
Prompt 2
I'm using microui with SDL2 in C. Write the renderer that reads microui's command buffer and calls the correct SDL2 drawing functions for each command type.
Prompt 3
How do I add a custom widget to microui that draws a color picker and returns the selected RGB value back to my application code?
Prompt 4
Write a microui layout with a fixed left sidebar and a resizable main content area, and show how the layout responds when the window is resized.
Open on GitHub → Explain another repo

← rxi on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.