Clay (short for “C Layout”) is a high-performance 2D UI layout library in C, offering a declarative, Flexbox-like layout model with microsecond performance. It features a single-header design, zero dependencies, and support for WebAssembly, making it lightweight yet powerful for responsive UI rendering. The Clay macro by default accepts an ID as its first argument, which is usually provided by the CLAY_ID() convenience macro. Elements can also be created with auto-generated IDs, by using the CLAY_AUTO_ID() macro. Element IDs have two main use cases. Firstly, tagging an element with an ID allows you to query information about the element later, such as its mouseover state or dimensions. Secondly, IDs are visually useful when attempting to read and modify UI code, as well as when using the built-in debug tools.

Features

  • Microsecond-level layout performance
  • Flexbox-style declarative layout with text wrapping, scrolling, and scaling
  • Single-file (~4k LOC) header-only design, no external dependencies
  • WebAssembly support—compact (~15 KB uncompressed) builds for browser use
  • Static arena memory (no malloc/free), low memory overhead even for large layouts
  • Renderer-agnostic: emits rendering primitives usable in any engine or HTML output

Project Samples

Project Activity

See All Activity >

Categories

Game Engines

License

zlib/libpng License

Follow Clay

Clay Web Site

Other Useful Business Software
Earn up to 15% annual interest with Nexo. Icon
Earn up to 15% annual interest with Nexo.

Access competitive interest rates on your digital assets.

Generate interest, borrow against your crypto, and trade a range of cryptocurrencies — all in one platform. Geographic restrictions, eligibility, and terms apply.
Get started with Nexo.
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Clay!

Additional Project Details

Registered

2025-08-13