jamb

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0

README

jamb

A declarative, GPU-accelerated desktop UI framework for Go. Tested only on Windows.

jamb is a small, declarative, GPU-rendered desktop UI framework written in plain Go. An app is a tree of elements built by components, and its state lives in signals, so a change re-renders only the parts that depend on it.

Status: jamb is pre-1.0. The API may change between versions. It runs on Windows 10 and 11 today; other platforms are planned.

Highlights

  • Widgets: buttons, split buttons and toggles, text fields (masked and clearable), one-time code inputs, checkboxes, switches, sliders and range sliders, ratings, selects, comboboxes, date and time pickers, calendars, color pickers, menus, a command palette, tabs, trees, steppers, carousels, data grids, forms with validation, alerts, toasts, hover cards, and modal dialogs.
  • Layout: flexbox, grid, sidebars, toolbars, status bars, split panes, docking, and variable-height and uniform lists.
  • Theming: light and dark themes that follow the system's light or dark mode, 37 converted predefined themes in 22 families, and automatic high contrast.
  • Accessibility: a UI Automation tree for screen readers, keyboard navigation, reduced motion, and a text size setting.
  • Text: shaping with HarfBuzz, fallback fonts, rich and selectable text, and input method (IME) composition.
  • Graphics: a canvas, SVG images, gradients, and charts.
  • Code editing: a codeedit package with syntax highlighting for 76 languages, undo and redo, and find and replace.
  • Markdown: a markdown package that shows CommonMark with the GitHub extensions as accessible, selectable elements.
  • OS integration: jump lists, single instance, a notification area icon, taskbar progress, and OS notifications.
  • Development tools: jamb dev rebuilds and restarts an app on each save, and a visual inspector shows the elements of a running window.
  • Packaging: jamb package builds a Windows zip, an installer, and an MSIX.

Install

jamb needs Windows 10 or 11 and Go 1.27.1 or later. A minimal main.go opens a window with a greeting and a button that counts its clicks:

package main

import (
	"fmt"

	"github.com/tyler-builds/jamb/app"
	"github.com/tyler-builds/jamb/ui"
)

func main() {
	clicks := ui.NewSignal(0)

	app.New().Run(app.Window{
		Title:  "Hello",
		Width:  800,
		Height: 600,
		// Root is a component, so it runs again whenever clicks changes.
		Root: func(ctx *ui.Context) ui.Element {
			return ui.Div().Column().Center().Gap(24).
				Child(ui.Text("Hello, world!").FontSize(24)).
				Child(ui.Button(fmt.Sprintf("Clicked %d times", clicks.Get())).
					OnClick(func() { clicks.Update(func(n int) int { return n + 1 }) }))
		},
	})
}

In the module that holds it, add jamb and run the app:

go get github.com/tyler-builds/jamb@v0.4.0
go mod tidy    # records the checksums of jamb's own dependencies
go run .

The jamb command is a separate module, whose latest release is cmd/jamb/v0.4.0:

go install github.com/tyler-builds/jamb/cmd/jamb@v0.4.0

The repository includes four examples. From a clone of the repository, run them with:

go run ./examples/hello    # the smallest complete app: one window, a signal and a button
go run ./examples/demo     # a tour of the widgets, layouts, and pages
go run ./examples/notes    # a note-taking app
go run ./examples/git      # a Git history browser with a commit graph

The getting started guide covers the commands for building and packaging, and the concepts page introduces the API.

Benchmarks

The same hello-world app (a window, a greeting and a click counter) built with jamb and with GPUI, the UI framework from Zed, on one Windows machine. The figures are from 2026-10-22, except the rows marked 2026-10-12. Lower is better in every row, and the better figure is in bold. The windows were on a secondary 144 Hz monitor, never activated. The machine was not dedicated to benchmarking: other applications were running. The docs/comparison-gpui.md has the method, the ranges of each measurement and the setup, and the 2026-10-21 pass.

Measure jamb GPUI
Startup to first frame, warm launch 215 ms 296 ms
Startup to first frame, first launch (scanned by the antivirus) 496.5 ms 502.2 ms
Window visible, first launch 480 ms 485.9 ms
Idle CPU, window in the background, 60 s 0.10% of one core 1.46%
Idle context switches per second 66 422
Memory, private bytes 75.7 MB 73.2 MB
Memory, working set 55.1 MB 49.0 MB
GPU memory, dedicated 13.7 MB 15.5 MB
Threads 38 32
Handles 477 462
CPU while the pointer moves over the window 1.4% 2.5%
CPU while the window is resized 2.5% 10.8%
Context switches per second while resizing 1,210 1,326
Build after an edit (release, text change) 1.39 s 2.50 s (release), 3.62 s (debug)
Clean build (2026-10-12) 9 s 138 s (release), 100 s (debug)
Binary size, release build 8.02 MB 9.22 MB
Binary size, GPUI's size-optimized build profile (2026-10-12) 4.31 MB

Against 2026-10-21, jamb's resize CPU fell from 11.8% to 2.5%, and its warm launch and idle memory are a little lower. Its idle CPU (0.05% then) and its pointer CPU (1.1% then) rose, though both stay below GPUI's. The focused idle CPU was not measured on 2026-10-21 or 2026-10-22. On 2026-10-12 the hello app used 0.29% of a core with the window focused, and GPUI 1.85%. jamb's frames on the secondary monitor followed the primary monitor's refresh rate, a known issue listed in BENCHMARKS.md.

The demo app (four pages), from BENCHMARKS.md, measured on 2026-10-22 unless the row says otherwise. The figures in the middle column are the 2026-10-22 results, with the 2026-10-21 figure in brackets where it changed:

Measure Result What it means
Startup to first frame, warm 221 ms (261 ms to the first painted frame) [215 ms, 252 ms] About 180 ms of it is the graphics driver creating the Direct3D device (2026-10-12). Both figures are higher than on 2026-10-21, which is not explained.
Idle CPU, unfocused, 60 s 0.08% of one core [0.13%] An idle window draws nothing. About 66 context switches a second; the 2026-10-12 analysis traced most of an idle window's wake-ups to the graphics driver's thread.
Full re-render of every component 0.81 ms of CPU per frame on average, 165 FPS at vsync, on a 310-element page [0.97 ms, 164 FPS] A full re-render is a stress case; normal updates are incremental. It allocates 465 KB a frame [936 KB], still above the 110 KB of 2026-10-06.
One key press in a 10,000-node tree 0.47 µs [273 µs] The top modal is cached per build, so a key press no longer searches the tree.
One signal change in a 10,000-element tree 0.32 ms [0.31 ms] Only the component that read the signal renders again.
One scroll step in a 100,000-row list 0.15 ms in a UniformList, 0.07 ms in a ListOf [0.15 ms] Only the rows in view are built.
Expanded tree, 10,100 rows, one frame 2.0 ms [80.5 ms] A tree or data grid without a height shows the rows that fit its parent.
Page switch, first visit (click to Present, p95) 37.7 ms [26.7 ms] The first visit to a page builds it. This got worse in the live run, which is not explained.
Rebuild after an edit (2026-10-06) 0.25 to 0.84 s Edit, build and run stays under a second; jamb dev shows the new window 1.05 to 1.36 s after a save.

How it works

jamb is plain Go, with no cgo. On Windows it uses Win32 for windows and input, and draws with a Direct3D 11 renderer that it reaches through COM vtables; text is shaped with HarfBuzz (through go-text) and the accessibility tree is exposed through UI Automation. Each frame, components whose signals changed render again, the layout updates what moved, and the renderer submits the scene to the GPU; nothing is drawn while nothing changes. docs/architecture.md has the details.

Examples

The examples are in examples/. examples/hello is the minimal app shown above. examples/demo is a tour of the widgets and layouts. It is also the app that jamb package builds in the packaging guide. examples/notes is a note-taking app with persistence, a command palette, and a keymap file. examples/git browses the history of Git repositories, with a commit graph, branches, tags and diffs. docs/examples.md describes the demo, notes and Git apps.

Documentation

The full documentation is in docs/. Each page covers one topic:

Contributing

Development needs Go 1.27.1 or later and Windows. Run the headless tests with:

gofmt -l .
go vet ./... ./cmd/jamb/... ./examples/demo/... ./examples/notes/... ./examples/hello/... ./examples/git/...
go test ./... ./cmd/jamb/... ./examples/demo/... ./examples/notes/... ./examples/hello/... ./examples/git/...

gofmt -l . should print nothing. The go test runs need no display. A few tests open a window; set JAMB_LIVE_TESTS=1 to run them as well. The module layout, the packages, and the internals are in docs/architecture.md.

CONTRIBUTING.md covers issues, pull requests and the rules the code follows. Report security problems privately, as SECURITY.md describes.

Changelog

Release notes are in CHANGELOG.md.

License

jamb is licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.

An app built with jamb ships third-party code too. The list of notices to include with a distributed app is in Licenses of what your app ships.

Directories

Path Synopsis
Package access is jamb's platform-neutral accessibility model.
Package access is jamb's platform-neutral accessibility model.
accesstest
Package accesstest has helpers for tests that check an access tree: find a node by its role and name, and assert its role, name and states.
Package accesstest has helpers for tests that check an access tree: find a node by its role and name, and assert its role, name and states.
Package actions holds the actions of jamb's text fields and text areas: the commands their keys run, such as Undo, Copy and MoveWordLeft.
Package actions holds the actions of jamb's text fields and text areas: the commands their keys run, such as Undo, Copy and MoveWordLeft.
Package app runs a jamb application: it opens native windows, creates the GPU renderer and drives one ui runtime per window.
Package app runs a jamb application: it opens native windows, creates the GPU renderer and drives one ui runtime per window.
Package charts draws charts with ui.Canvas: line, area, bar (grouped and stacked, vertical and horizontal), scatter, pie and donut, radar, candlestick and Sankey charts.
Package charts draws charts with ui.Canvas: line, area, bar (grouped and stacked, vertical and horizontal), scatter, pie and donut, radar, candlestick and Sankey charts.
cmd
jamb module
Package codeedit is a code editor for jamb: a multi-line text area for source code, with a line-indexed text buffer, undo and redo, several selections, find and replace, folding by indentation, and syntax highlighting.
Package codeedit is a code editor for jamb: a multi-line text area for source code, with a line-indexed text buffer, undo and redo, several selections, find and replace, folding by indentation, and syntax highlighting.
highlight
Package highlight colors the text of a code editor with @pierre/highlights, a syntax highlighter of the Pierre Computer Company with a lexer for each of 76 languages, which runs in WebAssembly (see codeedit/internal/lexer).
Package highlight colors the text of a code editor with @pierre/highlights, a syntax highlighter of the Pierre Computer Company with a lexer for each of 76 languages, which runs in WebAssembly (see codeedit/internal/lexer).
internal/lexer
Package lexer runs @pierre/highlights, the syntax highlighter of the Pierre Computer Company (https://github.com/pierrecomputer/pierre, Apache-2.0), in wazero.
Package lexer runs @pierre/highlights, the syntax highlighter of the Pierre Computer Company (https://github.com/pierrecomputer/pierre, Apache-2.0), in wazero.
internal/lexer/update command
Command update downloads a release of @pierre/highlights from the npm registry and writes its WebAssembly module, license and tables into the lexer package:
Command update downloads a release of @pierre/highlights from the npm registry and writes its WebAssembly module, license and tables into the lexer package:
Package devtools links the visual inspector into an application.
Package devtools links the visual inspector into an application.
Package dialog describes the native dialogs an app opens from a window: file open, file save, folder pick and message boxes.
Package dialog describes the native dialogs an app opens from a window: file open, file save, folder pick and message boxes.
Package ease has easing functions for animation.
Package ease has easing functions for animation.
Package icons provides the Lucide icon set (https://lucide.dev, ISC license): every Lucide icon as icons.<CamelName>, such as icons.ArrowDown, and a rasterizer that draws them as anti-aliased coverage masks.
Package icons provides the Lucide icon set (https://lucide.dev, ISC license): every Lucide icon as icons.<CamelName>, such as icons.ArrowDown, and a rasterizer that draws them as anti-aliased coverage masks.
Package input defines the platform-neutral input vocabulary shared by the platform adapters and the ui package: keys, mouse buttons, modifiers and cursor shapes.
Package input defines the platform-neutral input vocabulary shared by the platform adapters and the ui package: keys, mouse buttons, modifiers and cursor shapes.
internal
iconsheet command
Command iconsheet renders every built-in icon to a PNG contact sheet:
Command iconsheet renders every built-in icon to a PNG contact sheet:
inspect
Package inspect is the data of the visual inspector (see app/inspect.go): what it shows about an element of an inspected window, and the frame timings of the window.
Package inspect is the data of the visual inspector (see app/inspect.go): what it shows about an element of an inspected window, and the frame timings of the window.
layout
Package layout is a small flexbox-style layout engine.
Package layout is a small flexbox-style layout engine.
lucidegen command
Command lucidegen writes the Lucide icons of the icons package from the SVG files of a pinned Lucide release.
Command lucidegen writes the Lucide icons of the icons package from the SVG files of a pinned Lucide release.
notifyscheme
Package notifyscheme derives the URI scheme that a click on a jamb app's notification starts the app with.
Package notifyscheme derives the URI scheme that a click on a jamb app's notification starts the app with.
platform
Package platform defines the framework-owned contract between the cross-platform core and an operating-system adapter.
Package platform defines the framework-owned contract between the cross-platform core and an operating-system adapter.
platform/darwin
Package darwin will hold the macOS (Cocoa + Metal) adapter.
Package darwin will hold the macOS (Cocoa + Metal) adapter.
platform/linux
Package linux will hold the Linux (Wayland/X11 + Vulkan or GL) adapter.
Package linux will hold the Linux (Wayland/X11 + Vulkan or GL) adapter.
platform/windows
Package windows is the Win32 platform adapter.
Package windows is the Win32 platform adapter.
render
Package render defines the framework-owned renderer contract.
Package render defines the framework-owned renderer contract.
render/d3d11
Package d3d11 is the Direct3D 11 backend for render.Renderer.
Package d3d11 is the Direct3D 11 backend for render.Renderer.
rope
Package rope implements a persistent rope for UTF-8 text, the text buffer behind a code editor.
Package rope implements a persistent rope for UTF-8 text, the text buffer behind a code editor.
scene
Package scene holds the small set of GPU-friendly primitives the ui package paints into and a renderer draws from.
Package scene holds the small set of GPU-friendly primitives the ui package paints into and a renderer draws from.
svg
Package svg draws static SVG images with internal/vector: shapes, paths, groups and use, transforms, fills and strokes with colors and linear and radial gradients, opacity, clip paths, and the presentation attributes, style attributes and simple style sheets that design tools write.
Package svg draws static SVG images with internal/vector: shapes, paths, groups and use, transforms, fills and strokes with colors and linear and radial gradients, opacity, clip paths, and the presentation attributes, style attributes and simple style sheets that design tools write.
syntaxname
Package syntaxname finds the style of a syntax token name in a theme's syntax map, for the code editor and the Markdown view.
Package syntaxname finds the style of a syntax token name in a theme's syntax map, for the code editor and the Markdown view.
text
Package text loads fonts, lays out and measures text, and rasterizes glyphs (and other coverage masks such as icons) into a shared atlas.
Package text loads fonts, lays out and measures text, and rasterizes glyphs (and other coverage masks such as icons) into a shared atlas.
themegen command
Command themegen converts the predefined themes of GPUI Kit (formerly gpui-component) into jamb themes.
Command themegen converts the predefined themes of GPUI Kit (formerly gpui-component) into jamb themes.
uihost
Package uihost connects the app package to the methods of ui.Runtime that only a window host calls: the wake-up function, platform services, the cursor, window focus and the window areas of a custom title bar.
Package uihost connects the app package to the methods of ui.Runtime that only a window host calls: the wake-up function, platform services, the cursor, window focus and the window areas of a custom title bar.
vector
Package vector draws paths into pixels on the CPU: fills with the nonzero or even-odd rule, strokes with joins, caps and dashes, solid colors and linear and radial gradients, clipping and group opacity.
Package vector draws paths into pixels on the CPU: fills with the nonzero or even-odd rule, strokes with joins, caps and dashes, solid colors and linear and radial gradients, clipping and group opacity.
watch
Package watch reports changes to the files in a directory.
Package watch reports changes to the files in a directory.
win32
Package win32 is a minimal, cgo-free binding to the Win32 calls the Windows adapter needs.
Package win32 is a minimal, cgo-free binding to the Win32 calls the Windows adapter needs.
Package keymap sets key bindings from JSON files, so users can change shortcuts without code.
Package keymap sets key bindings from JSON files, so users can change shortcuts without code.
Package markdown shows Markdown as jamb elements: a read-only view of a document in CommonMark, with the GitHub extensions for tables, strikethrough, task lists, autolinks and footnotes.
Package markdown shows Markdown as jamb elements: a read-only view of a document in CommonMark, with the GitHub extensions for tables, strikethrough, task lists, autolinks and footnotes.
mdcode
Package mdcode colors the code blocks of a Markdown view with the highlighter of jamb's code editor:
Package mdcode colors the code blocks of a Markdown view with the highlighter of jamb's code editor:
ui
uitest
Package uitest drives a jamb UI headlessly in tests: it renders a root component in a ui.Runtime of a given size, steps a clock of its own, finds elements by key, accessible name or role, acts on them as a user does, and reads what they show, their accessibility states and how they were drawn.
Package uitest drives a jamb UI headlessly in tests: it renders a root component in a ui.Runtime of a given size, steps a clock of its own, finds elements by key, accessible name or role, acts on them as a user does, and reads what they show, their accessibility states and how they were drawn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL