CGO_ENABLED=0LICENSE=BSD-3-Clauseicons: Apache-2.0, CC0-1.0Tested onamd64arm64loong64ppc64leriscv64s390xwasmA widget that calls the platform's own button is as portable as the least capable platform it targets. go-widgets draws every widget itself, through one small painter interface, and lets a back-end decide whether that becomes the pixels of a window, a browser canvas, an Android surface — or the cells of a terminal.
Open# one demo, cross-compiled from one machine $ for t in linux/amd64 linux/riscv64 \ linux/s390x darwin/arm64 windows/arm64 \ android/arm64 js/wasm; do CGO_ENABLED=0 GOOS=${t%/*} GOARCH=${t#*/} \ go build -o /dev/null ./cmd/windowdemo \ && echo "ok $t" done ok linux/amd64 ok linux/riscv64 ok linux/s390x ok darwin/arm64 ok windows/arm64 ok android/arm64 ok js/wasm # the one Go itself refuses $ CGO_ENABLED=0 GOOS=android GOARCH=arm \ go build ./cmd/windowdemo android/arm requires external (cgo) linking, but cgo is not enabled
Its Draw talks to a painter: fill a rectangle, stroke one, set a pixel, draw text. Whether those calls become pixels or terminal cells is the back-end's business. That is the whole reason one widget tree runs in a native window, a browser and a terminal without a line of conditional code.
No webview, no system widget set, no C toolchain. 160 widget types — a data suite with Table, Kanban, Gantt and an event calendar, eight charts, menus, dialogs — drawn the same way on every surface, tested once.
window.Open takes no back-end argument. It reads the environment — the platform, $WAYLAND_DISPLAY, $DISPLAY, an Android host's socket — and opens the window that can work. The same Android binary dials its host inside an APK and opens a Linux window under Termux.
X11 is the core protocol written from scratch over the socket. macOS is reached through the Objective-C runtime, Windows through the process's own DLLs, both from Go. Android, which hands no surface to a plain Go process, gets a thin Java host that only blits.
Observables, commands and lists, bound to widgets once. The core imports no widget package, so one view-model drives the pixel widgets and the terminal ones. mvvmlint fails a pull request that assigns a widget's field by hand.
A toolkit that paints its own pixels gives a screen reader nothing — unless it says what it drew. Widgets report a role, a name, a value and whether they are disabled; the back-ends publish them: AT-SPI on Linux, a virtual view hierarchy on Android, pulled only when something reads it.
One call switches the whole UI to anti-aliased, shaped text in a bundled face, rasterised by go-opentype in Go — no FreeType, no system font lookup, the same in a browser. GTK and libadwaita themes load as a Theme.
A Catalog holds the application's own texts per language and falls back to English; NegotiateLocale picks the best one for a browser's languages, and i18ntest fails a build whose translation is half done. A ThemeManager switches Dark, Light or System live, with no reload. Read more.
A skin describes a widget's parts, states and transitions in JSON, rendered by one engine. The toolkit's own button, switch and card, written as skins, render pixel for pixel the same.
A typed store queries an in-process proxy or a gRPC one over a WebSocket, and the conformance test requires the two to return byte-identical views — so a wasm client and a native one see the same rows.
Pixels sampled from a real X11 server under Xvfb and from a macOS window in CI, clicks driven through a real Win32 window procedure on Windows 11, composited pixels read back from the wasmdesk compositor in Chromium, blits timed on an Android device. What is only compiled is said too.
Wayland (xdg-shell) or X11 (the core protocol over the socket, MIT-SHM), chosen from the session; GTK4 on request.
An NSWindow through the Objective-C runtime with purego; a menu-bar NSStatusItem for the tray.
A Win32 window through the process’s own DLLs and a Go window procedure; Shell_NotifyIcon for the tray.
A plain <canvas>, through webcanvas or window.Open itself, or a window of the wasmdesk compositor over a MessagePort and a shared buffer.
The cell painter, serialised as 24-bit ANSI; an interactive runner with raw mode and the alternate screen.
A real APK: a Java host blits a memfd the Go process paints; input and accessibility cross a socket. arm64.
toolkit v0.329.0, counted at that tagwindow.Openpainter v0.21.0The seam every widget draws through: seven primitives, optional capabilities (clip, paths, images, masks, faces, raster), a pixel painter, a cell painter and an SVG recorder (svgrec) that writes the same calls as native, resizable vector. Docs →
toolkit v0.418.0160 widget types: inputs, containers with swappable layouts, menus and dialogs, an Office-style Ribbon, a keyboard-accessible Splitter, a data suite (Table, TreeTable, Kanban, Gantt, Agenda), eight charts, a GraphView with a pluggable layout and an accessibility tree, an editable NodeGraph (2000 nodes, bounded), a FileTree explorer that renames, deletes, moves and takes files dropped from outside — and, given a vcs repository, marks each one’s version-control state (folders too, conflicts first), refreshed off the UI goroutine (in the browser, set PostUI: Status is read only off the UI goroutine, so it must be safe to call from another goroutine). An xterm-subset Terminal, safe for untrusted output, with its own font and cell size. GTK themes, OpenType text, touch, accessibility. A program links what it uses: one Label in wasm went from 10.49 MB to 5.66 MB (2.88 to 1.61 MB gzipped). ⛔ CollabText moved to toolkit/collabui in v0.345.0. ⛔ GraphNode is no longer comparable with == (v0.418.0): compare node lists with reflect.DeepEqual or an explicit equal; boxes no longer draw a child they shed; TimeSeriesChart.Location (nil = time.Local). Docs →
skin v0.3.0A widget’s parts, states and transitions in a .skin.json file. The toolkit’s button, check, switch, chip and card, rewritten as skins, render pixel for pixel the same. Docs →
gpupainter v0.4.0A painter.Painter that records a frame for the GPU (go-gfx/gpu2d) instead of filling pixels: Metal on macOS, WebGPU in a browser. The whole widget gallery comes out byte-identical to the CPU painter. Docs →
shellterm v0.1.0A line-oriented terminal: the toolkit’s Terminal and a line editor in front of a Shell you supply. History, Tab completion, Ctrl-R, Ctrl-C; keys handled off the UI goroutine. Shared by the wasmcontainers dashboard and wasmdesk. Docs →
isoicons v0.4.0Isometric icon packs — 44 cloud-native, 9 AWS — for the toolkit’s isometric diagrams. Assets vendored unmodified, each under its own licence. Docs →
tabler-icons v0.1.0Tabler Icons (MIT) as embedded SVG, drawn on a toolkit button with toolkit.SVGGlyph; a program links only the icons it names. One icon so far, settings. Docs →
mvvm v0.15.0Observable, Command, ObservableList, binders, and an undo stack. Generics, no reflection; the core imports no widget package, so one view-model drives pixels and cells. Docs →
mvvmtk v0.15.0One call binds a toolkit widget to a view-model, with the widget’s real field and callback names filled in. Every binder returns an unbind. Docs →
lineedit v0.1.1A line editor as a pure model: keys in; the line, the cursor, completions and submitted lines out. History, reverse search, quoting-aware Tab completion, wide characters. Standard library only, fuzzed on every change. Docs →
vt v0.1.0A terminal emulator as a pure model: ECMA-48 and the xterm subset, bytes in, cells out. It answers nothing and drops OSC, DCS and APC. Standard library only, fuzzed on every change. Docs →
vcs v0.1.0What state each file of a working tree is in, and a database/sql-style registry of drivers to ask: Detect walks up to the nearest repository, as git does. Standard library only, so a toolkit links no version-control code; the git driver is the nested module vcs/git (go-git, pure Go, never the git binary). A vcstest fake tests a consumer without any VCS. Docs →
data v0.4.0Typed records, a pure query engine, and a store whose in-process and gRPC proxies return byte-identical views — natively and in wasm. Docs →
window v0.91.0One Open/Run over X11, Wayland, GTK4, Cocoa, Win32, Android, wasmbox and a browser tab. X11 is the core protocol written from scratch over the socket; macOS and Windows are reached from Go alone. On macOS, Config.GPU draws frames with Metal into a CAMetalLayer, the same pixels at a sixth of the CPU time at 1920 × 1200. A scene that reports its damage has only the changed rectangles presented on every back-end, GTK4 included (libgtk-4 4.16+, a partial texture update over a framebuffer shared with GTK, so a present copies no byte; the GTK4 window follows resizes). On X11 and Wayland it draws them with Vulkan and presents through the existing shm path: byte-identical on software Vulkan (lavapipe); go-gfx/gpu2d’s Vulkan Draw is 52 times faster at 1080p than its CPU reference on one core, on a Radeon PRO W7700, the window itself not yet measured on hardware. Input methods in painted fields: one toolkit.Composer interface, wired to Cocoa NSTextInputClient, GTK4 GtkIMContext and Win32 IMM32; the preedit is bounded and fuzzed, and what is proven (macOS live, GTK under Xvfb) and what is not (a live Windows IME) is stated in the docs. Native controls on GTK4 and Win32: a context menu (a popover on GTK4, a real HMENU on Win32) and a picture in a button, Config.HideOnClose, and Raise on GTK4; built and read back in CI, a real pointer right-click and the modal Win32 menu loop are not driven. Docs →
application v0.8.1The lifecycle above a window: the run loop, a tray icon attached once the first frame is up, the live system appearance, the accessibility tree, a ready hook. Docs →
tray v0.15.0A menu-bar or notification-area icon with menus, submenus and checkboxes: NSStatusItem, Shell_NotifyIcon, StatusNotifierItem over DBus. No build tag; ErrNoBackend where there is none. Docs →
webcanvas v0.9.0A scene in a plain browser <canvas>: no compositor, no SharedArrayBuffer, no cross-origin isolation. Any static host serves it. A scene that reports its damage (v0.15.0) has only the changed rectangles copied and put on the canvas, and a frame with nothing changed puts nothing. Its webcanvas/gpu presenter draws through WebGPU, byte-identical to the CPU frame, and falls back to the 2D canvas without it; a scene that reports its damage there sends no command buffer on an idle frame (v0.16.0) and has only the damage recorded on a changed one (v0.17.0). Docs →
tui v0.62.0The same widgets through the cell painter, an interactive runner (raw mode, alternate screen, resize), and cell-native widgets, a syntax-highlighting editor among them. Docs →
android v0.16.0An installable APK whose whole interface is painted by a Go process; a thin Java host blits a shared memfd and owns nothing else. Docs →
svg v0.8.0Any RGBA render as a bit-exact SVG or PNG, and timed frames as ONE animated SVG, 22.9x smaller on a live screen. Gallery: go-widgets.github.io/svg. Docs →
mvvmlint v0.4.2A go vet check that fails a pull request assigning a widget’s state field by hand, or shipping widgets with no view-model. Docs →
bricolint v0.4.1A go vet check against hand-drawn UI: no painter primitives in application code, no widget rebuilt on every frame. An exemption must give its reason. Docs →
app-template v0.5.0The starting point: a browser app with its state in a view-model, a 100% coverage gate and the MVVM gate, green from the first commit. Docs →
No webview, no runtime to install. One go build per target, from any machine, and the same widget tree in a window, a browser tab, a terminal or an APK. Start from app-template: MVVM-compliant and green from the first commit.