https://github.com/goui-org/goui
An experimental web framework for creating user interfaces
https://github.com/goui-org/goui
golang ui web-framework
Last synced: 2 months ago
JSON representation
An experimental web framework for creating user interfaces
- Host: GitHub
- URL: https://github.com/goui-org/goui
- Owner: goui-org
- Created: 2023-05-02T20:47:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-30T21:37:25.000Z (over 1 year ago)
- Last Synced: 2025-08-09T21:43:14.376Z (2 months ago)
- Topics: golang, ui, web-framework
- Language: Go
- Homepage:
- Size: 77.1 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-tinygo - GoUI - A web framework for making user interfaces (WebAssembly / DOM Manipulation)
README
# GoUI
An experimental web framework for creating user interfaces.## GoUIX
Install `gouix`, a cli tool for GoUI.```
go install github.com/goui-org/gouix@latest
```Create a new app
```
gouix create my-app
```Start the development server
```
gouix serve
```Create a production build
```
gouix build
```## Usage
```go
// main.go
package mainimport (
"github.com/goui-org/goui"
"main/app"
)func main() {
goui.Mount("#root", app.App)
}
``````go
// app/app.go
package appimport (
"strconv""github.com/goui-org/goui"
)func App(goui.NoProps) *goui.Node {
count, setCount := goui.UseState(0)goui.UseEffect(func() goui.EffectTeardown {
goui.Log("count is %d", count)
return nil
}, goui.Deps{count})handleIncrement := goui.UseCallback(func(e *goui.MouseEvent) {
setCount(func(c int) int { return c + 1 })
}, goui.Deps{})return goui.Element("div", &goui.Attributes{
Class: "app",
Slot: []*goui.Node{
goui.Element("button", &goui.Attributes{
Class: "app-btn",
Slot: "increment",
OnClick: handleIncrement,
}),
goui.Element("p", &goui.Attributes{
Slot: "count: " + strconv.Itoa(count),
}),
},
})
}
```