Library / SDK
raysan5/raygui avatar
raysan5/raygui

raygui in C: one header, one define, and the raylib version you have to match

A simple and easy-to-use immediate-mode gui library

5,283 stars406 forksCZlib

At a glance

What is it?
raygui is a single header immediate mode GUI written for raylib, aimed at internal tools rather than games. It gives you more than 25 controls, 512 built-in icons and runtime style loading. The two warnings at the top of the README decide whether your build works at all.
Who is it for?
raygui fits an internal tool, a config editor, or a debug overlay that has to look like the rest of a raylib program. Check three things before you commit: that your raylib version matches the raygui branch, because master tracks raylib master; that your codebase can keep `RAYGUI_IMPLEMENTATION` in exactly one translation unit; and that you have budget for the 5.0 API change, where every function returns a result value.
Can I use it commercially?
Yes. Zlib is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 5 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • raysan5/raygui5,283 ★ · +114
Star history
Repository2026-09-232026-11-15
raysan5/raygui5.2k5.3k

114 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

One define in one translation unit, and the rest is just an include

The whole integration is three lines. `raygui.h` holds both the function definitions and their implementations, so including it twice from the same build is fine as long as only one file turns the implementation on:

c
#include "raylib.h"

#define RAYGUI_IMPLEMENTATION
#include "raygui.h"

The rule that catches people is the second half: `RAYGUI_IMPLEMENTATION` must be previously defined to pull in the implementation part of the header, and only in one compilation unit. Every other file in your project may include `raygui.h` for the prototypes, but must not define the macro again. Define it in two files and the linker reports duplicate symbols, which in a large C or C++ project means reading the build log to find out which two files you forgot about.

The header carries an internal dependency on raylib despite being header-only, so raylib headers must be reachable, and the ordering above is not decoration: `raylib.h` first, then the define, then `raygui.h`.

raygui 5.0 turned every control call into a call with a result value

The second warning in the README is blunt: version 5.0 introduces API-breaking changes, and now all functions return a result value.

That matters for how you sequence an upgrade. The basic set is `Label`, `Button`, `LabelButton`, `Toggle`, `ToggleGroup`, `ToggleSlider`, `CheckBox`, `ComboBox`, `DropdownBox`, `TextBox`, `ValueBox`, `Spinner`, `Slider`, `SliderBar`, `ProgressBar`, `StatusBar`, `DummyRec` and `Grid`. Containers and separators are `WindowBox`, `GroupBox`, `Line`, `Panel`, `ScrollPanel` and `TabBar`, and the advanced group is `ListView`, `ColorPicker`, `MessageBox` and `TextInputBox`.

Given a fixed control set, a change where every function returns a result value touches every call site. The README describes no deprecation window, so plan the migration as a full pass over your UI code rather than an incremental one. Note also the release gap behind it: 3.6 shipped 2023-05-09, 4.0 on 2023-09-11, and 5.0 on 2026-07-20.

Master tracks raylib master, so version pairing is your problem

The first warning says that the latest raygui from the master branch is always aligned with the latest raylib from the master branch and with all raylibtech tools, and that you should make sure to use the latest versions. Read the other way, that is a constraint on you: there is no compatibility matrix and no list of supported raylib versions, so a pair that has never been tested together is your pair.

An application built against raygui master has to be rebuilt whenever raylib moves, so "latest" is a moving target you have chosen to stand on.

If you need a frozen pair, pin both sides to releases: raygui 5.0 with the raylib release you tested, and take the updates as deliberate steps rather than as a pull.

512 icons in a 4096 byte array, addressed by a #id# prefix

Icons are compiled into the header as binary data rather than loaded from disk. The predefined set holds 512 possible icons, each defined as 16 by 16 pixels, each pixel codified with 1 bit, and the whole array is 4096 bytes. That is why a header-only library can ship a usable icon set with no asset pipeline.

Using one is a string convention. Prefix the `#iconId#` number to any text written inside a control:

c
if (GuiButton(rec, "#05#Open Image")) { /* ACTION */ }

The prefix is parsed out of the control's text, which is convenient and also a constraint: any literal text in a raygui control that happens to start with a hash and digits is a candidate icon reference, so user-supplied strings piped into control labels need escaping. If you prefer a named constant, `GuiIconText()` prefixes the icon for you using an identifier defined in `raygui.h`:

c
if (GuiButton(rec, GuiIconText(ICON_FILE_OPEN, "Open Image"))) { /* ACTION */ }

The set can be reviewed and edited with rGuiIcons, one of the three support tools.

Styles load at runtime, and the metrics are process-wide state

A default style is loaded automatically at runtime, so a control draws with raylib's plain look before you write a line of styling code: simple colors, plain rectangular shapes and wide borders, matching the rest of a raylib program. Additional styles ship in the styles directory and are pulled in at runtime through `GuiLoadStyle()`.

Two of the three support tools exist to feed that mechanism. rGuiStyler is a style editor for raygui, and rGuiLayout is a layout editor. Custom styles can be created with rGuiStyler and loaded at runtime with `GuiLoadStyle()`.

The examples directory has a `style_selector/` example and a `styles/` directory, so there is a working path for that rather than guesswork.

Building a shared library means renaming the header to a .c file

The header-only path needs no build step. The shared library path exists for people who need bindings, and the recipe is the same shape on every platform: copy or rename `raygui.h` to `raygui.c` and compile it as a translation unit. On Linux with GCC:

code
mv src/raygui.h src/raygui.c
gcc -o raygui.so src/raygui.c -shared -fpic -DRAYGUI_IMPLEMENTATION -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
mv src/raygui.c src/raygui.h

On macOS the same idea with homebrew's raylib, where the raylib flags come from `pkg-config`:

code
cp src/raygui.h src/raygui.c
brew install raylib
gcc -o raygui.dynlib src/raygui.c -shared -fpic -DRAYGUI_IMPLEMENTATION -framework OpenGL -lm -lpthread -ldl $(pkg-config --libs --cflags raylib)

On Windows under MinGW with GCC the output is a DLL plus an import library:

code
copy src/raygui.h src/raygui.c
gcc -o src/raygui.dll src/raygui.c -shared -DRAYGUI_IMPLEMENTATION -DBUILD_LIBTYPE_SHARED -static-libgcc -lopengl32 -lgdi32 -lwinmm -Wl,--out-implib,src/librayguidll.a

The MSVC route needs `cl`, which the README tells you to reach through the Developer Command Prompt for VS 2022, and it needs both the raylib include directory and its import library passed as paths. Note what all four recipes share: turning the header into a .c file and compiling it with `RAYGUI_IMPLEMENTATION` defined. There is no CMake step in the README.

No retained data means your state lives in your own variables

raygui is immediate mode with no retained data, and the project states plainly that it is intended for tools development rather than for game UI, having been used to build published tools on raylibtech.itch.io. It was inspired by Unity's immediate mode GUI and designed as an auxiliary module for raylib, though it can be adapted to other engines and frameworks, and a standalone usage mode is supported for other graphics libraries.

The no-retained-data design is the trade to understand before you commit. Every control reads and writes your variables on each frame: a button call is checked each frame inside an `if`, as the README sample shows. That makes state easy to follow and easy to test, and it makes serialization, undo and layout persistence your responsibility, because the library keeps nothing between frames.

The examples directory shows what people actually build with it: `controls_test_suite/`, `property_list/`, `custom_file_dialog/`, `custom_input_box/`, `custom_sliders/`, `floating_window/`, `scroll_panel/`, `animation_curve/`, `image_exporter/`, `image_importer_raw/`, `portable_window/`, `standalone/` and `style_selector/`, with a `Makefile` at the top of that directory. The license is an unmodified zlib/libpng license, which the README notes is OSI-certified, BSD-like and permits static linking with closed source software. The last push was 2026-10-20.

Editorial conclusion

raygui fits an internal tool, a config editor, or a debug overlay that has to look like the rest of a raylib program. Check three things before you commit: that your raylib version matches the raygui branch, because master tracks raylib master; that your codebase can keep `RAYGUI_IMPLEMENTATION` in exactly one translation unit; and that you have budget for the 5.0 API change, where every function returns a result value. Skip it if you need retained widget state or a retained-mode layout tree; nothing here gives you either.

Frequently asked questions

What is raygui?

A single-file header-only immediate mode GUI library written in C, designed as an auxiliary module for raylib and inspired by Unity's IMGUI. It provides more than 25 controls, a styling system for colors, font and metrics, and a built-in pack of 512 1-bit icons. It is aimed at tools development.

How do I use raygui in my project?

Include raylib.h, then define RAYGUI_IMPLEMENTATION before including raygui.h, and only in one compilation unit. Other files can include raygui.h without the define. Controls are immediate mode: they read and write your own variables every frame, and styles are loaded at runtime with GuiLoadStyle().

How do I install raygui?

There is no install step for the header-only path. Copy src/raygui.h into your project. If you need a shared library for bindings, rename src/raygui.h to src/raygui.c, compile it as a translation unit with -DRAYGUI_IMPLEMENTATION.

How do I add raygui to an existing C project?

Drop src/raygui.h into the project, put #define RAYGUI_IMPLEMENTATION before its include in exactly one .c file, and link against raylib. The README's shared library recipes show platform link flags, for example -lopengl32 -lgdi32 -lwinmm with MinGW and -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 on Linux.

What is the difference between raygui and raylib?

raylib is the graphics library raygui sits on top of. raygui is the immediate mode GUI layer for it: more than 25 controls, themes, and 512 embedded icons, with no retained widget data of its own. It also has a standalone usage mode for other graphics libraries.

Is raylib only for Windows?

No. raygui ships shared library recipes for Windows with MinGW and GCC, Windows with MSVC, Linux with GCC, and macOS with clang against a homebrew raylib, and the Linux line links -lX11 and -lGL while the macOS line uses -framework OpenGL.

Official sources

  1. Issues
  2. License: Zlib
  3. raysan5/raygui on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/raysan5-raygui.svg)](https://hysenlabs.com/projects/raysan5-raygui)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/raysan5-raygui.svg)](https://hysenlabs.com/projects/raysan5-raygui)

Was this useful?