# MyGo > Build desktop apps in Go. Windows draw native UI that MyGo paints on the GPU, written in Go alone with package ui, or show a web frontend in the system webview that calls Go through a TypeScript client generated from your code. Pure Go with no cgo, and a few megabytes per app. Individual Markdown pages are listed below. All documentation is also available at https://mygo.egoist.dev/llms-full.txt. ## Documentation - [MyGo documentation](https://mygo.egoist.dev/docs.md): MyGo builds desktop apps in Go. Each window shows one of two kinds of interface, and one app can have windows of both: - [The application](https://mygo.egoist.dev/docs/app.md): mygo.App is the application: its lifecycle, its identity, and how it meets the rest of the system. - [MyGo architecture](https://mygo.egoist.dev/docs/architecture.md): This guide explains how MyGo is put together: the layers, the threading model, how Go talks to the native toolkits without cgo, how pages and Go exchange typed messages, how MyGo draws native UI, and how to extend the framework safely. Read it before changing anything under internal/. - [Audio](https://mygo.egoist.dev/docs/audio.md): Package audio plays sound from Go: effects decoded into memory, music streamed as it plays, and sound an app makes itself. It mixes everything playing in Go and sends it to the system's audio output, with no cgo, in apps of native UI or web pages, on every platform MyGo runs on, browsers included. - [Calling Go from the frontend](https://mygo.egoist.dev/docs/bindings.md): The frontend calls Go through bound services: Go values whose exported methods pages can call, and which may stream values back through channels. Go reaches pages with typed events. mygo generate turns them into a TypeScript client, so calls, channels and events are checked by the compiler on both sides and documented in your editor. - [The mygo CLI](https://mygo.egoist.dev/docs/cli.md): mygo creates, develops, packages and publishes MyGo apps. - [Configuration](https://mygo.egoist.dev/docs/configuration.md): mygo.config.ts, at the root of a project, describes the app and how the CLI develops and builds it. Its default export is the configuration, typed by defineConfig from the mygo-cli package that projects depend on, so editors complete and document every field: - [Clipboard and drag data](https://mygo.egoist.dev/docs/data-transfer.md): Package transfer describes serialized content shared by the system clipboard and native drag and drop. A Data value contains ordered items. Each item offers alternative formats for the same content; separate items describe separate values. Custom formats use MIME names and explicit encodings. Native data never contains a Go pointer or a process-local Go value. - [Building and distributing](https://mygo.egoist.dev/docs/distribution.md): mygo build turns a project into apps people install: an app bundle and a disk image on macOS, an executable and an installer on Windows, an executable, a desktop entry, an archive with its install script and a Debian package on Linux. - [Documents](https://mygo.egoist.dev/docs/documents.md): Apps whose windows each show a file, such as a text editor, a drawing app or a notes app, are document-based apps. mygo.NewDocuments gives them what AppKit's NSDocument and SwiftUI's DocumentGroup give Mac apps, on every platform: - [The frontend](https://mygo.egoist.dev/docs/frontend.md): Windows that show web pages show the pages of the app's frontend: HTML, CSS and JavaScript built with any tools. New projects use TypeScript and Vite, but MyGo only needs a URL to load, during development, and a directory of built files, for builds. Windows of native UI need no frontend, and an app that only has those has none. - [Getting started](https://mygo.egoist.dev/docs/getting-started.md): A MyGo app shows its windows with a web frontend, in the system's webview, or with native UI that MyGo draws itself, written in Go. mygo init starts a project of either kind, and an app can add windows of the other kind later. - [GitHub Actions](https://mygo.egoist.dev/docs/github-actions.md): A GitHub Actions workflow can build the apps of every platform when you push a tag, sign them, and upload them with their updates to a draft release, which you publish. Each platform builds on a runner of its own, at the same time. MyGo needs no cgo, so Ubuntu runners make the Windows apps as well as the Linux ones; the macOS app needs a macOS runner, because signing, notarization and disk images need macOS. - [Languages](https://mygo.egoist.dev/docs/i18n.md): A MyGo app says its messages in the language of the people who use it. Its messages live in catalogs, a JSON file per language, from which mygo dev and mygo build write a Go package with a typed function per message, which says it in the language the app shows, with the plural forms of that language. The whole app shows one language: its own messages, MyGo's controls and menus, and its pages if it has any. - [Launchers](https://mygo.egoist.dev/docs/launchers.md): A launcher, as Spotlight, Raycast, Alfred, PowerToys Run or Ulauncher, is summoned from anywhere with a keyboard shortcut, takes what the user types over the app they are in, and goes away as fast as it came. MyGo has the parts: a panel to show it in, a global shortcut to summon it, the installed apps and their icons to search, and an app without a Dock icon that lives in the tray. examples/launcher puts them together in native UI: - [Menus and the tray](https://mygo.egoist.dev/docs/menus.md): Menus are built from templates of *mygo.MenuItem and used as the menu bar, context menus, the Dock menu and the menus of tray icons. - [Desktop APIs](https://mygo.egoist.dev/docs/native.md): MyGo wraps the parts of the operating system desktop apps use most, for apps whose windows show web pages, native UI or both. Like the rest of MyGo, each can be called from any goroutine. - [Plugins](https://mygo.egoist.dev/docs/plugins.md): A plugin adds a feature to web pages in two halves: Go services, and a JavaScript package whose functions call them. The app uses the Go half with mygo.Use and imports the JavaScript half from npm. - [Fetch](https://mygo.egoist.dev/docs/plugins/fetch.md): The fetch plugin gives pages a fetch that makes HTTP requests from Go. It takes the options of the standard fetch and returns a standard Response, but the request leaves from the Go side of the app, so: - [Game](https://mygo.egoist.dev/docs/plugins/game.md): The game plugin (plugins/game) has what games need beyond what apps do: MyGo is an app framework, and these are opt-in, in a package of their own. It is all Go. Native UI draws a game as it draws the rest: package game runs its loop in an element and looks at its world through a camera, package game/gamepad reads its controllers, and core packages draw its pixel art (Pixelated bitmaps and parts of them) and play its sound (audio). - [Glass](https://mygo.egoist.dev/docs/plugins/glass.md): The glass plugin draws Liquid Glass in native UI, the material of macOS 26 and later: what is under an element shows through it, frosted, bent near its edges as through the rim of a lens, and lit along its hairline rim. It also draws macOS's scroll edges, which content scrolling under a bar fades or frosts under (Scroll edges), and blurs what is under an element without the glass, evenly or fading along a gradient (Blur). MyGo draws them with the plugin's shaders, on the GPU or the CPU, so they look the same on macOS, Windows and Linux. It is all Go: no JavaScript package, and nothing to mygo.Use. - [SQLite](https://mygo.egoist.dev/docs/plugins/sqlite.md): The SQLite plugin provides local databases to web pages and Go, including native UI apps. It ships prebuilt SQLite libraries and loads them through purego, so apps build without cgo or a C compiler. It supports macOS, Linux and Windows on amd64 and arm64. - [Terminal](https://mygo.egoist.dev/docs/plugins/terminal.md): The terminal plugin is a terminal for apps of native UI: a view that runs the user's shell, or any program, in a pseudo-terminal, with the terminal emulator of Ghostty, libghostty-vt. It is all Go, with no npm package: the emulator is a native library that the app loads at run time, with no cgo, and that mygo build and mygo dev put into the app. - [Updater](https://mygo.egoist.dev/docs/plugins/updater.md): The updater plugin gives an app the update window that Mac users know from Sparkle, on every platform: it checks for updates in the background, shows the release notes of a new version and offers to install it, skip it or remind the user later, then downloads it with a progress bar and relaunches the app into it. It is all Go, with no npm package, and works in apps of web pages and of native UI alike. Its window is a web page, or native UI with native.Plugin, for apps that show no web page at all. - [Watch](https://mygo.egoist.dev/docs/plugins/watch.md): The watch plugin lets pages follow changes to the directories and files the app lets them watch, such as a project open in an editor. Go code and native UI don't need it: they call mygo.WatchFiles directly (see Watching files), which the plugin uses too. - [WebSocket](https://mygo.egoist.dev/docs/plugins/websocket.md): The WebSocket plugin gives pages a WebSocket whose connections Go makes, with the API of the browser's. Unlike the webview's own, it: - [Auto-updates](https://mygo.egoist.dev/docs/updates.md): Apps built with MyGo update themselves from signed releases, published on GitHub or on any HTTPS server. mygo build signs each platform's build with your key, and mygo.Updater in the app downloads a newer version, checks the signature against the public key built into the app, and replaces the app with it. - [Windows](https://mygo.egoist.dev/docs/windows.md): A window is a native window that shows a web page, loaded from its URL, or native UI that MyGo draws, from its Content. Create windows with mygo.NewWindow once the app is ready: ## Native UI - [Native UI](https://mygo.egoist.dev/docs/ui.md): A window can show a user interface that MyGo draws itself instead of a web page. You write it in Go with package ui: there is no HTML, no JavaScript and no frontend build, and the window starts no webview, so it opens at once and uses little memory. MyGo draws it on the GPU, with Metal on macOS, Direct3D 11 on Windows and OpenGL on Linux. - [Accessibility](https://mygo.egoist.dev/docs/ui/accessibility.md): Assistive technology, such as VoiceOver on macOS, Orca on Linux and Narrator or NVDA on Windows, reads a window's native UI as it reads other apps: the widgets with their roles, names, values and states, the texts, and the elements that take the focus, as the content changes. It acts on them as the keyboard and the pointer would: it presses buttons, checks boxes, moves sliders, edits text inputs and moves the focus. - [Accordion](https://mygo.egoist.dev/docs/ui/accordion.md): ui.Accordion creates sections, one above the other in a bordered box, that ui.AccordionItem builds: a header showing a title, which a click opens and closes, as do Enter and Space, and below it what its function builds while its *bool is true. Each opens and closes on its own; Up and Down move the focus between their headers, as do Home and End. An item's Changed reports a click. - [Alert dialog](https://mygo.egoist.dev/docs/ui/alert-dialog.md): ui.AlertDialog asks about something important over the window while a *bool is true, as AppKit's alerts: a title, a message, and buttons, the last of which is the default, in the accent color, with the focus, which Enter clicks. Escape closes the alert choosing no button, as canceling does, whatever the buttons say, in any language; a click outside the alert does nothing. It returns the index of the button clicked, in the frame it is, which closes the alert, ui.AlertDismissed in the frame Escape closes it, and -1 otherwise. - [Autocomplete](https://mygo.egoist.dev/docs/ui/autocomplete.md): ui.Autocomplete creates a text input editing a *string that suggests, below it, those of a list of strings containing what was typed, those starting with it first: Up and Down move among them and Enter takes one, as does a click, while Enter on none is Submitted. Changed reports a change, typed or taken. - [Avatar](https://mygo.egoist.dev/docs/ui/avatar.md): ui.Avatar creates a picture of a person or a thing: its image, cropped to a circle, or, without one, the initials of its name on a color picked from the name, so that each person keeps theirs. It is a little more than twice as high as the theme's font size. - [Badge](https://mygo.egoist.dev/docs/ui/badge.md): ui.Badge creates a short text in a pill, as a count of unread messages beside a sidebar's item: - [Breadcrumbs](https://mygo.egoist.dev/docs/ui/breadcrumbs.md): ui.Breadcrumbs creates a path of items, as Finder's path bar and AppKit's path control, separated by chevrons: the items but the last are links, which a click chooses, as Enter does, setting an *int to its index, which Changed reports. Long items shorten with an ellipsis as room runs short. - [Native UI in browsers](https://mygo.egoist.dev/docs/ui/browsers.md): An app of native UI also runs in a browser, compiled to WebAssembly: its windows show on canvases of a page, drawn with WebGL 2 by the same renderer as on Linux, with the same shaders. Nothing changes in the app: - [Button](https://mygo.egoist.dev/docs/ui/button.md): ui.Button creates a push button showing a label, and ui.PrimaryButton one in the accent color, for the main action of a window or a dialog. Clicked reports a click, or Enter or Space while the button has the keyboard focus: - [Calendar](https://mygo.egoist.dev/docs/ui/calendar.md): ui.Calendar creates a month's calendar choosing the day of a *time.Time, as SwiftUI's graphical date picker: a click chooses a day, as the arrows do while the calendar has the keyboard focus; Page Up and Page Down, or its buttons, move by months, and Home and End go to the first and the last day of the month. Changed reports a new date, which keeps the time of day and the location of the value. - [Charts](https://mygo.egoist.dev/docs/ui/chart.md): Package ui/chart builds charts without a look of their own, as headless libraries such as visx do on the web, with the parts of Swift Charts: scales that map data onto a plot and pick round ticks, a plot with axes around it, marks that are elements you style as any other, paths of lines, areas and pie slices for Draw functions, stacking, and a selection that the pointer and the keyboard move. Every color, size and font is yours. - [Checkbox](https://mygo.egoist.dev/docs/ui/checkbox.md): ui.Checkbox creates a check box toggling a *bool, with a label: a click on the box or its label checks it or unchecks it, as does Space while it has the keyboard focus, and Changed reports a click. - [Code editor](https://mygo.egoist.dev/docs/ui/code-editor.md): Package ui/editor is a code editor and a diff viewer for native UI, designed after Zed's: syntax highlighting, several carets and selections, soft wraps, folding, finding and replacing, completions, hovers, diagnostics and inlay hints from the app or a language server, and the commands and keys of code editors. It lays out and paints only the lines in view, so a file of a million lines scrolls and edits as one of ten. - [Collapsible](https://mygo.egoist.dev/docs/ui/collapsible.md): ui.Collapsible creates a disclosure, as SwiftUI's DisclosureGroup: a label beside an arrow, which a click opens and closes, as do Enter and Space, showing below it what its function builds while a *bool is true. The arrow turns and the content grows into view as it opens. Changed reports a click. - [Color picker](https://mygo.egoist.dev/docs/ui/color-picker.md): ui.ColorWell creates a swatch of a *ui.Color that opens a color picker below it, as AppKit's color well: a click, Enter or Space opens it, and Escape or a click outside closes it. Changed reports a new color. - [Combobox](https://mygo.egoist.dev/docs/ui/combobox.md): ui.Combobox creates a combobox choosing a *string among options: a field showing the choice, whose text filters the options below it as the user types, those starting with it first, while a click or Down shows them all; a click showing them selects the choice, for typing to replace. Up and Down move among them and Enter chooses, as does a click; Escape closes them, and the text goes back to the choice when the field loses the focus. Changed reports a new choice. - [Context menu](https://mygo.egoist.dev/docs/ui/context-menu.md): ContextMenu gives an element a menu of the system's, which opens where the element is right-clicked (Control-clicked on macOS), and below it when the menu key or Shift+F10 is pressed while it or one inside it has the focus. The function builds the items when the menu opens, and runs again in the frame after one was chosen, where its Chosen reports it: - [Custom widgets](https://mygo.egoist.dev/docs/ui/custom-widgets.md): Every widget is built on a base, the same widget without a look: the base handles the pointer, the keyboard and the focus, and tells assistive technology what it is, and leaves every color, size and shape to the elements it returns, which you style as any other. Build a design of your own on them, as headless component libraries do on the web. - [Date input](https://mygo.egoist.dev/docs/ui/date-input.md): ui.DateInput creates a field showing a *time.Time as the user's regional formats write a date in numbers, as 1/5/2026 in the United States, 05/01/2026 in the United Kingdom or 2026/1/5 in China, which a calendar below it changes. A click, Enter or Space opens the calendar, where a click chooses a day, as do the arrows and Enter; Page Up and Page Down, or its buttons, move by months, and Escape closes it. Changed reports a new date, which keeps the time of day and the location of the value. - [Dialog](https://mygo.egoist.dev/docs/ui/dialog.md): ui.Modal shows a dialog its function builds over the dimmed window while a *bool is true; clicking outside it or pressing Escape sets it to false. - [Diff viewer](https://mygo.egoist.dev/docs/ui/diff-viewer.md): editor.DiffView shows the changes between two texts, as Pierre's diffs and code review tools do: side by side or one over the other, with the words changed within lines highlighted, the unchanged lines between changes collapsed, and the new text editable where it shows. It is a code editor on each side, with the editor's highlighting, selections and commands, laid out and painted only where in view. - [Drag and drop](https://mygo.egoist.dev/docs/ui/drag-and-drop.md): Drag(value) makes an element the source of a value dragged within the window: once the pointer pressing it moves a few DIPs, a translucent copy of the element follows the pointer, and the press is no click. ui.Drop[T](e) makes e take values of type T, returning the one dropped on it, and ui.DragOver[T](e) the one over it, for showing it would take it: - [Drawing and animation](https://mygo.egoist.dev/docs/ui/drawing.md): Draw paints on an element after its background, and DrawOver after its children, with a *ui.Painter in DIPs of the window: rectangles with Fill, FillGradient, Stroke and StrokeDashed, Shadow, Line, Image, Clip, paths of lines and curves with FillPath and StrokePath, or in a gradient with FillPathGradient and StrokePathGradient, and text with Text, or RichText in spans of any style, which MeasureText measures first, to center or align it: - [Editable text](https://mygo.egoist.dev/docs/ui/editable-text.md): ui.EditableText shows a *string as a text that the user edits in place, as a file's name in Finder: a double click on it, or Enter while it has the focus, shows a text input of it, with the text before its extension selected. Enter keeps what was typed, as moving the focus away does, and Escape goes back; Changed reports a new value. - [Find bar](https://mygo.egoist.dev/docs/ui/find-bar.md): ui.FindBar creates a bar for finding text while a *bool is true, as Safari's and Xcode's: a field of the query, which takes the focus as the bar opens with the last query selected, how many matches there are, previous and next buttons choosing the current match, and Done. - [Form](https://mygo.egoist.dev/docs/ui/form.md): A ui.Field labels the control its function builds: the label names the control for assistive technology, and a click on it focuses the control, or clicks a check box, a switch or a radio button. Description and Error add texts below the control, which assistive technology reads with it; an error also marks the control's value invalid, and a text input draws its border in the theme's Danger color. An empty error leaves the control valid: - [Grid view](https://mygo.egoist.dev/docs/ui/grid-view.md): ui.GridView shows items in a grid, as Photos' library and Finder's icon view: as many columns as fit items at least as wide as asked, sharing the width left, in rows of a height, built only as they show, so grids of millions of items are as fast as small ones. Gap spaces the items. - [Grid](https://mygo.egoist.dev/docs/ui/grid.md): ui.Grid lays its children out in columns and rows, as CSS grid does: they fill its cells row by row, and it adds rows as they need them. Columns(3) makes three columns of equal width; ColumnTracks sets them one by one, as ui.Fixed(220) DIPs, ui.Fr(1), a share of the room the others leave, or ui.FitContent(), as wide as their content: - [Back and forward buttons](https://mygo.egoist.dev/docs/ui/history-buttons.md): ui.BackButton and ui.ForwardButton create buttons going back and forward in a router's history, as in the toolbar of Finder or a browser: disabled at the ends of the history, and showing a chevron. Give them the router, a *ui.Router in your state: - [Icon](https://mygo.egoist.dev/docs/ui/icon.md): ui.Icon shows an SVG as an icon: in the color of the text, which it takes from its ancestors as text does, whatever colors the file has, and as high as the font size, keeping the SVG's aspect ratio. Icon sets such as Lucide, Heroicons, Tabler or Material Symbols work as they are: - [Image](https://mygo.egoist.dev/docs/ui/image.md): ui.Image shows a bitmap, or an SVG in its own colors, by default at its size in DIPs, scaled to fit when given another size. - [Input](https://mygo.egoist.dev/docs/ui/input.md): Elements report what the user did to them since the last frame, as you build them: ask, and handle it where the element is built. - [Inspector](https://mygo.egoist.dev/docs/ui/inspector.md): The inspector shows the elements of a window of native UI in a panel docked beside the content, as Chrome's developer tools show a page's: the tree of elements as markup, the styles, box model and properties of the one chosen, highlighted over the content, how long frames take, and issues. - [Layout](https://mygo.egoist.dev/docs/ui/layout.md): Elements lay out their children with flexbox, as in CSS, or in a grid, in device-independent pixels (DIPs): - [Link](https://mygo.egoist.dev/docs/ui/link.md): ui.Link creates a text that opens a URL in the browser, or the app registered for its scheme, when clicked, or with Enter while it has the keyboard focus. It shows in the accent color, underlined while the pointer is over it: - [List](https://mygo.egoist.dev/docs/ui/list.md): ui.List shows rows of a collection of any length: it builds only the rows in view, and a few beyond, so a list of millions of rows is as fast as one of ten. Rows take the height of their content, which may differ from row to row: the list measures rows as they show and estimates the others from them. - [Markdown](https://mygo.egoist.dev/docs/ui/markdown.md): Package ui/markdown shows Markdown in native UI: CommonMark, GitHub's tables, task lists, strikethrough and autolinks, footnotes and math. It is built for the replies of language models, which stream in token by token: text appended is parsed alone, half-written syntax shows as what it will become, and text comes in smoothly, fading in. - [Menu button](https://mygo.egoist.dev/docs/ui/menu-button.md): ui.MenuButton creates a button showing a label and an arrow, which opens a menu of the system's below it, as the system's pop-up buttons do: as the pointer goes down on it, or for Enter, Space or Down while it has the keyboard focus. The function builds the items when the menu opens, and runs again in the frame after one was chosen, where its Chosen reports it: - [Meter](https://mygo.egoist.dev/docs/ui/meter.md): ui.Meter creates a bar showing a value between two bounds, as AppKit's level indicator and the web's meter: in the theme's Success color, or Warning and Danger from the levels given, nil for none. - [Migrating to checked elements](https://mygo.egoist.dev/docs/ui/migration.md): Native UI views receive *ui.Context, child builders use func() callbacks, and widget constructors return ui.Element values. This guide covers source migration, build lifetimes, persistent control identity and focus bindings. - [Motion](https://mygo.egoist.dev/docs/ui/motion.md): An element animates values for you: you give the target, it returns the value to show in this frame, and draws frames until the value gets there. The view says where things are; the animation finds the way: - [Pages and navigation](https://mygo.egoist.dev/docs/ui/navigation.md): A ui.Router keeps the history of the pages of a window, or of a part of one, as a browser does for a tab. A page is a path, as /notes/42, which View matches to build the page shown, a switch over patterns whose {name} takes one part of the path and {name...} the rest. - [Number input](https://mygo.egoist.dev/docs/ui/number-input.md): ui.NumberInput creates a text input editing a *float64 as a number between two bounds, which Up and Down, and the buttons beside it, change by a step. What is typed applies as soon as it is a number in range, and shows rounded to the decimals of the step once the input loses the focus. Changed reports a new value. - [Outline](https://mygo.egoist.dev/docs/ui/outline.md): ui.Outline shows a tree of items, as AppKit's outline view and Finder's list view: items at the top, and below each item open its children, indented, with an arrow that opens and closes it. The app gives the items at the top and children, which returns an item's, nil for one without any; the outline builds only the rows in view, as a list does, so trees of any size are as fast as small ones. - [Overlays](https://mygo.egoist.dev/docs/ui/overlays.md): Overlays show above the window's content: dialogs over the dimmed window, alert dialogs, popovers below an element, the popups of selects and comboboxes, tooltips and toasts. They share how they treat the keyboard and what is behind them. - [Native UI performance](https://mygo.egoist.dev/docs/ui/performance.md): These measurements cover steady frames rendered on the CPU with ui.Tester. They were taken on October 8, 2026 on Apple M5, macOS arm64, Go 1.27.1, with CGO_ENABLED=0 GOMAXPROCS=1. Each timing is the median of six sequential 300 ms samples after warming the view. - [Popover](https://mygo.egoist.dev/docs/ui/popover.md): ui.Popover shows a panel its function builds below an element, its anchor, while a *bool is true; pressing outside it or Escape sets it to false. The press goes on to what is under the pointer, as with the web's popovers: a click on another button closes the popover and presses the button, and one on the anchor closes it, as the anchor toggles it. Where there is no room below the anchor, the panel shows above it, and it follows the anchor as the window scrolls. - [Progress bar](https://mygo.egoist.dev/docs/ui/progress.md): ui.Progress creates a progress bar filled to a value between 0 and 1; a negative value shows activity of unknown length, a segment sliding across. - [Radio](https://mygo.egoist.dev/docs/ui/radio.md): ui.Radio creates a radio button that selects its value into a *T, with a label: a click selects it, as does Space while it has the keyboard focus, and Changed reports it. The value can be of any comparable type. - [Range slider](https://mygo.egoist.dev/docs/ui/range-slider.md): ui.RangeSlider creates a slider of two knobs setting a low and a high *float64 between two bounds, as a price range: each knob takes the keyboard focus, which Tab moves between, and the arrows, Home and End move it while it has the focus; a press on the track moves the knob nearest to it. The knobs do not cross. Changed reports a new value. - [Rating](https://mygo.egoist.dev/docs/ui/rating.md): ui.Rating creates a row of stars, as AppKit's rating level indicator, of which an *int are filled: a click on a star sets the rating, a click on the star set clears it, and the arrows, Home and End change it while the rating has the keyboard focus. Changed reports a new value. - [Rendering](https://mygo.egoist.dev/docs/ui/rendering.md): MyGo draws on the GPU with Metal on macOS, with Direct3D 11 on Windows, or with WARP, Windows' own software renderer, where no GPU driver works, and with OpenGL on Linux, in the GtkGLArea GTK shows, and with WebGL 2 in browsers, with the shader of Linux. A shader computes rounded rectangles, borders, gradients and shadows from the distance to their edges, so they stay sharp at any size and scale, and text comes from a glyph atlas that only uploads what changes. - [Rich text editor](https://mygo.egoist.dev/docs/ui/rich-text-editor.md): Package ui/richtext edits attributed text, as NSTextView does on macOS and SwiftUI's TextEditor bound to an AttributedString. It supports: - [Right to left](https://mygo.egoist.dev/docs/ui/right-to-left.md): Arabic, Hebrew, Persian and Urdu read from right to left, and so do the interfaces of apps in those languages: a row starts at the right, a sidebar is on the right, a back arrow points right. Native UI lays a window out so when the app's language reads right to left, as Flutter's Directionality, SwiftUI's layoutDirection, CSS's direction and GTK's text direction do. The coordinate system is not mirrored, as in Godot: X still grows to the right in Rect, in what Draw paints, and in the pointer's position. Only the layout is. - [Scroll view](https://mygo.egoist.dev/docs/ui/scroll.md): ui.Scroll and ui.ScrollHorizontal scroll their children with the wheel, the touchpad, their scroll bar and the keyboard: the arrow keys, Page Up and Page Down, Space, Home and End scroll the container around the focus, or under the pointer, unless the focused element takes those keys, as a text input does. ui.ScrollBoth scrolls both ways, as a canvas or a wide table does. - [Search field](https://mygo.egoist.dev/docs/ui/search-field.md): ui.SearchField creates a field for searching, editing a *string: a magnifying glass, the text, and a button clearing it while it holds any, as Escape does then. It shows "Search" while empty. Changed reports a change, and Submitted Enter. - [Segmented control](https://mygo.egoist.dev/docs/ui/segmented.md): ui.Segmented creates a segmented control showing labels, of which an *int is the index of the one chosen, as a switch between views: a click chooses a segment, as do the arrows while it has the keyboard focus, and Changed reports a new choice. - [Select](https://mygo.egoist.dev/docs/ui/select.md): ui.Select creates a drop-down choosing one of a list of strings into a *string: a click on it, or Enter, Space, Up or Down while it has the keyboard focus, opens its options below it, where the arrows, Home and End move among them and Enter, Space or a click chooses one; Escape closes them. Changed reports a new choice. - [Shaders](https://mygo.egoist.dev/docs/ui/shaders.md): A shader computes the color of every pixel of a rectangle, on the GPU, from its position, values the app passes it each frame and images it reads: noise and gradients that move, a texture lit pixel by pixel, a ripple across the window. Package ui/shader compiles shaders written in Go's syntax, and draws them on whichever GPU renderer draws the window (Metal, Direct3D 11, OpenGL or WebGL 2), and on the CPU where none can, the same pixels within rounding. - [Sidebar](https://mygo.egoist.dev/docs/ui/sidebar.md): ui.Sidebar is a source list, as the sidebars of Finder and Mail: items with icons, in sections whose titles hide and show them, choosing the ID of one into a *string. It scrolls when they do not fit. Give it a width: - [Slider](https://mygo.egoist.dev/docs/ui/slider.md): ui.Slider creates a slider setting a *float64 between a low and a high value: dragging the knob, or a press on the track, sets it, as do the arrows, Page Up and Page Down (a tenth of the range), Home and End while it has the keyboard focus. Changed reports a new value. - [Spinner](https://mygo.egoist.dev/docs/ui/spinner.md): ui.Spinner creates an indicator of work of unknown length, as AppKit's spinning progress indicator: spokes turning, in the theme's muted text color, a little higher than the theme's font size. - [Split view](https://mygo.egoist.dev/docs/ui/split.md): ui.Split lays out two panes side by side, with a divider between them that the user drags to resize them, or moves with the arrows once it has the keyboard focus: a *float32 is the width of the first, which the divider keeps 40 DIPs from either edge. When the window leaves less room than that, the first pane gives way so the second keeps its 40 DIPs, and the first takes its size back when there is room again; the *float32 keeps the size the user chose. Changed reports a move. - [Stepper](https://mygo.egoist.dev/docs/ui/stepper.md): ui.Stepper creates a pair of arrows changing a *float64 by a step between two bounds, as AppKit's stepper beside a field: a click on an arrow steps up or down, as do Up and Down while the stepper has the keyboard focus, and holding an arrow keeps stepping, faster the longer it is held. Changed reports a new value. - [Styling and themes](https://mygo.egoist.dev/docs/ui/styling.md): Background, Border, Radius, Shadow and Opacity style an element's box, and Cursor sets the pointer over it: - [Switch](https://mygo.egoist.dev/docs/ui/switch.md): ui.Switch creates a switch turning a *bool on and off, for a setting that applies at once: a click turns it over, as does Space while it has the keyboard focus, and its knob slides across. Changed reports a click. - [Table](https://mygo.egoist.dev/docs/ui/table.md): ui.Table puts a list's rows in columns, under a header of ui.TableColumns, each with a title, a width (or 0 to share the room the others leave) and an alignment; cell builds the content of a row's column, usually a Text. It builds only the rows in view, as a list does, and rows are as high as their tallest cell, so text that wraps makes its row taller. - [Tabs](https://mygo.egoist.dev/docs/ui/tabs.md): ui.Tabs creates a row of tabs showing labels, of which an *int is the index of the one chosen. A click chooses a tab, as do the arrows, Home and End while one has the keyboard focus, which follows the choice; Changed reports a new choice. Build the page of the tab chosen below them: - [Testing](https://mygo.egoist.dev/docs/ui/testing.md): ui.NewTester runs a view without a window, as fast as a unit test: it renders frames in memory, finds elements by their text, and clicks, types, scrolls and presses keys. - [Text-input primitives](https://mygo.egoist.dev/docs/ui/text-input-client.md): TextInputBase and TextAreaBase provide ordinary editable string controls without a look. For a control with its own storage, selections, rendering or editing policy, attach a TextInputClient to an element: - [Text input](https://mygo.egoist.dev/docs/ui/text-input.md): ui.TextInput creates a single-line text input editing a *string, and ui.TextArea a multi-line one. They change the string as the user types: read it, or ask Changed for work that follows, and Submitted for Enter in a single-line input. - [Text](https://mygo.egoist.dev/docs/ui/text.md): ui.Text shows text that wraps at the width it gets, and ui.Textf formats it: - [Time input](https://mygo.egoist.dev/docs/ui/time-input.md): ui.TimeInput creates a field of the time of day of a *time.Time, in the hour cycle of the user's regional formats (Context.Region): 15:04, or 3:04 PM, whose hours, minutes and half of the day each take the keyboard focus, as the segments of AppKit's date picker: Up and Down step the one with the focus round the clock, digits typed set it, going on to the minutes once the hours are typed, the first letter of AM or PM (or of the language's names of them) chooses the half of the day, and Left and Right move between them. The names of the halves of the day and their place are the window's language's: 下午3:04 in Chinese, with the half first. Changed reports a new time, which keeps the date and the location of the value. - [Toast](https://mygo.egoist.dev/docs/ui/toast.md): c.Toast shows a message near the bottom of the window for a few seconds, as the outcome of what the user just did: - [Toggle](https://mygo.egoist.dev/docs/ui/toggle.md): ui.Toggle creates a button that stays pressed while a *bool is true, as Bold in an editor's toolbar: a click presses it or lets it go, as does Space while it has the keyboard focus, and Changed reports a change. - [Token field](https://mygo.egoist.dev/docs/ui/token-field.md): ui.TokenField creates a field of tokens, as of tags or the recipients of a mail, editing a *[]string: the tokens show as chips, each with a button taking it out, before an input where Enter or a comma adds what was typed, and Backspace in it while empty takes out the last. The suggestions containing what was typed show below it, those not already tokens: Up and Down move among them, and Enter or a click adds one. Changed reports a change. - [Toolbar](https://mygo.egoist.dev/docs/ui/toolbar.md): ui.Toolbar creates a row of controls, as along the top of a window: buttons, toggles, toggle groups, segmented controls and menu buttons, which take no face of their own until hovered. ui.Spacer pushes those after it to the end. - [Tooltip](https://mygo.egoist.dev/docs/ui/tooltip.md): Tooltip shows a tip once the pointer rests on an element, or the keyboard focus comes to it, and describes the element to assistive technology: - [Transforms](https://mygo.egoist.dev/docs/ui/transforms.md): Translate, Scale, and Rotate change an element and everything inside it visually, while layout reserves its original space. They work on boxes, text, images, controls, and custom drawings. The pointer follows what is drawn, including nested transforms and clips: - [Transitions](https://mygo.egoist.dev/docs/ui/transitions.md): Transition makes an element move smoothly where the layout changes it: from where the last frame showed it to where it is now, in its parent, at its size, and in its background and border colors. The view says only where things are; the transition animates the way there. - [Tree](https://mygo.egoist.dev/docs/ui/tree.md): ui.Tree creates a tree whose items ui.TreeItem builds, each inside the item it belongs to. An item's children show while its *bool is true; a click on its arrow opens or closes it, and Clicked reports a click elsewhere on it, or Enter, for choosing it, which Selected shows. - [Views](https://mygo.egoist.dev/docs/ui/views.md): The view is a function from your app's state to its interface. MyGo calls it on the main thread to build frames after input, model changes and while something animates. A frame can contain several build passes, so it can show the outcome of an action before it is painted. - [Web view](https://mygo.egoist.dev/docs/ui/web-view.md): ui.WebView shows a web page in a window of native UI: a document the web engine renders beside native controls, a page per tab, a preview of HTML the app makes. The page is the system's web view (WKWebView, WebView2, WebKitGTK), made with Window.NewWebView, and works as a window's page does: it loads the app's frontend, calls bound Go methods with the typed client and hears events. What the view paints after the web view shows over the page: a menu opening from a button above it, a select's options, a dialog and its dimmed backdrop, tooltips, toasts, a badge over a corner. - [Windows with native UI](https://mygo.egoist.dev/docs/ui/windows.md): A window with Content takes the window options of any window, such as its size, StateKey, Frameless and Parent, as well as menus, dialogs and the other desktop APIs. It has no page: Page() is nil, and it ignores URL and WindowOptions.Page. Its Go code needs no bindings: the view calls it directly. CapturePage returns a PNG of what it shows.