Live data from Hacker News

Clay – UI Layout Library

nicbarker.com

71–80 of 95 posts

Re: Clay – UI Layout Library

#73

I'm not a frontend person. Can anyone explain why this is better than using CSS directly or a CSS framework/library? Seems like added complexity when there are already hundreds of CSS frameworks available that seem like they do the same thing.

This isn't really meant to replace such things an environment where you have a rendering engine that supports CSS— I think demoing it on the page is more for showing off how portable it is with WASM. Off the top of my head, a few uses for this:

- Mapping components or structured document data with something like MDX or slate on to Clay components to render in different contexts outside the browser reasonably closely to what shows up in a browser preview, for example content for HUDs, in-world display panels or documents in games, or batch rendering printed documents

- Layout for UI where something like Electron or React Native would be overkill, or isn't supported

Re: Clay – UI Layout Library

#74
post #2

Looks very nice, I just watch a great YT video from the developer here https://www.youtube.com/watch?v=DYWTw19_8r4

It's so rare to see such a clear and intuitive explanation. This video is amazing.

This. It is a rare and unique thing for the author to a) have the skills to put together such a presentation and b) take the time to do so. Thankyou.

Re: Clay – UI Layout Library

#75
Would be fun to combine this with the single-file Impeller header from the Flutter people.

The API approach could be implemented extremely cleanly in Clojure and Java, and then the whole thing would be runtime-dynamic, since Clojure generates new Java functions on the fly, and the JVM's JIT makes them fast.

If anyone wants a fun project over the holidays…

Re: Clay – UI Layout Library

#76
post #54

Earlier quoted context omitted.

The thing is, most GUIs by necessity involve fairly deep hierarchies of graphical objects so you're either going to have deeply nested calls like this, or you're going to scatter the fragments across a number of files in a way that they need to be reassembled in the reader's head in order to understand what's going on.

most GUIs by necessity involve fairly deep hierarchies of graphical objects First, this isn't really true. You might typically have a window, a container, a layout object and then your gui components. Second you don't need nested calls, you just add one component to another. or you're going to scatter the fragments across a number of files Why would that be true? they need to be reassembled in the reader's head in or…

[deleted]

Re: Clay – UI Layout Library

#77
post #48

Looks impressive! What are the connection/comparison with imgui though?

Both use immediate mode rendering. Both have the “single header” design. There doesn’t appear to be any shared implementation.

The examples use Raylib as a renderer behind the layout engine. I suppose it would be possible to use Dear Imgui as a renderer, but you might have to write some glue code.

Re: Clay – UI Layout Library

#78

I'm not a frontend person. Can anyone explain why this is better than using CSS directly or a CSS framework/library? Seems like added complexity when there are already hundreds of CSS frameworks available that seem like they do the same thing.

This UI library can be re-targeted to Raylib, Canvas, HTML from its markup ... Good luck doing that with just CSS.

Put another way, this library is a step into writing an agnostic UI layer for your application which it just invokes from its business logic. If you can decouple your UI from your application code ala MVC or MVP architecture, as a developer you can find the right tool for the components that compose the sum of your project.

Re: Clay – UI Layout Library

#80
post #74

Earlier quoted context omitted.

It's so rare to see such a clear and intuitive explanation. This video is amazing.

This. It is a rare and unique thing for the author to a) have the skills to put together such a presentation and b) take the time to do so. Thankyou.

[deleted]
Post reply on HN