A tiny immediate-mode UI library
  • C 97.8%
  • Nix 2.2%
Find a file
Thiago Sposito c2e09c2beb
chore: Add Nix support and update demo for SDL3
- Introduced .gitignore and flake.nix files for Nix package management.
- Updated demo build scripts to use SDL3 instead of SDL2.
- Changed version to 2.0.3 and updated copyright year to 2026.
- Added logo.svg for documentation.
- Removed outdated FUNDING.yml file.
2026-04-12 23:27:21 -03:00
demo chore: Add Nix support and update demo for SDL3 2026-04-12 23:27:21 -03:00
doc chore: Add Nix support and update demo for SDL3 2026-04-12 23:27:21 -03:00
src chore: Add Nix support and update demo for SDL3 2026-04-12 23:27:21 -03:00
.gitignore chore: Add Nix support and update demo for SDL3 2026-04-12 23:27:21 -03:00
flake.lock chore: Add Nix support and update demo for SDL3 2026-04-12 23:27:21 -03:00
flake.nix chore: Add Nix support and update demo for SDL3 2026-04-12 23:27:21 -03:00
LICENSE chore: Add Nix support and update demo for SDL3 2026-04-12 23:27:21 -03:00
README.md chore: Add Nix support and update demo for SDL3 2026-04-12 23:27:21 -03:00

microui

A tiny, portable, immediate-mode UI library written in ANSI C

Features

  • Tiny: around 1100 sloc of ANSI C
  • Works within a fixed-sized memory region: no additional memory is allocated
  • Built-in controls: window, scrollable panel, button, slider, textbox, label, checkbox, wordwrapped text
  • Works with any rendering system that can draw rectangles and text
  • Designed to allow the user to easily add custom controls
  • Simple layout system

Example

if (mu_begin_window(ctx, "My Window", mu_rect(10, 10, 140, 86))) {
  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);
}

Usage

  • See doc/usage.md for usage instructions
  • See the demo directory for a usage example

Notes

The library expects the user to provide input and handle the resultant drawing commands, it does not do any drawing itself.

Contributing

The library is designed to be lightweight, providing a foundation to which you can easily add custom controls and UI elements; pull requests adding additional features will likely not be merged. Bug reports are welcome.

License

This library is free software; the original code (up to Version 2.02) you can redistribute it and/or modify it underthe terms of the MIT license.

For all later changes (Code by Thiago Sposito) code is under AGPL.

See LICENSE for details.