Stream: show and tell

Topic: Terrocotta


view this post on Zulip Romain Lepert (Aug 02 2026 at 00:15):

Hi everyone,

I'd like to share with you Terrocotta: a Roc native UI library.
I have been working on it for the past +1month and I think is in a good enough shape to share.

At its core terrocotta is a port of Clay to pure Roc, rendered using roc-ray. It is as faithful to the original implementation as possible and adds some niceties on top: MVU, event bindings, text style inheritance, etc.

The demo examples currently run at 300-600 fps (terrocotta: roc build --opt=speed, roc-ray: zig build -Doptimize=ReleaseFast) but there is probably quite some room for improvement since Clay advertises 10_000 fps.

I hope that it can help the UI effort to some extent. For those interested, I recommend reading the docs/architecture.md for internal explanations.

I also sometimes dump some Roc experience feedback to #24

view this post on Zulip Luke Boswell (Aug 02 2026 at 01:04):

Wow, looks great!

Screenshot 2026-08-02 at 11.04.16.png

view this post on Zulip Luke Boswell (Aug 02 2026 at 01:04):

I guess I need to make a roc-ray release with an optimized host :sweat_smile:

view this post on Zulip Luke Boswell (Aug 02 2026 at 01:25):

Luke Boswell said:

I guess I need to make a roc-ray release with an optimized host :sweat_smile:

Here's a fresh release https://github.com/lukewilliamboswell/roc-ray/releases/tag/0.8.2

view this post on Zulip blu (Aug 02 2026 at 01:41):

Does this build to both native and web? How might you compare/contrast this with something like iced? Big fan of these "write once, run anywhere" libraries esp. Elm-inspired, and I've been looking for a good roc library for this, but roc-iced seems to be only old roc compiler and unmaintained. If it supports web/wasm, I'll give Terracotta a shot!

view this post on Zulip blu (Aug 02 2026 at 01:43):

Btw the code examples you have are so much easier to understand than the original Clay ones. Elm-architecture + Multiplatform + functional/no runtime panic guarantees should be the future IMO. Good stuff!

view this post on Zulip blu (Aug 02 2026 at 01:46):

@Luke Boswell I looked into this the other day and pretty sure that roc-ray doesn't yet compile to WASM/web, though raylib itself can? Which I assume means it just hasn't been implemented yet. Was wondering if that was on the roadmap or if I'm thinking about that correctly?

view this post on Zulip Luke Boswell (Aug 02 2026 at 01:48):

It used to target web too, but I deleted all that when I migrated to the new compiler just to keep the scope simpler.

view this post on Zulip Luke Boswell (Aug 02 2026 at 01:49):

If anyone is interested in adding that I'd love it ... but it's not something I'm working on or anything

view this post on Zulip Luke Boswell (Aug 02 2026 at 01:56):

Luke Boswell said:

Luke Boswell said:

I guess I need to make a roc-ray release with an optimized host :sweat_smile:

Here's a fresh release https://github.com/lukewilliamboswell/roc-ray/releases/tag/0.8.2

Something went wrong and the host is still the debug version... I'm looking into it

view this post on Zulip Luke Boswell (Aug 02 2026 at 02:24):

Ok here's a better fix ... from 40 up to 900 frames per second

https://github.com/lukewilliamboswell/roc-ray/releases/tag/0.8.3

Screenshot 2026-08-02 at 12.24.13.png

view this post on Zulip blu (Aug 02 2026 at 02:28):

If anyone is interested in adding that I'd love it ... but it's not something I'm working on or anything

I might look into this at some point. Write once, run anywhere UI story in a functional language is very compelling (and if I'm not mistaken one of the reasons Roc was created, feeling the limitations of Elm to be only web, right?). I guess this is sort of the inverse

view this post on Zulip Luke Boswell (Aug 02 2026 at 02:44):

Also -- heres a PR that fixes the ARC bug and leaks in Roc these examples exposed https://github.com/roc-lang/roc/pull/10539

Thank you @Romain Lepert

view this post on Zulip Romain Lepert (Aug 02 2026 at 06:44):

As always you are quick on the draw Luke. Thank you !

view this post on Zulip Romain Lepert (Aug 02 2026 at 06:50):

blu said:

Does this build to both native and web? How might you compare/contrast this with something like iced? Big fan of these "write once, run anywhere" libraries esp. Elm-inspired, and I've been looking for a good roc library for this, but roc-iced seems to be only old roc compiler and unmaintained. If it supports web/wasm, I'll give Terracotta a shot!

It should be possible since the original clay has both a canvas renderer and a html/css renderer. Given the immediate mode nature only the canvas makes real sense but you lose the web accessibility, bot crawling, etc. The html/css renderer might only make sense for static websites maybe.

view this post on Zulip Anton (Aug 03 2026 at 12:49):

feeling the limitations of Elm to be only web

Yes indeed, although Roc was not made with a UI focus in mind as I remember.

view this post on Zulip Richard Feldman (Aug 03 2026 at 14:37):

yeah my feeling at the time was "I already have an Elm-like experience for Web UIs: Elm!" :smile:

that said, I do want something for native GUIs and I also appreciate that there's a lot of interest in having the same language on the server and on the client, including browser-based clients

view this post on Zulip Nicola 'tekNico' Larosa (Aug 05 2026 at 13:32):

Terracotta

Apparently the idea is:

Terracotta + Roc -> TerROCotta

view this post on Zulip blu (Aug 05 2026 at 22:40):

that said, I do want something for native GUIs and I also appreciate that there's a lot of interest in having the same language on the server and on the client, including browser-based clients

Totally fair, and thinking about this more maybe the HTML/JS/CSS trifecta vs. native UI architectures are just too conceptually different to unify cleanly. I guess I was just reading the iced philosophy and started dreaming of UItopia.

view this post on Zulip blu (Aug 05 2026 at 22:41):

And in that UItopia I'd rather write in a Roc-like friendly syntax than Rust :sweat_smile:

view this post on Zulip Romain Lepert (Aug 06 2026 at 15:11):

Contrary to immediate mode Terrocotta, iced.rs is retained mode. Nonetheless when targeting the web it uses WebGPU/WebGL, not HTML+DOM. That means it has the same restrictions as Terrocotta which hypothetically could do Canvas2D or WebGL or WebGPU.

view this post on Zulip Romain Lepert (Aug 06 2026 at 15:21):

By restrictions I mean things like: SEO, browser translation, printing, password managers, autofill. Things of that nature


Last updated: Aug 12 2026 at 12:35 UTC