Introduction
A Go component library for native desktop applications, built on MyGo.
Onevra provides themed controls, window shells, Lucide icons and complex components for native desktop applications written in Go. It is built on MyGo, which draws the interface itself, so applications need no web view, markup or JavaScript.
Loading the live example…
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/oneo-me/onevra/source/components"
)
type todo struct {
title string
done bool
}
type todoList struct {
draft string
items []todo
}
func (l *todoList) View(c *ui.Context) {
ui.Column(c).Width(340).Gap(12).Children(func() {
ui.Row(c).FillWidth().Gap(8).Children(func() {
input := components.TextBox(c, &l.draft, components.TextBoxOptions{}).
Placeholder("Add a task").Label("New task").Grow(1)
add := components.Button(c, "Add", components.ButtonPrimary)
if (input.Submitted() || add.Clicked()) && l.draft != "" {
l.items = append(l.items, todo{title: l.draft})
l.draft = ""
}
})
left := 0
for i := range l.items {
ui.Box(c).Key(i).Children(func() {
components.Checkbox(c, &l.items[i].done, l.items[i].title)
})
if !l.items[i].done {
left++
}
}
components.Text(c, fmt.Sprintf("%d of %d left", left, len(l.items))).
TextColor(c.Theme().TextMuted)
})
}The example above is real Onevra code. Every example in these docs is compiled to WebAssembly and runs in the page, drawn by the same renderer MyGo uses on Linux; the source beneath it is the file that runs.
Design principles
Onevra builds on MyGo rather than replacing it:
- Refine built-in components. Onevra restyles MyGo's controls and merges them into a smaller, consistent API.
- Fill the gaps. It adds components MyGo does not have, such as charts, chat, settings surfaces and window shells.
- Defer to upstream. When MyGo provides a feature Onevra already has, Onevra may remove its own and switch to MyGo's.
Applications own their state, localized text, persistence and background work. Components are product-neutral: they take application-built content through slots instead of business-specific options.
What is included
Components
Buttons, inputs, selections, collections, overlays, charts and conversations.
Window shells
A plain window and a sidebar window with native window controls.
Theming
Onevra's warm light and dark palettes, or a theme of your own.
Icons
More than 1,800 Lucide icons as named Go accessors.
Use MyGo directly for the rest
Onevra covers everyday controls, not MyGo's full catalog. Use MyGo directly for layout primitives such as ui.Row, ui.Column and ui.Grid, native menus, web views, the code editor, Markdown documents and every MyGo plugin, including Glass. When Onevra has a component for a purpose, use it instead of MyGo's styled widget, so the window keeps one look.
Next steps
Start with the quick start, then read views and state to see how a builder runs.