A GUI library for Go that doesn't make you want to switch to web dev.
Thank you to the early adopters who supported Proton from the very beginning!
![]() @VioGrafu(First Stargazer) |
![]() @bigwhite |
![]() @TanmayCzax |
![]() @aurax |
![]() @DemonK1 |
![]() @pekim |
![]() @fbaube |
![]() @gorilacrocodille |
![]() @alanmsant2 |
package main
import "github.com/CzaxStudio/proton"
type UI struct {
name proton.Editor
btn proton.Clickable
}
func main() {
u := &UI{}
a := proton.New("my app")
a.Window("Hello", 480, 300, func(win *proton.Win) {
proton.H3(win, "Hello from Proton!")
proton.Gap(win, 8)
proton.Input(win, &u.name, "Your name")
proton.Gap(win, 8)
if proton.Button(win, &u.btn, "Go") {
println("Hello,", u.name.Text())
}
})
a.Run()
}go get github.com/CzaxStudio/proton
Linux system deps:
apt install libwayland-dev libxkbcommon-dev libvulkan-dev
macOS and Windows need nothing extra.
Your draw function runs every frame. Call widget functions in order — they stack vertically by default. State lives in your own struct using Proton's re-exported types, so you only ever need one import.
type UI struct {
btn proton.Clickable // button
name proton.Editor // text input
checked proton.Bool // checkbox / toggle
choice proton.Enum // radio group
vol proton.Float // slider
scroll proton.Scrollable // list / scroll area
}Label H1–H6 Body2 Caption Text Muted ColoredText ErrorText SuccessText WarningText
Button OutlineButton IconButton Tappable Link LinkSmall
Input TextArea Checkbox Toggle RadioButton Slider ProgressBar NumberInput SelectBox
List HList Scroll TextView LogView
Row Column RowSpread RowEnd GrowRow GrowColumn GrowItem FixedItem FlexSpacer
Split HSplit ResizeSplit ResizeHSplit Center ZStack
Pad PadH PadV PadSides Gap Grid MinSize MaxWidth
Divider LabeledDivider Rect RoundRect Card HoverCard Badge StatusDot
Image CodeBlock ShortcutHint ColorSwatch
Toast Alert AlertDismissable Tooltip Spinner
Overlay Tabs Accordion ContextMenu
If OnKey FocusArea
Widgets stack vertically by default. Use Row or Column to group them differently.
// side by side
proton.Row(win,
func(win *proton.Win) { proton.Label(win, "left") },
func(win *proton.Win) { proton.Label(win, "right") },
)
// one child fills remaining space
proton.GrowRow(win,
proton.FixedItem(win, func(win *proton.Win) { proton.Label(win, "Search:") }),
proton.GrowItem(win, func(win *proton.Win) { proton.Input(win, &e, "") }),
proton.FixedItem(win, func(win *proton.Win) { proton.Button(win, &b, "Go") }),
)
// split pane (draggable)
proton.ResizeSplit(win, &u.split, 0.35, leftFn, rightFn)
// padding
proton.Pad(win, 16, func(win *proton.Win) { ... })
proton.PadSides(win, 8, 16, 8, 16, func(win *proton.Win) { ... })
// blank gap
proton.Gap(win, 12)a.ApplyPalette(proton.DarkPalette)
a.ApplyPalette(proton.NordPalette)
a.ApplyPalette(proton.RosePinePalette)
a.ApplyPalette(proton.CatppuccinPalette)
// custom
a.ApplyPalette(proton.Palette{
Bg: proton.RGB(0x1e1e2e),
Fg: proton.RGB(0xcdd6f4),
Primary: proton.RGB(0x89b4fa),
PrimaryFg: proton.RGB(0x1e1e2e),
})
a.SetFontScale(1.1)proton.Alert(win, proton.AlertInfo, "Informational message.")
proton.Alert(win, proton.AlertSuccess, "Operation completed.")
proton.Alert(win, proton.AlertWarning, "Proceed with caution.")
proton.Alert(win, proton.AlertError, "Something went wrong.")
// dismissable
if proton.AlertDismissable(win, &u.closeBtn, proton.AlertInfo, "Click × to close") {
u.showAlert = false
}
// toast — call last in your draw function
u.toast.Show("Saved!", 2*time.Second)
proton.Toast(win, &u.toast)go func() {
result := fetchFromAPI()
u.data = result
win.Invalidate() // ask for a redraw
}()proton.OnKey(win, key.ModCtrl, "S", func() { save() })
proton.OnKey(win, 0, key.NameEscape, func() { closeDialog() })go run ./examples/hello # 7 lines, one window
go run ./examples/todo # classic todo list
go run ./examples/calculator # buttons and state
go run ./examples/showcase # layout and theming demo
go run ./examples/kitchen # every widget in one placeSee the docs repo for detailed per-topic guides:
- [Getting started]
- [Text]
- [Buttons]
- [Inputs]
- [Layout]
- [Lists]
- [Visuals]
- [Theming]
- [Advanced]
- [Examples]
MIT








