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

You Might Also Like
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
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