Practical cross-platform immediate-mode GUI framework for Go


package main

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

. "go.hasen.dev/shirei"
. "go.hasen.dev/shirei/tw"
. "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(BG(220, 20, 90, 1))
}

Layout(TW(Pad(20), Gap(10)), func() {
Label("Name:", FontWeight(WeightBold))
Layout(TW(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)
})

Layout(TW(Expand, Row, CrossMid, Pad2(10, ...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help