{"full_name":"nicbarker/clay","owner":"nicbarker","name":"clay","shard":"1","url":"https://github.com/nicbarker/clay","description":"High performance UI layout library in C.","homepage":"https://nicbarker.com/clay","topics":["layout","ui"],"tag_pages":["layout","ui"],"language":"C","license":"Zlib","avatar":"https://avatars.githubusercontent.com/u/2264338?u=a90e8178ebcf2b9b50f94f94efd0b4986e3a4556&v=4","created_at":"2024-07-21T01:40:27Z","pushed_at":"2026-05-20T02:17:59Z","metrics":{"stars":18418,"forks":748,"watchers":102,"issues":337,"prs":324,"releases":5,"issues_open":193,"issues_closed":144,"prs_open":94,"prs_closed":38,"prs_merged":192,"discussions":0},"growth":{"day":{"stars":1,"forks":0,"base_day":"2026-11-15"}},"history":{"dates":["2026-11-10","2026-11-11","2026-11-12","2026-11-13","2026-11-14","2026-11-15","2026-11-16"],"stars":[18400,18405,18407,18408,18412,18417,18418],"forks":[746,748,748,748,748,748,748],"watchers":[null,102,102,102,102,102,102],"issues_open":[null,193,193,193,193,193,193],"prs_open":[null,94,94,94,94,94,94]},"boards":{},"same_owner":[],"issues":[{"number":223,"title":"[Renderer/raylib] make the renderer a header file","comments":23,"created_at":"2025-01-25T01:17:45Z"},{"number":217,"title":"[Examples/clay-official-website] nicbarker.com/clay crashes in debug mode in Chrome & Edge","comments":14,"created_at":"2025-01-21T07:55:47Z"},{"number":276,"title":"CLAY_ID uniqueness","comments":13,"created_at":"2025-02-19T06:52:06Z"},{"number":225,"title":"[Core] Text measure cache assumes that strings are immutable (and can return stale values)","comments":12,"created_at":"2025-01-25T22:38:50Z"},{"number":468,"title":"[Core] Clay__HashData SIMD version bug","comments":9,"created_at":"2025-07-20T11:01:25Z"},{"number":355,"title":"[Compilers] Make Clay compile with `-Wall -Werror -Wextra -pedantic` projects.","comments":9,"created_at":"2025-03-27T04:42:36Z"},{"number":129,"title":"[Components] Text Edit component?","comments":9,"created_at":"2024-12-29T21:00:02Z"},{"number":128,"title":"[Renderers/Raylib] Remove allocations from raylib text rendering","comments":9,"created_at":"2024-12-29T17:51:36Z"}],"discussions":[],"latest_release":{"name":"0.14 - Aspect Ratio Elements, Better Clipping","tag":"v0.14","published_at":"2025-06-06T01:16:01Z","body":"## New Features\r\n\r\n### Non-image aspect ratio scaling elements, image stretching\r\n\r\nPreviously, only image elements supported aspect ratio scaling. The new `.aspectRatio` element configuration option allows you to specify a fixed width / height aspect ratio for any element. This also allows you to create image elements with no specified aspect ratio, allowing for stretched / distorted images with a different aspect ratio to their source dimensions. Different images rendering modes similar to the CSS concepts of `contain` and `cover`, as well as 9-slice support are scheduled for 0.15.\r\n\r\n```C\r\n// Old\r\nCLAY({\r\n  .image = { .imageData = &myImage, .sourceDimensions = { 1024, 768 } }\r\n});\r\n\r\n// New\r\nCLAY({\r\n  .aspectRatio = 1024.0 / 768.0,\r\n  .image = { .imageData = &myImage }\r\n});\r\n```\r\n\r\n### Improved .clip configuration option replaces .scroll\r\n\r\nAs part of our longer term effort to [separate interaction handling from the core layout library](https://github.com/nicbarker/clay/issues/231), the `.scroll` configuration option has been replace with `.clip`. This new configuration options allows:\r\n- Cllipping of elements without enabling scrolling, similar to CSS's `overflow:hidden`\r\n- Immediate mode scroll handling, by providing scroll offset directly to `.clip.childOffset`.\r\n\r\nTo use Clay's internal scroll handling (i.e. emulate the old `.scroll behaviour`, you can use the new function, [Clay_GetScrollOffset](https://github.com/nicbarker/clay?tab=readme-ov-file#clay_getscrolloffset) function.\r\n\r\n```C\r\n// Old\r\nCLAY({\r\n  .scroll = { .vertical = true } // scrolling was automatically handled internally\r\n});\r\n\r\n// New, using clay's built in scroll handling\r\nCLAY({\r\n  .clip = {\r\n    .vertical = true,\r\n    .childOffset = Clay_GetScrollOffset() // This function is context dependent and will automatically track scrolling for this element across frames\r\n  }\r\n});\r\n\r\n// New, providing your own scroll handling\r\nClay_Vector2 scrollOffset = { 0, 120 };\r\n\r\nCLAY({\r\n  .clip = {\r\n    .vertical = true,\r\n    .childOffset = scrollOffset // This will offset all children by the provided Vector2 this frame, so scrolling can be handled externally\r\n  }\r\n});\r\n\r\n// New, clipping overflow without enabling scrolling\r\nCLAY({\r\n  .clip = { .vertical = true }\r\n});\r\n```\r\n\r\n### New Renderers\r\n\r\nWe now have a simple ANSI terminal renderer (thanks to @EmmanuelMess), a Playdate renderer (thanks to @mattahj), a Windows GDI renderer (thanks to @hexmaster111), and a Sokol renderer (thanks to @nkorth). All of them look great!\r\n\r\n![image](https://github.com/user-attachments/assets/87b7f344-acc6-4cd3-9411-db4d0d92dd18)\r\n_Terminal Renderer_\r\n\r\n\r\nhttps://github.com/user-attachments/assets/a1819a24-cb57-4792-81d8-7929f9cc1b80\r\n\r\n_Playdate Renderer_\r\n\r\n![image](https://github.com/user-attachments/assets/863da597-df97-49b1-a982-b65c83fccaad)\r\n_Windows GDI renderer_\r\n\r\n### Small Changes\r\n\r\n- Hashing of text contents for the text measurement cache is now the default behaviour, and has a reasonably performant SIMD implementation both for x64 and ARM. Using a frame arena or scratch storage for text element strings should now work much more reliably.\r\n- Layout calculations for some GROW edge cases, as well as aspect ratio scaling, have been improved.\r\n- A new function, [Clay_GetPointerOverIds](https://github.com/nicbarker/clay?tab=readme-ov-file#clay_getpointerids) is now available, which will return a z-sorted list of IDs of elements that the cursor is currently over.\r\n\r\n## Migration Guide\r\n\r\n1. Convert any `.scroll` configuration usage into `.clip`, and add `.childOffset = Clay_GetScrollOffset()` to emulate existing behaviour\r\n\r\n```diff\r\nCLAY({\r\n-  .scroll = {\r\n+  .clip = {\r\n    .vertical = true,\r\n+  .childOffset = Clay_GetScrollOffset()\r\n  }\r\n})\r\n```\r\n\r\n2. Split any `.image` configuration into `.image` and `.aspectRatio`\r\n\r\n```diff\r\nCLAY({\r\n  .image = {\r\n    .imageData = &myImage,\r\n-   .sourceDimensions = { 1024, 768 }\r\n  },\r\n+ .aspectRatio = { 1024.0 / 768.0 }\r\n})\r\n```\r\n\r\n3. Remove a","is_prerelease":false},"readme":true,"readme_zh":false,"news":[],"stale":false,"snapshot_at":"2026-11-16T09:23:14Z","history_start":"2026-09-06"}