Documentation
¶
Overview ¶
Package ui provides an enterprise-grade GUI toolkit for Go.
gogpu/ui is designed for building professional applications such as IDEs, design tools, CAD applications, and Chrome/Electron-class apps. It provides a reactive, declarative API with GPU-accelerated rendering.
Quick Start ¶
The simplest ui program creates a window with a button:
package main
import (
"github.com/gogpu/gogpu"
"github.com/gogpu/ui"
"github.com/gogpu/ui/widgets"
"github.com/gogpu/ui/layout"
)
func main() {
app := gogpu.NewApp(gogpu.Config{
Title: "My App",
Width: 800,
Height: 600,
})
root := layout.VStack(
widgets.Text("Hello, World!"),
widgets.Button("Click Me").OnClick(func() {
println("Clicked!")
}),
).Padding(16)
app.SetRoot(root)
app.Run()
}
Architecture ¶
gogpu/ui uses a layered architecture:
- core: Widget interface, WidgetBase, Context
- layout: VStack, HStack, Grid, Flexbox
- widgets: Button, TextField, Dropdown, etc.
- theme: Material 3, Fluent, Cupertino
- state: Signals integration (coregx/signals)
State Management ¶
Use signals for reactive state:
count := signals.New(0)
widgets.Text(signals.Computed(func() string {
return fmt.Sprintf("Count: %d", count.Get())
}))
Platform Support ¶
- Windows: Win32
- macOS: Cocoa
- Linux: X11/Wayland
Dependencies ¶
gogpu/ui depends on:
- github.com/gogpu/gg - 2D graphics
- github.com/gogpu/gogpu - Windowing
- github.com/coregx/signals - State management
Status ¶
This package is in the planning phase (v0.0.0). See ROADMAP.md for the development plan.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Logger ¶
Logger returns the current logger used by ui. Sub-packages call this to share the same logger configuration without introducing import cycles.
Logger is safe for concurrent use.
func SetLogger ¶
SetLogger configures the logger for the ui toolkit. By default, ui produces no log output. Call SetLogger to enable logging.
SetLogger is safe for concurrent use: it stores the new logger atomically. Pass nil to disable logging (restore default silent behavior).
Log levels used by ui:
- slog.LevelDebug: internal diagnostics (layout calculations, focus changes)
- slog.LevelInfo: important lifecycle events (plugin loaded, theme applied)
- slog.LevelWarn: non-fatal issues (widget paint errors, constraint violations)
Example:
// Enable info-level logging to stderr:
ui.SetLogger(slog.Default())
// Enable debug-level logging for full diagnostics:
ui.SetLogger(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: slog.LevelDebug,
})))
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package a11y provides accessibility foundation types for the gogpu/ui toolkit.
|
Package a11y provides accessibility foundation types for the gogpu/ui toolkit. |
|
Package animation provides an enterprise-grade animation engine for gogpu/ui.
|
Package animation provides an enterprise-grade animation engine for gogpu/ui. |
|
Package app provides the bridge between the UI widget tree and the windowing system.
|
Package app provides the bridge between the UI widget tree and the windowing system. |
|
Package cdk provides the Component Development Kit — design-system-agnostic building blocks for composite widgets.
|
Package cdk provides the Component Development Kit — design-system-agnostic building blocks for composite widgets. |
|
core
|
|
|
button
Package button provides a clickable button widget.
|
Package button provides a clickable button widget. |
|
checkbox
Package checkbox provides a toggleable checkbox widget.
|
Package checkbox provides a toggleable checkbox widget. |
|
collapsible
Package collapsible provides a collapsible/expandable section widget.
|
Package collapsible provides a collapsible/expandable section widget. |
|
datatable
Package datatable provides a sortable data table widget with fixed header, virtualized rows, and column-level configuration.
|
Package datatable provides a sortable data table widget with fixed header, virtualized rows, and column-level configuration. |
|
dialog
Package dialog provides a modal dialog widget for confirmations, alerts, and custom content.
|
Package dialog provides a modal dialog widget for confirmations, alerts, and custom content. |
|
docking
Package docking provides an IDE-style dockable panel system.
|
Package docking provides an IDE-style dockable panel system. |
|
dropdown
Package dropdown provides a dropdown/select widget that displays a list of items in a floating menu when activated.
|
Package dropdown provides a dropdown/select widget that displays a list of items in a floating menu when activated. |
|
gridview
Package gridview provides a virtualized 2D grid widget that renders only visible cells, enabling efficient display of large datasets in a grid layout.
|
Package gridview provides a virtualized 2D grid widget that renders only visible cells, enabling efficient display of large datasets in a grid layout. |
|
linechart
Package linechart provides a real-time line chart widget for visualizing time-series data such as CPU usage, memory consumption, or network throughput.
|
Package linechart provides a real-time line chart widget for visualizing time-series data such as CPU usage, memory consumption, or network throughput. |
|
listview
Package listview provides a virtualized list widget that renders only visible items, enabling efficient display of large datasets.
|
Package listview provides a virtualized list widget that renders only visible items, enabling efficient display of large datasets. |
|
menu
Package menu provides a menu system with MenuBar and ContextMenu widgets.
|
Package menu provides a menu system with MenuBar and ContextMenu widgets. |
|
popover
Package popover provides floating overlay widgets anchored to a trigger.
|
Package popover provides floating overlay widgets anchored to a trigger. |
|
progress
Package progress provides a circular progress indicator widget with determinate and indeterminate modes.
|
Package progress provides a circular progress indicator widget with determinate and indeterminate modes. |
|
progressbar
Package progressbar provides a linear progress bar widget for displaying a value between 0% and 100%.
|
Package progressbar provides a linear progress bar widget for displaying a value between 0% and 100%. |
|
radio
Package radio provides a mutually-exclusive radio group widget.
|
Package radio provides a mutually-exclusive radio group widget. |
|
scrollview
Package scrollview provides a scrollable container widget for clipping and navigating content that exceeds the viewport size.
|
Package scrollview provides a scrollable container widget for clipping and navigating content that exceeds the viewport size. |
|
slider
Package slider provides a draggable slider widget for selecting a value from a continuous or discrete range.
|
Package slider provides a draggable slider widget for selecting a value from a continuous or discrete range. |
|
splitview
Package splitview provides a resizable split panel container widget with a draggable divider separating two child panels.
|
Package splitview provides a resizable split panel container widget with a draggable divider separating two child panels. |
|
stripe
Package stripe provides a vertical tool window sidebar widget.
|
Package stripe provides a vertical tool window sidebar widget. |
|
tabview
Package tabview provides a tabbed navigation widget.
|
Package tabview provides a tabbed navigation widget. |
|
textfield
Package textfield provides a full-featured text input widget.
|
Package textfield provides a full-featured text input widget. |
|
titlebar
Package titlebar provides a custom window title bar widget.
|
Package titlebar provides a custom window title bar widget. |
|
toolbar
Package toolbar provides a horizontal action bar widget.
|
Package toolbar provides a horizontal action bar widget. |
|
treeview
Package treeview provides a hierarchical tree widget for displaying nested data structures such as file explorers, org charts, and configuration trees.
|
Package treeview provides a hierarchical tree widget for displaying nested data structures such as file explorers, org charts, and configuration trees. |
|
Package dnd provides drag and drop infrastructure for the gogpu/ui toolkit.
|
Package dnd provides drag and drop infrastructure for the gogpu/ui toolkit. |
|
Package event provides input event types for the gogpu/ui toolkit.
|
Package event provides input event types for the gogpu/ui toolkit. |
|
Package examples contains integration examples for gogpu/ui.
|
Package examples contains integration examples for gogpu/ui. |
|
ide
command
IDE-like demo — GoLand/JetBrains-inspired layout with DevTools theme.
|
IDE-like demo — GoLand/JetBrains-inspired layout with DevTools theme. |
|
gallery
module
|
|
|
hello
module
|
|
|
Package focus provides keyboard focus management for a widget tree.
|
Package focus provides keyboard focus management for a widget tree. |
|
Package geometry provides fundamental geometric types for UI layout and rendering.
|
Package geometry provides fundamental geometric types for UI layout and rendering. |
|
Package i18n provides internationalization support for the gogpu/ui toolkit.
|
Package i18n provides internationalization support for the gogpu/ui toolkit. |
|
Package icon provides a vector path icon system for the gogpu/ui toolkit.
|
Package icon provides a vector path icon system for the gogpu/ui toolkit. |
|
internal
|
|
|
dirty
Package dirty provides dirty region tracking for efficient partial repaints.
|
Package dirty provides dirty region tracking for efficient partial repaints. |
|
layout
Package layout provides the internal layout engine implementation for gogpu/ui.
|
Package layout provides the internal layout engine implementation for gogpu/ui. |
|
render
Package render provides the internal rendering implementation for gogpu/ui.
|
Package render provides the internal rendering implementation for gogpu/ui. |
|
render/fonts
Package fonts embeds professional UI font files.
|
Package fonts embeds professional UI font files. |
|
Package layout provides a public, extensible layout system for gogpu/ui.
|
Package layout provides a public, extensible layout system for gogpu/ui. |
|
Package overlay provides an overlay stack for displaying floating content above the normal widget tree.
|
Package overlay provides an overlay stack for displaying floating content above the normal widget tree. |
|
Package plugin provides a system for bundling UI components into cohesive packages.
|
Package plugin provides a system for bundling UI components into cohesive packages. |
|
Package primitives provides the fundamental widget building blocks for the gogpu/ui framework: BoxWidget, TextWidget, and ImageWidget.
|
Package primitives provides the fundamental widget building blocks for the gogpu/ui framework: BoxWidget, TextWidget, and ImageWidget. |
|
Package registry provides a widget registration system for dynamic widget creation.
|
Package registry provides a widget registration system for dynamic widget creation. |
|
Package render provides the public API for creating a widget.Canvas backed by a gg.Context.
|
Package render provides the public API for creating a widget.Canvas backed by a gg.Context. |
|
Package state provides reactive state management for the gogpu/ui widget tree.
|
Package state provides reactive state management for the gogpu/ui widget tree. |
|
Package theme provides a comprehensive theming system for gogpu/ui.
|
Package theme provides a comprehensive theming system for gogpu/ui. |
|
cupertino
Package cupertino provides an Apple Human Interface Guidelines (HIG) theme.
|
Package cupertino provides an Apple Human Interface Guidelines (HIG) theme. |
|
devtools
Package devtools provides a JetBrains-inspired DevTools design system theme.
|
Package devtools provides a JetBrains-inspired DevTools design system theme. |
|
fluent
Package fluent provides a Microsoft Fluent Design System theme.
|
Package fluent provides a Microsoft Fluent Design System theme. |
|
font
Package font provides a font registry for managing font families, weights, and styles in the gogpu/ui toolkit.
|
Package font provides a font registry for managing font families, weights, and styles in the gogpu/ui toolkit. |
|
material3
Package material3 provides a Google Material Design 3 (Material You) theme.
|
Package material3 provides a Google Material Design 3 (Material You) theme. |
|
Package transition provides widget enter/exit animations.
|
Package transition provides widget enter/exit animations. |
|
Package uitest provides reusable testing utilities for the gogpu/ui toolkit.
|
Package uitest provides reusable testing utilities for the gogpu/ui toolkit. |
|
Package widget provides core widget types and interfaces for the gogpu/ui toolkit.
|
Package widget provides core widget types and interfaces for the gogpu/ui toolkit. |