ziex/test/data/component/basic.zig
2025-12-21 21:47:25 +06:00

29 lines
677 B
Zig

pub fn Page(allocator: zx.Allocator) zx.Component {
var _zx = zx.allocInit(allocator);
return _zx.ele(
.main,
.{
.allocator = allocator,
.children = &.{
_zx.cmp(Button, .{ .title = "Custom Button" }),
},
},
);
}
const ButtonProps = struct { title: []const u8 };
pub fn Button(allocator: zx.Allocator, props: ButtonProps) zx.Component {
var _zx = zx.allocInit(allocator);
return _zx.ele(
.button,
.{
.allocator = allocator,
.children = &.{
_zx.expr(props.title),
},
},
);
}
const zx = @import("zx");