Ryugo is a design system with weight: controls lit from above, wells pressed
into the surface, cards that lift, lean and land, checks that draw
themselves. Its components are for MyGo's
native UI (package ui), drawn by MyGo itself on macOS, Linux, Windows and
in the browser, in pure Go without cgo.
Everything stands on two surfaces: a raised control that takes the light
from above, and an inset well you type into, with tokens written in OKLCH,
three size steps and one type scale. Behavior (focus, keyboard,
accessibility) comes from MyGo's unstyled …Base widgets; Ryugo gives them
the look.
Coming soon: the package isn't published yet. Its first release will say here how to add it to an app.
import (
"github.com/egoist/mygo/ui"
ryugo "github.com/imhalid/ryu-go"
)
func (a *app) view(c *ui.Context) {
t := ryugo.Root(c, ryugo.Options{})
ryugo.Card(c, ryugo.CardOptions{Title: "Report", Pad: true}, func() {
ryugo.Field(c, ryugo.FieldOptions{Label: "Search"}, func() {
ryugo.Input(c.Key("q"), &a.query, ryugo.InputOptions{Label: "Search", Clearable: true})
})
if ryugo.Button(c.Key("go"), "Apply", ryugo.ButtonOptions{Color: t.Colors.Accent, Variant: ryugo.Solid}).Clicked() {
a.apply()
}
})
ryugo.Toaster(c)
}Run the gallery, a tour of every component, from a clone of this repository:
go run ./cmd/galleryRoot themes the window and Scope a region; fields left unset are
inherited, and the nearest scope wins.
- Mode:
Light,Dark, or the system's appearance. - Size:
Sm,Md,Lg. A button and a field of the same step are the same height. - Corners:
CornersSm,CornersMd,CornersLg: the radii of cards, fields, menus and tables at half, at, or one and a half times Ryugo's. Pills and circles keep their shape, and a surface nested inside another keeps its corners concentric with it (Concentric: the outer radius less the padding). - Accent: a brand color. The accent ramp, selection fills and rings take its hue and chroma at Ryugo's lightness steps, so contrast holds in both themes.
ryugo.Root(c, ryugo.Options{Accent: ui.Oklch(0.56, 0.2, 295), Corners: ryugo.CornersLg})
ryugo.Scope(c, ryugo.Options{Size: ryugo.Sm}).Children(func() { ... })The tokens are Go values in tokens.go, written in OKLCH.
| Group | Components |
|---|---|
| Controls | Button, CopyButton, SplitButton, Input, Select, Field, Card |
| Selection | Checkbox, Radio, Choice, Switch, Segmented, Slider |
| Forms | Textarea, NumberInput, Combobox, DatePicker, TagInput |
| Navigation | Tabs, TabPanel, Link |
| Disclosure | Collapsible, Accordion |
| Toolbars | Toggle, ToggleGroup, Separator |
| Layers | Dialog, Sheet, Popover, Menu, MenuButton, Tooltip, Toaster |
| Chat | Chat, Message, Typing, DaySeparator, Composer |
| Drag and drop | Sortable, DragCard, DropArea, DropZone, FileItem |
| Indicators | Badge, Tag, StatusDot, Kbd, Avatar, EmptyState |
| Feedback | Progress, Meter, Spinner, Skeleton, SkeletonText |
| Data | Table, Pagination |
| Workspace (experimental) | Dock (with ryu-go/dockwin for its windows) |
| Palettes (experimental) | Palettes, Board, PaletteSet.Palette (with ryu-go/palettewin for windows of their own) |
Layers move on quick springs: they spring in, and leave faster than they came.
- Buttons: with
Options{Waves: true}a press sends a wave through the button from where it landed: the surface, its outline and its label swing out and back as a sine that dies away, a shader distorting what the button draws, a very faint white light on its crests (a press by keyboard sends it from the middle). The same wave, tuned to each, runs through a Dialog or a Sheet as it settles, a dropped card as it lands, a DropZone where files fell, a new Chat bubble from its tail corner, a Switch's track as it turns and Segmented's track as the pill goes. A Dialog closed by its Danger button burns away instead of fading: a ragged front of fire in the accent's blue runs out from the press, charring the card to a clean edge of pale ash, with flames, a glow on the page, and sparks and flakes rising (Cancel, Escape and the scrim still fade). With Reduce Motion no wave or burn plays. WithOptions{Sounds: true}the press is heard too: a short muted tap from the side pressed, lower and fuller for a solid button and low and short for a dangerous one. Waves and sounds are off by default. - Dialogs drag by their header: they lean into the motion, glide on when thrown and spring back inside the window.
- Dialogs and sheets come in over a soft scrim that fades in with them: a dialog rises from 94%, a sheet slides in from the edge, tilted a little. Closing, they fade or slide out, and let the pointer through to the page at once.
- Scroll edges: content scrolling inside a dialog or sheet fades into its header and footer.
- Drag and drop: a card picked up lifts and follows the pointer, leaning into the motion; the cards where it would go slide apart, and it flies into its place when let go. A column taking it glows, a cloud's shadow of the accent drifting across it, and a light runs up both its sides as it lands. Sortable rows also move with Alt+Up and Alt+Down.
- Table: rows built only as far as they show, sorted by a click on a header (Shift-click adds a key), chosen with checkboxes (Shift-click for a range) under a selection bar that springs in over the toolbar. A column picked up by its header lifts and the others slide aside for it; its end edge resizes it. Rows slide to their new places as the sort changes, new ones fade in, removed ones fade where they were, and a page turns sideways. Search, a view menu for columns and density, opening rows for details, a pinned first column, pages, and loading, empty and error states come with it. A click on a row, or Enter, opens it (
Open),Rowhands every row to the app for a context menu, andLabels(withPaginationLabels) puts the words in the app's language. A table wider than its room fades at the edge with more beyond it. A column'sFoot(a sum, a count) shows in a footer row that stays under the rows. WithGroup, rows show under a heading per group, in the order the groups come in the rows, sorted within them; a click on a heading folds it. WithReorder, a row is dragged by its grip (or moved with Alt+Up and Alt+Down) and the others slide apart for it; the app moves its own slice, and no grip shows while a header sorts. - Glass: popovers, menus and toasts are frosted glass, from MyGo's
plugins/glass. Tooltips are raised, as buttons are, follow the pointer along their element, and get out of its way when it comes onto them. - Toasts: they come from MyGo's
Context.AddToast. A new one rises from below, growing to its size, as two lights of Ryugo's border beam run round it from opposite sides; older ones tuck behind it and spread out under the pointer. A swipe to the side sends one away, and aToastLoadingtoast turns into its result in place.
Experimental: what Dock is for isn't settled yet; its API may change
or go without notice.
Dock fills a window with areas as Blender does: edge to edge, every
edge shared. Its layout is plain data the app owns (Layout), saved as
JSON and read back as it was; a pane is a view of the app's data, never
its holder, so it goes anywhere without losing what it shows.
- Edges drag, and the edges lined up with them move along; Option moves one alone, cut where edges across it meet it. An edge dragged settles onto an edge it would line up with, and a light runs along it. Where edges meet, a drag moves both ways.
- Corners split an area (dragged inward) or join it to a neighbor (dragged into it). Undo and Redo go back and forth through every change.
- Tabs: every pane is a tab of its area's stack, the chosen one on a raised pill that slides between them, as Segmented's. Dragged, a tab lifts; over an area, a compass in its middle and targets on the window's edges say where it would dock, and a region shows it. A right click splits the area with it, sends it to a window of its own, or closes it; a double click maximizes the area (Ctrl+Space too).
- Tabs elsewhere:
DockOptions.NoHeadersleaves the main window's areas without their headers, and the app shows the tabs where it likes:Layout.Tabslists them (the area each is in, and whether it is the one shown),ShowPaneshows one and focuses its area,ClosePanecloses one as its × does (a step of Undo; an area left empty folds away). Windows torn off keep their headers. - Windows: with a
DockHost(dockwin.New, on MyGo's windows), a tab dragged out of the window tears off into a window of its own where it is let go, and docks into another window it is let go over. Windows torn off have no title bar: their headers move them, a window's only tab carries it to dock it elsewhere, and their top right area closes them, giving what they hold back to the main one. Windows keep their places in the layout. On Wayland, where the system doesn't say where windows are, tabs tear off but don't dock from one window into another by a drag; their menu moves them back.
layout := ryugo.NewLayout(ryugo.DockSplit(ryugo.DockRow, []float32{0.25, 0.75},
ryugo.DockArea(&ryugo.Pane{Kind: "files", Title: "Files"}),
ryugo.DockArea(&ryugo.Pane{Kind: "editor", Title: "main.go"}),
))
ryugo.Dock(c.Key("dock"), layout, ryugo.DockOptions{
Kinds: []ryugo.DockKind{{Kind: "files", Title: "Files", Build: app.files}, {Kind: "editor", Title: "Editor", Build: app.editor}},
OnChange: app.saveLayout,
}).Fill()Tool panels floating over a canvas, as Pixelmator Classic's: a dark glass
HUD in both themes, a thin title bar with a round close button. A palette
moves by its title bar, lifting as it goes, and settles onto the board's
edges and onto the palettes near it, as a magnet would; a light runs along
the edge it settles onto. A press brings it to the front, a double click on
its title folds it up, and closed, it shrinks away. Where the palettes are
is plain data (Board), to save. Given a host (palettewin.New, on
MyGo's windows), they float in windows of their own over the app's, as
Pixelmator Classic's, settling onto the screen's edges, the app's window
and each other; where the system doesn't let windows go where asked
(Wayland), they float over their board in the app's window. Experimental,
as the Dock.
ryugo.Palettes(c.Key("studio"), &app.board, func(p *ryugo.PaletteSet) {
app.canvas(c)
p.Palette("layers", ryugo.PaletteOptions{Title: "Layers", At: ui.Point{X: -12, Y: 12}}, app.layers)
}).Fill()go vet ./...
go test ./... # interaction tests through ui.Tester
go test -short ./... # skips the tests that draw glass on the CPU
RYUGO_SNAPSHOTS=/tmp/ryugo go test -run 'Snapshot|SelectOpen' ./gallery/ # PNGs of every pageThe website, with a page and a live preview of every component, is in
website (its pages in docs): bun install && bun run dev
there.
Everything builds with CGO_ENABLED=0 for Linux, macOS, Windows and
js/wasm. CI runs all of it and keeps the snapshots as an artifact.







