Awesome Go

loom

CategoryCommand Line
SubcategoryAdvanced Console UIs
Stars0

Signal-based reactive components framework for building TUIs

About loom

func Counter() Node {
	count, setCount := Signal(0)

	go func() {
		for {
			time.Sleep(time.Second / 30)
			setCount(count() + 1)
		}
	}()

	return P(Text("Count: "), BindText(count))
}

Features

  • Pure Go | No extra compiler.
  • Multi-plateform | Built-in support for TUIs and SPAs.
  • Signal-based | Concurrency-safe reactive model with signals, effects, memos, etc.
  • Components | Define your UI as declarative JSX-like components.

Quick-start

go mod init my-project
go get github.com/loom-go/loom github.com/loom-go/term
package main

import (
	"log"
	"time"

	"github.com/loom-go/loom"
	. "github.com/loom-go/loom/components"
	"github.com/loom-go/term"
	. "github.com/loom-go/term/components"
)

func Counter() loom.Node {
	frame, setFrame := Signal(0)

	go func() {
		for {
			time.Sleep(time.Second / 120)
			setFrame(frame() + 1)
		}
	}()

	return Box(Text("Count: "), BindText(frame))
}

func main() {
	app := term.NewApp()

	for err := range app.Run(term.RenderInline, Counter) {
		app.Close()
		log.Fatalf("Error: %v\n", err)
	}
}
go run .

And it's live!

Documentation

You can visite loom's website for the full documentation.

License

MIT


Go Reference Go Report Card Codecov

Frequently Asked Questions

What is loom?

loom is a Command Line library for the Go programming language. Signal-based reactive components framework for building TUIs

How do I install loom?

Install loom with the Go module system using `go get loom-go/loom`. Check the repository for the current installation instructions.

What category does loom belong to?

loom is listed under Command Line, specifically Advanced Console UIs.

← Back to Advanced Console UIs