Clay preview
clay

Clay

High performance 2D UI layout library

17k|stable|v0.14
#define CLAY_IMPLEMENTATION #include "clay.h" Clay_Arena arena = Clay_CreateArenaWithCapacityAndMemory(totalMemorySize, malloc(totalMemorySize)); Clay_Initialize(arena, (Clay_Dimensions) { screenWidth, screenHeight }, errorHandler); Clay_BeginLayout(); // Declare UI with CLAY() macros Clay_RenderCommandArray renderCommands = Clay_EndLayout(deltaTime);
Microsecond layout performance — Layouts complete in microseconds with zero dependencies and no standard library linking.
Flexbox-like layout model — Supports responsive layouts with text wrapping, scrolling containers, and aspect ratio scaling.
Declarative syntax — React-like nested API with reusable component functions in standard C code.
WebAssembly support — Compiles to 15kb uncompressed WASM for browser-based UIs.
Renderer agnostic — Outputs sorted rendering primitives compatible with any 3D engine or HTML.
Clay is a single 4.8k LOC header file that delivers microsecond layout performance with zero dependencies. It uses static arena-based memory allocation with no malloc/free, making it ideal for performance-critical applications. Supports both native and WebAssembly compilation with a React-like declarative syntax.
C99 compiler; optional: clang for WebAssembly compilation
Source on GitHub
pavilion