Mono UI / Go
Components.
Build interfaces with editable Go templates. Start with a working example and bring just the styles and behaviors it uses.
Proof settings
Component catalog
91 componentsButtons
Forms
Disclosure
Overlays
Navigation
Data display
Feedback
Layout
Installation
Start with Go.
Use Go 1.22 or later. From the Mono checkout, start the local Go server and open the URL it prints.
go run ./cmd/mono-ui serveUse Mono in your application
From an existing Go module, point the dependency to this checkout. Replace the path with the location on your machine.
go mod edit -require=mono.local/mono@v0.0.0
go mod edit -replace=mono.local/mono=/absolute/path/to/baseframeworkSave this example as main.go and run go run .. Visit http://localhost:8080 to try the switch. Register the asset handler once and declare the components used on each page in Head.
package main
import (
"bytes"
"io"
"log"
"net/http"
mono "mono.local/mono"
)
func main() {
mux := http.NewServeMux()
mux.Handle("/mono/", http.StripPrefix("/mono/", mono.UI.Assets()))
mux.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) {
var page bytes.Buffer
io.WriteString(&page, `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Settings</title>`)
if err := mono.UI.Head(&page, "/mono", "switch"); err != nil {
http.Error(w, "Could not load assets", 500)
return
}
io.WriteString(&page, "</head><body>")
err := mono.UI.Render(&page, "switch", mono.Props{
"Name": "guides", "Label": "Show layout guides", "Checked": true,
})
if err != nil {
http.Error(w, "Could not render switch", 500)
return
}
io.WriteString(&page, "</body></html>")
w.Header().Set("Content-Type", "text/html; charset=utf-8")
page.WriteTo(w)
})
log.Fatal(http.ListenAndServe("127.0.0.1:8080", mux))
}Own the source
From the Mono checkout, copy selected components to your app. The command includes each template, its example properties, the shared stylesheet, and any component-specific CSS or JavaScript.
go run ./cmd/mono-ui add -out /path/to/your-app/components tabs dialogIn your app, create library := mono.New(os.DirFS("components")) and use that library’s Assets, Head, and Render methods. Restart the Go process after editing a template. Mono caches parsed templates for subsequent requests.