Component children
Contract
Body content becomes default children when the component function’s props
struct includes Children []gx.Node:
package notices
import "github.com/busdk/bus-gx/pkg/gx"
type NoticeProps struct {
Children []gx.Node
}
func Notice(p NoticeProps) gx.Node {
return (
<section class="bus-notice">
{p.Children}
</section>
)
}
var noticeWithChildren = (
<Notice>
<span>Saved</span>
</Notice>
)
The compiler passes body nodes in source order. Body content fails lint when
the props type has no Children []gx.Node field. Rendering keeps child order,
deterministic attribute sorting, and text escaping.