Skip to content
aicoolies logo
Clay logo

Clay

High-performance 2D UI layout library in C

Clay is a high-performance 2D UI layout library written as a single C header file that implements a flexbox-like layout model with microsecond-level performance. It uses static arena-based memory allocation with no malloc or free calls, keeping total memory usage under 4MB for thousands of elements. Clay is renderer-agnostic, outputting sorted rendering primitives that work with any 3D engine, SDL, or can compile to HTML via WebAssembly.

About Clay

Clay is a minimalist yet powerful 2D UI layout library distributed as a single C header file that brings flexbox-style layout capabilities to performance-critical applications. The library processes layout calculations in microseconds using a custom algorithm that handles complex responsive layouts including text wrapping, scrolling containers, aspect ratio scaling, and nested flex containers without any dynamic memory allocation or external dependencies.

The design philosophy centers on zero-overhead abstraction: Clay uses static arena-based memory management that preallocates a fixed buffer and performs no heap allocation during layout computation. This makes it deterministic and suitable for embedded systems, game engines, and real-time applications where memory fragmentation and allocation latency are unacceptable. The API uses C macros to build UI hierarchies declaratively with modular configuration of layout properties, colors, borders, and corner radii.

Clay has rapidly gained attention in the systems programming community with over 17,000 GitHub stars since its release, appealing to developers building custom renderers and UI frameworks. The library is renderer-agnostic, outputting a sorted array of drawing primitives that can be composited with OpenGL, Vulkan, SDL, Raylib, or any graphics backend. A WebAssembly build enables browser-based usage, and the official website itself is built and rendered entirely using Clay as a demonstration of its capabilities.

Pricing & Platform Specs

Pricing Summary

Clay (nicbarker/clay) is a 100% free and open-source high-performance 2D UI layout library in C licensed under the MIT license. It has no paid tiers, commercial subscriptions, or licensing fees.

Supported Platforms

Cross-platform: C header, Wasm, any renderer

Explore categories, tags & use cases

Alternatives

All Clay alternatives →

Production-ready React Suspense and error handling

TypeScript library extending React Suspense API with declarative components and hooks for production applications. Provides ErrorBoundary with selective error catching via shouldCatch, SSR-safe Suspense with clientOnly prop, Delay component preventing loading flashes, ErrorBoundaryGroup for coordinated resets, and data fetching components including SuspenseQuery and SuspenseInfiniteQuery. MIT licensed by Toss with three years of active development.

Open Source

Markdown WYSIWYG editor with live preview

TOAST UI Editor is a full-featured Markdown and WYSIWYG editor by NHN that supports GFM standard syntax with extensible chart and UML rendering. It offers dual editing modes with seamless switching, live preview with scroll sync, syntax highlighting, and a plugin architecture for adding color pickers, table merging, code highlighting, and diagram support. The editor ships with React, Vue, and vanilla JavaScript wrappers and supports 20+ languages.

Open Source

Community experience

Sources & verification

Sources checked
Content verified

Verification dates are editorial checks. Routine CMS saves and automatic updatedAt timestamps do not advance them.

FAQ

What is Clay?

Clay is a high-performance 2D UI layout library written as a single C header file that implements a flexbox-like layout model with microsecond-level performance. It uses static arena-based memory allocation with no malloc or free calls, keeping total memory usage under 4MB for thousands of elements. Clay is renderer-agnostic, outputting sorted rendering primitives that work with any 3D engine, SDL, or can compile to HTML via WebAssembly.

Is Clay free?

Yes — Clay is open source and free to use. Clay (nicbarker/clay) is a 100% free and open-source high-performance 2D UI layout library in C licensed under the MIT license. It has no paid tiers, commercial subscriptions, or licensing fees.

Is Clay open source?

Yes — Clay is open source.

Is Clay still maintained?

Yes — Clay is active. Its listing was last verified on August 26, 2026.

What are the best Clay alternatives?

The first editor-selected Clay alternatives are Suspensive, TOAST UI Editor.