A high-performance 2D UI layout library in C, featuring flex-box layout model, single-header, zero dependencies, Wasm support, microsecond layout performance, and renderer-agnostic output.
- v0.14
- Published at
- Jun 6, 2025
- 18,215
- Stars
- 1,021
- Download
- Synced at
- Oct 4, 2026
Latest release
v0.14Jun 6, 2025, 01:16 AMDownloads slow? Switch the source anytime above
README
Project Overview
Clay (short for C Layout) is a high-performance 2D UI layout library using a flex-box layout model for complex, responsive layouts including text wrapping, scrolling containers, and aspect ratio scaling. It is a single-header file (~4.8k LOC) with zero dependencies (no standard library linking), supports Wasm compilation, and uses static arena-based memory with no malloc/free.
Key Features
- Microsecond layout performance
- Flex-box layout model: Supports complex, responsive layouts including text wrapping, scrolling containers, and aspect ratio scaling
- Transition API: Easy layout animations
- Single-header: ~4.8k LOC clay.h with zero dependencies
- Wasm support: Compiles to ~15kb .wasm for browser usage
- Static memory management: Arena-based, no malloc/free, low memory overhead
- Declarative syntax: React-like nested declarative syntax
- Renderer agnostic: Outputs sorted rendering primitives composable in any 3D engine
Target Audience
- C/C++ developers needing high-performance UI layout
- Developers building embedded UI, game UI, or browser apps (via Wasm)
- Users seeking lightweight, dependency-minimal UI layout solutions
Quick Start
- Download or clone clay.h
- Define
CLAY_IMPLEMENTATIONbefore including clay.h in one file - Implement text measurement and error handling functions
- Initialize Clay and configure the memory arena
- Build UI layouts using declarative syntax
Core Advantages
- Single-header, zero dependencies for easy integration
- Microsecond layout performance for high-performance scenarios
- Wasm support for browser deployment
- Renderer-agnostic for any rendering backend
System Requirements
- OS: Cross-platform (C environment)
Release history
Sort