# nicbarker/clay

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/nicbarker-clay).**

17,443 stars · 687 forks · C · Zlib

## Links

- GitHub: https://github.com/nicbarker/clay
- Homepage: https://nicbarker.com/clay
- awesome-repositories: https://awesome-repositories.com/repository/nicbarker-clay.md

## Topics

`layout` `ui`

## Description

Clay is a header-only layout engine designed for C and C++ applications that computes element positions and dimensions using a declarative box model. By operating as an immediate-mode framework, it calculates interface geometry dynamically on every frame, allowing for the creation of responsive and fluid user interfaces without maintaining persistent state.

The library functions as a platform-agnostic tool that decouples layout logic from specific graphics backends. It provides a flexible coordinate system that supports layered elements, such as modals and tooltips, alongside standard document flow. This abstraction allows developers to integrate the engine into any rendering environment while maintaining consistent visual scaling across different display configurations.

The engine includes built-in support for interactive features, including pointer input tracking, scrollable containers, and state-driven layout interpolation for smooth visual transitions. It also provides diagnostic tools to visualize element boundaries and hierarchies during development. The entire implementation is distributed as a single header file to facilitate integration into existing projects.

## Tags

### Development Tools & Productivity

- [C++ Rendering Libraries](https://awesome-repositories.com/f/development-tools-productivity/header-only-libraries/c-rendering-libraries.md) — A header-only library for calculating element positions and dimensions using a declarative box model in C and C++ applications.

### User Interface & Experience

- [Immediate Mode UI Libraries](https://awesome-repositories.com/f/user-interface-experience/component-utilities/ui-frameworks/rendering-models/immediate-mode-ui-libraries.md) — A framework for building graphical interfaces that computes layout structures dynamically to support fluid transitions and interactive elements.
- [Immediate Mode UI Frameworks](https://awesome-repositories.com/f/user-interface-experience/immediate-mode-ui-frameworks.md) — Calculates interface geometry dynamically on every frame without maintaining persistent UI state.
- [C Language Toolkits](https://awesome-repositories.com/f/user-interface-experience/c-gui-toolkits/c-language-toolkits.md) — Provides a lightweight, header-only layout engine for building custom graphical user interfaces in C and C++.
- [Element Positioning](https://awesome-repositories.com/f/user-interface-experience/element-positioning.md) — Computes two-dimensional positions and dimensions for interface elements using a flexible box model. ([source](https://cdn.jsdelivr.net/gh/nicbarker/clay@main/README.md))
- [Cross-Platform Rendering Frameworks](https://awesome-repositories.com/f/user-interface-experience/layout-utilities/presentation-engines/cross-platform-rendering-frameworks.md) — Creates platform-agnostic interface layouts that integrate with any graphics backend or windowing system.
- [Declarative Layout Frameworks](https://awesome-repositories.com/f/user-interface-experience/declarative-layout-frameworks.md) — Defines complex user interface structures using a declarative approach to automatically calculate layout behavior.
- [Floating Element Positioning](https://awesome-repositories.com/f/user-interface-experience/floating-element-positioning.md) — Calculates coordinate offsets for floating elements like modals and tooltips to position them outside the standard document flow. ([source](https://cdn.jsdelivr.net/gh/nicbarker/clay@main/README.md))
- [Layout Interpolators](https://awesome-repositories.com/f/user-interface-experience/animation-and-motion-systems/configuration-utility-helpers/animation-configuration/frame-execution-synchronization/animation-frame-rate-controls/frame-interpolation-engines/layout-interpolators.md) — Tracks property changes between frames to calculate intermediate values for fluid visual transitions.
- [Layout Transition Libraries](https://awesome-repositories.com/f/user-interface-experience/layout-transition-libraries.md) — Smoothly transitions visual styles and layout properties between states to create fluid motion effects. ([source](https://cdn.jsdelivr.net/gh/nicbarker/clay@main/README.md))
- [Coordinate Systems](https://awesome-repositories.com/f/user-interface-experience/coordinate-systems.md) — Manages element depth and floating components using explicit Z-index values for layered UI overlays.
- [Interaction and Event Handling](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling.md) — Implements scrollable areas, floating modals, and pointer-based input handling for responsive application interfaces.
- [Scrollable Containers](https://awesome-repositories.com/f/user-interface-experience/scrollable-containers.md) — Clips overflowing content and updates child offsets to create scrollable areas for large information sets. ([source](https://cdn.jsdelivr.net/gh/nicbarker/clay@main/README.md))

### Graphics & Multimedia

- [Cross-Platform Graphics Tooling](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/graphics-apis-bindings/cross-platform-graphics-tooling.md) — A platform-agnostic layout system that integrates with various graphics backends to facilitate custom user interface development.
- [Backend-Agnostic Rendering Pipelines](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/engines/graphics-pipeline-architectures/backend-agnostic-rendering-pipelines.md) — Decouples layout logic from specific graphics APIs by providing raw coordinate data for external rendering backends.

### Web Development

- [CSS Box Model Renderers](https://awesome-repositories.com/f/web-development/dom-to-canvas-renderers/css-box-model-renderers.md) — Calculates element dimensions, padding, and alignment using a declarative box model for consistent interface scaling.
