jamb

module
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0

README

jamb

A declarative, GPU-accelerated desktop UI framework for Go. Runs on Windows; Linux (Wayland) support is experimental.

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. Linux support for Wayland desktops is experimental: it draws on the CPU and lacks some features (see docs/status.md). A web page is experimental too (see docs/web.md). macOS is 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, or experimentally a Linux desktop running Wayland, 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.8.8
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.3:

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

The repository includes seven 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
go run ./examples/monitor  # a system monitor with live charts and a process table
go run ./examples/budget   # a household budget with forms, an editable table and CSV import
go run ./examples/term     # a terminal with tabs, on Linux: a shell per tab in a CellGrid

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-23 (the v0.4.0 release), 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 earlier passes.

Measure jamb GPUI
Startup to first frame, warm launch 229 ms 337 ms
Startup to first frame, first launch (scanned by the antivirus) 552.5 ms 587.3 ms
Window visible, first launch 538.2 ms 552.3 ms
Idle CPU, window in the background, 60 s 0.05% of one core 1.48%
Idle context switches per second 71 426
Memory, private bytes 76.1 MB 73.2 MB
Memory, working set 56.0 MB 49.5 MB
GPU memory, dedicated 13.7 MB 15.5 MB
Threads 39 32
Handles 483 462
CPU while the pointer moves over the window 0.8% 4.2%
CPU while the window is resized 7.8% 8.6%
Context switches per second while resizing 1,932 1,520
Build after an edit (release, text change) 1.45 s 3.13 s (release), 4.27 s (debug)
Clean build (2026-10-12) 9 s 138 s (release), 100 s (debug)
Binary size, release build 8.25 MB 9.22 MB
Binary size, GPUI's size-optimized build profile (2026-10-12) 4.31 MB

Against 2026-10-22, jamb's resize CPU rose from 2.5% to 7.8%, and its context switches while resizing from 1,210 to 1,932 a second, above GPUI's. v0.4.0 keeps the swap chain's spare room only while the user drags the window's edge, which fixed a window shown zoomed in after a maximize and a restore, and this benchmark resizes the window from code, not by a drag. Both apps started more slowly than on 2026-10-22 (jamb 215 ms and GPUI 296 ms warm then), which points to a busier machine; the pointer CPU, which varies from run to run, was 1.4% for jamb and 2.5% for GPUI then. jamb's binary grew by 0.23 MB: v0.4.0's Lucide icons link an SVG engine. The focused idle CPU was not measured on 2026-10-21, 2026-10-22 or 2026-10-23. 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. On Linux (experimental) it speaks the Wayland protocol itself and draws with Vulkan, loaded at run time, into dma-bufs it hands to the compositor; without a usable GPU it draws on the CPU. 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. examples/monitor shows the machine's load, memory, network and processes as they change, in panels that can be rearranged and floated. examples/budget keeps a household budget, with forms, an editable transaction table and CSV import. examples/term is a small terminal for Linux, with tabs, scrollback and copy and paste, drawn with ui.CellGrid. docs/examples.md describes the demo, notes, Git, monitor, budget and terminal 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/... ./examples/monitor/... ./examples/budget/... ./examples/term/...
go test ./... ./cmd/jamb/... ./examples/demo/... ./examples/notes/... ./examples/hello/... ./examples/git/... ./examples/monitor/... ./examples/budget/... ./examples/term/...

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).
Package lexer runs @pierre/highlights, the syntax highlighter of the Pierre Computer Company (https://github.com/pierrecomputer/pierre, Apache-2.0).
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 development tools into an application: the visual inspector, the control channel, the state that survives jamb dev's restarts (package devtools/hot; not in a web build, see hot.go), and the scenes of package scene (see docs/tools.md, "Scenes").
Package devtools links the development tools into an application: the visual inspector, the control channel, the state that survives jamb dev's restarts (package devtools/hot; not in a web build, see hot.go), and the scenes of package scene (see docs/tools.md, "Scenes").
hot
Package hot keeps an app's state across the restarts of `jamb dev`: every signal the app makes with ui.NewSignal, and every ui.Local, has the value it had before the restart, with no code in the app.
Package hot keeps an app's state across the restarts of `jamb dev`: every signal the app makes with ui.NewSignal, and every ui.Local, has the value it had before the restart, with no code in the app.
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
changelog command
Command changelog keeps the unreleased entries of CHANGELOG.md in fragment files, one per change, so that pull requests made at the same time never edit the same lines.
Command changelog keeps the unreleased entries of CHANGELOG.md in fragment files, one per change, so that pull requests made at the same time never edit the same lines.
devhook
Package devhook connects the development tools to the packages they watch, without those packages importing the tools.
Package devhook connects the development tools to the packages they watch, without those packages importing the tools.
dmabuf
Package dmabuf describes the hand-off of GPU-rendered frames to a window system as Linux dma-bufs.
Package dmabuf describes the hand-off of GPU-rendered frames to a window system as Linux dma-bufs.
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/headless
Package headless is a platform adapter whose windows exist only in memory: nothing appears on the screen, no window takes the keyboard focus, and the CPU renderer (render/soft) draws each frame into a buffer the window owns.
Package headless is a platform adapter whose windows exist only in memory: nothing appears on the screen, no window takes the keyboard focus, and the CPU renderer (render/soft) draws each frame into a buffer the window owns.
platform/linux
Package linux is the Linux platform adapter, for Wayland compositors.
Package linux is the Linux platform adapter, for Wayland compositors.
platform/linux/wl
Package wl is a small Wayland client: the wire protocol over the compositor's Unix socket, in pure Go, with no libwayland.
Package wl is a small Wayland client: the wire protocol over the compositor's Unix socket, in pure Go, with no libwayland.
platform/web
Package web is the platform adapter of a web page: a js build of an app, run in a browser.
Package web is the platform adapter of a web page: a js build of an app, run in a browser.
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.
render/rendertest
Package rendertest holds scenes that the renderers' tests and benchmarks draw, so the CPU and GPU renderers are measured and compared on the same frames.
Package rendertest holds scenes that the renderers' tests and benchmarks draw, so the CPU and GPU renderers are measured and compared on the same frames.
render/soft
Package soft is a CPU renderer: it draws scene primitives into memory in pure Go, with no GPU and no system library.
Package soft is a CPU renderer: it draws scene primitives into memory in pure Go, with no GPU and no system library.
render/vulkan
Package vulkan is the Vulkan backend for render.Renderer, for Linux.
Package vulkan is the Vulkan backend for render.Renderer, for Linux.
render/webgl
Package webgl draws scenes with WebGL 2 into a canvas of a web page.
Package webgl draws scenes with WebGL 2 into a canvas of a web page.
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.
stylegen command
Command stylegen writes ui/style_merge_gen.go: the mergeFrom and layered methods of each widget style type (a struct named ...Style whose fields are Styles, other widget style types, or float32 sizes).
Command stylegen writes ui/style_merge_gen.go: the mergeFrom and layered methods of each widget style type (a struct named ...Style whose fields are Styles, other widget style types, or float32 sizes).
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.
webcheck command
Command webcheck draws a page of cards in a js build and prints a hash of its pixels, for the web build's CI job (scripts/web/check.sh).
Command webcheck draws a page of cards in a js build and prints a hash of its pixels, for the web build's CI job (scripts/web/check.sh).
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:
Package proc starts other programs from an app without flashing console windows.
Package proc starts other programs from an app without flashing console windows.
Package scene names starting states of an app's UI, such as an empty inbox, a long list or an error, so that development tools can open the app straight into one: `JAMB_SCENE=Inbox/Empty jamb dev`, `jamb ctl scene name=Inbox/Empty`, or a test that renders the scene's root.
Package scene names starting states of an app's UI, such as an empty inbox, a long list or an error, so that development tools can open the app straight into one: `JAMB_SCENE=Inbox/Empty jamb dev`, `jamb ctl scene name=Inbox/Empty`, or a test that renders the scene's root.
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