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
Custom VMs From 1 to 96 vCPUs With 99.95% Uptime Icon
Custom VMs From 1 to 96 vCPUs With 99.95% Uptime

General-purpose, compute-optimized, or GPU/TPU-accelerated. Built to your exact specs.

Live migration and automatic failover keep workloads online through maintenance. One free e2-micro VM every month.
Try 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