Compare commits

..

2 Commits

Author SHA1 Message Date
df53fb0d8d more todos 2026-01-16 16:58:45 +13:00
6d5aafb78d added react like componets example 2026-01-16 16:58:36 +13:00
2 changed files with 42 additions and 1 deletions

View File

@@ -115,6 +115,46 @@ and finally free the arena with a retained_capacity as the ui will more then lik
_ = al.reset(.retain_capacity); _ = al.reset(.retain_capacity);
``` ```
## react like componets:
you can also create react like componets by creating functions blocks that return a Node, please note that this function is inlined, this is required as children from this node will be shared between all compoents that use this node.
```zig
inline fn button() UI.Node {
return UI.ElementWborder(
.{
.bottom = 2,
.left = 2,
.right = 2,
.top = 2,
},
.{
.b = 30,
},
.{
.name = "button",
.rect = .{
.h = 20,
.w = 60,
},
.on_click = .{
.func = &updateButton,
.data = &.{},
},
.on_hover = .{
.func = &hoverButton,
.data = &.{},
},
.style = .{
.background_colour = .{
.g = 255,
},
.rounded = 25,
},
},
);
}
```
## adding shoots to your project ## adding shoots to your project
fetch the repo fetch the repo

View File

@@ -5,4 +5,5 @@
- rem - rem
- percentage - percentage
- [ ] allow text rendering to support new lines - [ ] allow text rendering to support new lines
- [ ] possibly allow a more dearimgui approch to rendering - [ ] possibly allow a more dearimgui approch to rendering
- [ ] min and max width