# Clay

> Single-header C library for high-performance, flexbox-like 2D UI layout that works with any renderer

Source: https://talira.ai/catalog/clay-vjgqxstw
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / ui frameworks](https://talira.ai/categories/libraries/ui-frameworks), [libraries / ui components / layout](https://talira.ai/categories/libraries/ui-components/layout)
- Licence: Zlib[^2]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]

Clay (short for C Layout) is a zlib-licensed 2D UI layout library by Nic Barker, shipped as a single `clay.h` header of about 4,800 lines with no dependencies, not even the C standard library. It lays out interfaces in microseconds with a flexbox-like model that handles text wrapping, scrolling containers and aspect ratio scaling, using a React-like nested declarative syntax written as plain C macros, static arena memory with no malloc or free, and a transition API for layout animations. It doesn't draw anything itself: it outputs a sorted list of rendering primitives for any renderer, with examples in its repository such as [raylib](https://talira.ai/catalog/raylib-h43760jk.md) and the web, including compiling to a 15 KB WebAssembly file or HTML. It works from C99 and C++20, with Odin and Rust bindings. It isn't the Clay data enrichment product.

## Links

- Website: https://nicbarker.com/clay
- GitHub: https://github.com/nicbarker/clay

## Problems it solves

- lay out a game or tool UI in C without pulling in a big GUI framework
- a flexbox-style layout engine I can plug into my own renderer
- build a UI in C that also runs in the browser through WebAssembly

## Features

- microsecond layout performance
- flexbox-like layout with text wrapping, scrolling and aspect ratio scaling
- single header with zero dependencies
- static arena memory, no malloc or free
- renderer agnostic output of render commands
- compiles to a 15 KB WebAssembly file
- transition API for layout animations
- built-in debug inspector
- Odin and Rust bindings

## Trust

Overall: 0.43 out of 1.
Signals: maintenance 0.27, adoption 0.85, momentum 0.85, community 0.79, backing 0.00, extensibility 0.00.

- latest release v0.14 18 months ago
- 18.5k GitHub stars
- 95 contributors
- accepts sponsorship (Github)

Warnings:

- last commit 6 months ago

## Alternatives

- [Dear ImGui](https://talira.ai/catalog/dear-imgui-aq4fz1kj.md): Bloat-free graphical user interface library for C++ with minimal dependencies

## Sources

[^1]: https://github.com/nicbarker/clay/blob/main/README.md (checked 29 Nov 2026)
[^2]: https://github.com/nicbarker/clay/blob/main/LICENSE.md (checked 29 Nov 2026)
