GX Framework
Events
GX event props are Go functions. Static HTML omits them, while runtime hosts keep the typed callback in the render tree and attach the matching payload when the event fires.
Common payloads
gx.ClickEvent | Button and control activation. |
|---|---|
gx.SubmitEvent | Form submit payloads. |
gx.InputEvent | Text input and change payloads. |
gx.FileInputEvent | File input payload metadata. |
gx.DragEvent | Drag and drop payload metadata. |
Use callbacks with real component code
type SaveProps struct {
OnSubmit func(gx.SubmitEvent) gx.Result
}
func SaveForm(props SaveProps) gx.Node {
return gx.Element("form", gx.Props{"onSubmit": props.OnSubmit},
gx.Element("button", gx.Props{"type": "submit"}, gx.Text("Save")),
)
}
See also Runtime mounting and Testing.