Clay is a high performance UI layout library in C.
Clay solves the problem of building responsive, complex user interfaces with minimal overhead by providing a flexbox-like layout model compiled into a single 4.8k line header file with zero dependencies. The library achieves microsecond layout performance through static arena-based memory allocation that eliminates malloc and free calls, keeping total memory overhead low even for thousands of layout elements. It uses a React-like declarative syntax for defining nested UI hierarchies and outputs a sorted list of rendering primitives that can be composited into any 3D engine or compiled to HTML, making it renderer-agnostic. The tool supports text wrapping, scrolling containers, aspect ratio scaling, and a transition API for layout animations.
Developers should choose Clay for performance-critical UI work where memory predictability and layout speed matter, particularly in game engines, embedded systems, or browser-based applications via WebAssembly. The library compiles to a 15kb uncompressed WebAssembly file, making it suitable for web deployment. Clay's single-file design with no standard library linking requirement makes integration straightforward for projects that need tight control over dependencies. It is well-suited for applications requiring complex, responsive layouts without the overhead of heavier UI frameworks.
The project maintains active engagement with its user base, with nearly all open issues originating from adopters reporting real-world problems rather than internal tracking. Maintainers respond to new issues and pull requests within a day. Work in the issue tracker centers on bug reports, attempted fixes, and enhancement requests, reflecting a development process focused on stability and incremental improvement.