Loading...
Loading...
Build native desktop apps in Go using Gova's declarative, component-based GUI framework with reactive state and platform-native integrations.
npx skill4agent add aradotso/trending-skills gova-declarative-guiSkill by ara.so — Daily 2026 Skills collection.
Scopego buildgo get github.com/nv404/gova@latestgo install github.com/nv404/gova/cmd/gova@latestbuild-essentiallibgl1-mesa-dev| Command | Purpose |
|---|---|
| Hot reload — watch |
| Compile to |
| Build and launch once, no file watching |
| Stripped binary (~23 MB for simple apps) |
Body(s *g.Scope) g.Viewpackage main
import g "github.com/nv404/gova"
type Greeting struct {
Name string // prop with zero-value default ""
}
func (c Greeting) Body(s *g.Scope) g.View {
name := c.Name
if name == "" {
name = "World"
}
return g.Text("Hello, " + name + "!").Font(g.Title)
}*g.ScopeBodyfunc (Counter) Body(s *g.Scope) g.View {
count := g.State(s, 0) // typed signal, initial value 0
return g.VStack(
g.Text(count.Format("Count: %d")).Font(g.Title),
g.HStack(
g.Button("-", func() { count.Set(count.Get() - 1) }),
g.Button("+", func() { count.Set(count.Get() + 1) }),
).Spacing(g.SpaceMD),
).Padding(g.SpaceLG)
}func main() {
g.Run("My App", g.Component(MyComponent{}))
}// Vertical stack
g.VStack(child1, child2, child3).Spacing(g.SpaceMD).Padding(g.SpaceLG)
// Horizontal stack
g.HStack(child1, child2).Spacing(g.SpaceSM)
// Layered/overlapping stack
g.ZStack(background, foreground)
// Scaffold (app shell with nav, toolbar, etc.)
g.Scaffold(
g.NavBar("Title"),
content,
)| Constant | Use |
|---|---|
| Small gaps |
| Medium gaps |
| Large padding |
g.Text("Hello").Font(g.Title) // styled text
g.Text("body text").Font(g.Body)
g.Button("Click me", func() { /* handler */ })
g.TextField(value.Get(), func(s string) { value.Set(s) })
g.Toggle(enabled.Get(), func(b bool) { enabled.Set(b) })
g.Image("path/to/image.png")
g.Spacer() // flexible space
g.Divider()g.Titleg.Headlineg.Bodyg.Captiong.Monocount := g.State(s, 0)
count.Get() // read
count.Set(42) // write, triggers re-render
count.Format("Value: %d") // returns formatted string signaldoubled := g.Derived(s, func() int {
return count.Get() * 2
})g.Effect(s, func() {
fmt.Println("count changed to", count.Get())
}, count) // dependenciesname := g.PersistedState(s, "user-name", "")package main
import g "github.com/nv404/gova"
type Todo struct {
Text string
Done bool
}
type TodoApp struct{}
func (TodoApp) Body(s *g.Scope) g.View {
todos := g.State(s, []Todo{})
input := g.State(s, "")
addTodo := func() {
if input.Get() == "" {
return
}
todos.Set(append(todos.Get(), Todo{Text: input.Get()}))
input.Set("")
}
rows := make([]g.View, 0, len(todos.Get()))
for i, todo := range todos.Get() {
i, todo := i, todo // capture loop vars
rows = append(rows, g.HStack(
g.Toggle(todo.Done, func(v bool) {
list := todos.Get()
list[i].Done = v
todos.Set(list)
}),
g.Text(todo.Text),
).Spacing(g.SpaceSM))
}
return g.VStack(
g.Text("Todos").Font(g.Title),
g.VStack(rows...).Spacing(g.SpaceSM),
g.HStack(
g.TextField(input.Get(), func(v string) { input.Set(v) }),
g.Button("Add", addTodo),
).Spacing(g.SpaceSM),
).Padding(g.SpaceLG)
}
func main() {
g.Run("Todo", g.Component(TodoApp{}))
}// Alert dialog
g.Button("Alert", func() {
g.Alert(g.AlertOptions{
Title: "Warning",
Message: "Something happened.",
Style: g.AlertWarning,
})
})
// Open file dialog
g.Button("Open File", func() {
path, err := g.OpenFileDialog(g.OpenFileOptions{
Title: "Choose a file",
Extensions: []string{".txt", ".md"},
})
if err == nil && path != "" {
filePath.Set(path)
}
})
// Save file dialog
g.Button("Save", func() {
dest, err := g.SaveFileDialog(g.SaveFileOptions{
Title: "Save As",
DefaultFilename: "output.txt",
})
if err == nil && dest != "" {
// write to dest
}
})// Dock badge (macOS)
g.DockBadge("3")
g.DockBadge("") // clear badge
// Dock progress (macOS)
g.DockProgress(0.75) // 0.0–1.0
g.DockProgress(-1) // hide
// Dock menu (macOS)
g.SetDockMenu([]g.MenuItem{
{Label: "New Window", Action: func() { /* ... */ }},
{Label: "Preferences", Action: func() { /* ... */ }},
})// Dark/light toggle
g.Button("Toggle Theme", func() {
if g.CurrentTheme() == g.ThemeDark {
g.SetTheme(g.ThemeLight)
} else {
g.SetTheme(g.ThemeDark)
}
})
// Semantic colors in custom views
g.Text("Primary").Color(g.ColorPrimary)
g.Text("Secondary").Color(g.ColorSecondary)
g.Text("Danger").Color(g.ColorDanger)type Card struct {
Title string
Content g.View
}
func (c Card) Body(s *g.Scope) g.View {
return g.VStack(
g.Text(c.Title).Font(g.Headline),
g.Divider(),
c.Content,
).Padding(g.SpaceMD)
}
// Usage
g.Component(Card{
Title: "My Card",
Content: g.Text("Card body text"),
})type NotesApp struct{}
func (NotesApp) Body(s *g.Scope) g.View {
selected := g.State(s, "list")
switch selected.Get() {
case "detail":
return g.Component(DetailView{OnBack: func() { selected.Set("list") }})
default:
return g.Component(ListView{OnSelect: func() { selected.Set("detail") }})
}
}func main() {
app := g.NewApp("My App")
app.SetIcon("assets/icon.png") // set before Run
app.Run(g.Component(MyComponent{}))
}gova devg.PersistedStatefunc (MyApp) Body(s *g.Scope) g.View {
// survives hot reload, lost on full restart
activeTab := g.PersistedState(s, "active-tab", "home")
// ...
}myapp/
├── main.go # g.Run entry point
├── components/
│ ├── header.go
│ └── sidebar.go
├── views/
│ ├── home.go
│ └── settings.go
├── assets/
│ └── icon.png
└── go.mod| Feature | macOS | Windows | Linux |
|---|---|---|---|
| Core UI | ✅ | ✅ | ✅ |
| Hot reload | ✅ | ✅ | ✅ |
| App icon | ✅ | ✅ | ✅ |
| Native dialogs | NSAlert/NSOpenPanel | Fyne fallback | Fyne fallback |
| Dock/taskbar | NSDockTile ✅ | Planned | Planned |
cgo: C compiler not foundxcode-select --installsudo apt install build-essential libgl1-mesa-devgo buildsudo apt install libgl1-mesa-dev xorg-devgova devgo run.gogova dev ./pathgo build -ldflags "-s -w" -o ./bin/myappcount.Set(...)Setlist := todos.Get(); list[i] = newVal; todos.Set(list)go get github.com/nv404/gova@v0.x.y