-
-
Notifications
You must be signed in to change notification settings - Fork 369
Home
Maxence Charriere edited this page Dec 6, 2016
·
37 revisions
Package to build multiplatform apps with Go, HTML and CSS.
A component is a struct that represents a graphic element. It implements the app.Componer interface.
type Componer interface {
Render() string
}
The Render method returns an HTML markup that describes the graphic interface. Components are displayed by being mounted into contexts.
See how to implement a component.
Contexts are application elements which display graphical user interface. They can be a window, a menu, a dock, etc...
They implement the interface app.Contexter which defines their available interactions.
// Component.
type Hello struct {
}
func (h *Hello) Render() string {
return `<div>Hello World</div>`
}
// Create a window and mounts the Hello Component.
func main() {
app.OnLaunch = func() {
win := app.NewWindow(app.Window{
Title: "Hello World",
Width: 1280,
Height: 720,
})
hello := &Hello{}
win.Mount(hello)
}
app.Run()
}