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.ClickEventButton and control activation.
gx.SubmitEventForm submit payloads.
gx.InputEventText input and change payloads.
gx.FileInputEventFile input payload metadata.
gx.DragEventDrag 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.