# WebUI Go
#### [Features](#features) · [Installation](#installation) · [Usage](#usage) · [Documentation](#documentation) · [WebUI](https://github.com/webui-dev/webui)
[build-status]: https://img.shields.io/github/actions/workflow/status/webui-dev/go-webui/ci.yml?branch=main&style=for-the-badge&logo=go&labelColor=414868&logoColor=C0CAF5
[last-commit]: https://img.shields.io/github/last-commit/webui-dev/go-webui?style=for-the-badge&logo=github&logoColor=C0CAF5&labelColor=414868
[release-version]: https://img.shields.io/github/v/tag/webui-dev/go-webui?style=for-the-badge&logo=webtrees&logoColor=C0CAF5&labelColor=414868&color=7664C6
[license]: https://img.shields.io/github/license/webui-dev/go-webui?style=for-the-badge&logo=opensourcehardware&label=License&logoColor=C0CAF5&labelColor=414868&color=8c73cc
[![][build-status]](https://github.com/webui-dev/go-webui/actions?query=branch%3Amain)
[![][last-commit]](https://github.com/webui-dev/go-webui/pulse)
[![][release-version]](https://github.com/webui-dev/go-webui/releases/latest)
[![][license]](https://github.com/webui-dev/go-webui/blob/main/LICENSE)
> Use any web browser or WebView as GUI.\
> With Go in the backend and modern web technologies in the frontend.

## Features
- Parent library written in pure C
- Fully Independent (_No need for any third-party runtimes_)
- Lightweight ~200 Kb & Small memory footprint
- Fast binary communication protocol between WebUI and the browser (_Instead of JSON_)
- Multi-platform & Multi-Browser
- Using private profile for safety
## Installation
### As Go Module
Until the next stable releas, it is recommended to use the development version
```sh
go get github.com/webui-dev/go-webui/v2@main
```
### As git clone in a local directory
```sh
# E.g., doing a lightweight, filtered clone
git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules \
https://github.com/webui-dev/go-webui.git
```
## Usage
### Example
```html
Welcome to WebUI!
```
```go
// main.go
package main
import (
"fmt"
ui "github.com/webui-dev/go-webui/v2"
)
func greet(e ui.Event) string {
name, _ := ui.GetArg[string](e)
fmt.Printf("%s has reached the backend!\n", name)
jsResp := fmt.Sprintf("Hello %s 🐇", name)
return jsResp
}
func main() {
// Create a window.
w := ui.NewWindow()
// Bind a Go function.
ui.Bind(w, "greet", greet)
// Show frontend.
w.Show("index.html")
// Wait until all windows get closed.
ui.Wait()
}
```
Find more examples in the [`examples/`](https://github.com/webui-dev/go-webui/tree/main/examples) directory.
### Debugging
To use WebUI's debug build in your Go-WebUI application, add the `webui_log` build tag. E.g.:
```sh
go run -tags webui_log minimal.go
```
## Documentation
- [Online Documentation](https://webui.me/docs/#/go) (WIP)
## UI & The Web Technologies
[Borislav Stanimirov](https://ibob.bg/) discusses using HTML5 in the web browser as GUI at the [C++ Conference 2019 (_YouTube_)](https://www.youtube.com/watch?v=bbbcZd4cuxg).
Web application UI design is not just about how a product looks but how it works. Using web technologies in your UI makes your product modern and professional, And a well-designed web application will help you make a solid first impression on potential customers. Great web application design also assists you in nurturing leads and increasing conversions. In addition, it makes navigating and using your web app easier for your users.
### Why Use Web Browsers?
Today's web browsers have everything a modern UI needs. Web browsers are very sophisticated and optimized. Therefore, using it as a GUI will be an excellent choice. While old legacy GUI lib is complex and outdated, a WebView-based app is still an option. However, a WebView needs a huge SDK to build and many dependencies to run, and it can only provide some features like a real web browser. That is why WebUI uses real web browsers to give you full features of comprehensive web technologies while keeping your software lightweight and portable.
### How Does it Work?