News Github

Practical cross-platform immediate-mode GUI framework for Go


package main

import (
   	app "go.hasen.dev/shirei/app"

   	. "go.hasen.dev/shirei"
   	. "go.hasen.dev/shirei/widgets"
)

func main() {
   	app.SetupWindow("Small Demo", 400, 200)
   	app.Run(RootView)
}

var name string
var response = "Please give me your name"
var colorBG bool = true

func RootView() {
   	ModAttrs(Gap(10))
   	if colorBG {
  		ModAttrs(Background(220, 20, 90, 1))
   	}

   	Container(Attrs(Pad(20), Gap(10)), func() {
  		Label("Name:", FontWeight(WeightBold))
  		Container(Attrs(Row, CrossMid, Gap(10)), func() {
 			TextInput(&name)
 			if Button(SymInfo, "Hello") {
				if name == "" {
   					response = "Uh, sorry who are you again?"
				} else {
   					response = "Well, hello " + name + "!"
				}
 			}
  		})
  		Label(response)
   	})

   	Container(Attrs(Expand, Row, CrossMid, Pad2(10, 30), Gap(10), Background(0, 0, 98, 1),
        BoxShadow(2), BorderWidth(1), BorderColor(0, 0, 0, 1)), func() {
  		ToggleSwitch(&colorBG)
  		Label("Subtle Color Background")
   	})
}

Shirei is a practical GUI framework to create desktop applications as native Go programs, not as webpages, while having a high level of flexibility and fluidity!

Native, Cross-Platform, Immediate-Mode, Flexbox Layout, Ergonomic, No boilerplate, Robust Text Support.

"Shirei" derives from the Japanese spelling of "Simple Layout".ンプル・レイアウト → シレイ

Note: Shirei is still work in progress!

Latest release

» Shirei v0.5 — what's new

Getting Started

Import package name: go.hasen.dev/shirei

Github repo: https://github.com/hasenj/go-shirei

Copy the code sample above to a new file in an empty directory, then run the following to download the dependencies:

❯ go mod init main
❯ go mod tidy
❯ go run .

You can browse the demo directories on the github repo for more examples.

Read the Tutorial →

Features

Examples

These are real, working programs, not toy demos — each one is a small utility its author reaches for regularly, built to find out what Shirei feels like on something bigger than a snippet. The screenshots below were taken manually so each app is shown in a useful state; the same programs also support headless--png frames for snapshot tests.

Start with haystack if you only look at one — it's the biggest of the eight, and the best showcase of what Shirei feels like day to day.

haystack

Find-in-files, streamed live into a virtualized list.

process_monitor

A cross-platform task manager: macOS, Linux, Windows.

see_pprof

A native alternative to go tool pprof -http.

see_exe

What's inside a built Go binary, module by module.

du

A disk-usage visualizer with a background scan queue.

fontviewer

Every system font, rendering your own sample text.

icons

A filterable gallery of the bundled icon fonts.

piano

A playable keyboard over a Karplus-Strong string synth.

Each card links to that example's directory on GitHub, with a README and the full source. All eight live under examples/ in the go-shirei repo and run with go run ./examples/<name> after cloning.

Known Issues & Limitations

The following are known issues and limitations that we plan to tackle:

Mobile is under consideration (no decision yet). If it is supported, it will be limited to utility-style apps — not games or rich multi-touch experiences.

The following items are out of scope and will not be supported, at least for the time being:

For the full picture — immediate mode concepts, layout mechanics, colors and text styling, interaction, identity and animation, application patterns like tables/selection/background work, and a reference section of common mistakes — see the full tutorial, with runnable code throughout.