A high-performance, zero-dependency UI layout library in C with a flexbox-like model and renderer-agnostic output.
Clay is a high-performance UI layout library written in C that provides a flexbox-like model for building responsive user interfaces. It solves the problem of creating complex layouts with minimal overhead, offering microsecond-speed calculations and zero dependencies. The library outputs render commands that can be used with any rendering backend, from 3D engines to HTML.
Developers building performant UIs in C or C++, especially those in game development, embedded systems, or WebAssembly projects who need a lightweight, dependency-free layout solution.
Clay stands out for its exceptional performance, single-header simplicity, and renderer-agnostic design, allowing seamless integration into existing rendering pipelines without locking users into a specific graphics stack.
High performance UI layout library in C.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Layout calculations occur in microseconds, optimized for speed with minimal overhead, as highlighted in the 'Microsecond Performance' feature.
It's a single-header library (clay.h) with zero dependencies, including no standard library linking, making integration straightforward and lightweight.
Supports flexbox-like responsive layouts, text wrapping, scrolling containers, and aspect ratio scaling, enabling complex UI designs similar to CSS.
Outputs a sorted list of rendering primitives compatible with any backend, from 3D engines to HTML, allowing seamless integration into existing pipelines.
Uses a static memory arena with no malloc/free, keeping overhead low (e.g., ~3.5MB for 8192 elements), ideal for constrained environments.
Requires users to write custom rendering code for each backend, as there's no built-in renderer; examples are provided but need significant integration effort.
The measure text function must be user-provided and highly performant, which can become a bottleneck if not optimized, as noted in the API warnings.
Lacks pre-built components, visual editors, or extensive community plugins compared to established UI libraries, making development more from-scratch.
The declarative syntax relies heavily on C macros and standard C control flow, which may be unfamiliar or cumbersome for developers not versed in low-level C programming.