Fyne โ Cross-Platform GUI Toolkit for Go
Last reviewed: 2026-05-29
Fyne is an open-source, cross-platform GUI toolkit for the Go programming language. It's designed to make it easy to create beautiful, native-looking graphical applications for desktop (Windows, macOS, Linux) and mobile (Android, iOS) using a single codebase.
Overview
Fyne stands out among Go GUI toolkits because it's:
- Pure Go โ No C/C++ bindings, no system UI frameworks required
- Hardware-accelerated โ Uses OpenGL (via go-gl) for rendering
- Material Design โ Modern flat UI by default
- Cross-platform โ Same code runs on desktop and mobile
- Themeable โ Light/dark themes, custom styling
- Internationalized โ Built-in i18n support
Training Content
- Installation:
go get fyne.io/fyne/v2 - Hello World application structure
- Common widgets (button, label, entry, list, table)
- Layout containers (VBox, HBox, GridWrap, Border)
- Window management and lifecycle
Hello World
package main
import (
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("Hello Fyne")
w.SetContent(widget.NewLabel("Hello World!"))
w.ShowAndRun()
}
Core Widgets
| Widget | Description |
|---|---|
widget.Label |
Text display |
widget.Button |
Clickable button |
widget.Entry |
Text input field |
widget.Check |
Checkbox |
widget.RadioGroup |
Radio button group |
widget.Select |
Dropdown selector |
widget.Slider |
Slider for numeric input |
widget.ProgressBar |
Progress indicator |
widget.List |
Scrollable list |
widget.Table |
Grid table |
widget.Tree |
Hierarchical tree view |
Layout Containers
| Container | Behavior |
|---|---|
container.NewVBox() |
Vertical stack |
container.NewHBox() |
Horizontal stack |
container.NewGridWrap(cols) |
Grid with wrapped items |
container.NewBorder(top, bottom, left, right, center) |
Border layout |
layout.NewGridLayout(cols) |
Uniform grid |
layout.NewCenterLayout() |
Center content |
layout.NewMaxLayout() |
Fill available space |
Key Concepts
App Lifecycle
app.New()โ Create the application instancea.NewWindow(title)โ Create a windoww.SetContent(widget)โ Set the root contentw.ShowAndRun()โ Display window and start event loop
Data Binding
Fyne supports data binding for reactive UI updates:
name := binding.NewString()
name.Set("John")
entry := widget.NewEntryWithData(name)
label := widget.NewLabelWithData(name)
// Changes to entry automatically update the label
Canvas & Custom Drawing
For custom graphics, Fyne provides a canvas API:
- canvas.NewLine(color) โ Draw lines
- canvas.NewCircle(color) โ Draw circles
- canvas.NewImageFromFile(path) โ Display images
- canvas.NewText(text, color) โ Custom text with font control
Comparison with Other Go GUI Toolkits
| Toolkit | Approach | Platforms | Complexity |
|---|---|---|---|
| Fyne | Pure Go, OpenGL | Desktop + Mobile | Moderate |
| Gio | Pure Go, GPU-backed | Desktop + Mobile | High (IMGUI) |
| Wails | Go backend + Web UI | Desktop | Low |
| Walk | Windows Win32 API | Windows only | Moderate |
| Golang-UI | Bindings to Nuklear | Desktop | Moderate |
Resources
- Fyne Documentation
- Fyne API Reference
- Fyne Examples โ Sample applications
- Fyne on GitHub
- fyne.io โ Official website