Home

Awesome

<div align="center">

Logo

V-WebUI

FeaturesInstallationUsageDocumentationWebUI

Use any web browser or WebView as GUI.
With V in the backend and modern web technologies in the frontend.

Screenshot

</div>

Features

Installation

v install https://github.com/webui-dev/v-webui

Usage

[!NOTE] It is recommended to use GCC or Clang to compile a WebUI V program. TCC is currently not working due to missing header files. E.g.:

v -cc gcc run .

Example

import vwebui as ui

const html = '<!DOCTYPE html>
<html>
   <head>
      <script src="webui.js"></script>
      <style>
         body {
            background: linear-gradient(to left, #36265a, #654da9);
            color: AliceBlue;
            font: 16px sans-serif;
            text-align: center;
            margin-top: 30px;
         }
      </style>
   </head>
   <body>
      <h1>Welcome to WebUI!</h1>
      <br>
      <input type="text" id="name" value="Neo">
      <button onclick="handleVResponse();">Call V</button>
      <br>
      <br>
      <div><samp id="greeting"></samp></div>
      <script>
         async function handleVResponse() {
            const inputName = document.getElementById("name");
            const result = await webui.greet(inputName.value);
            document.getElementById("greeting").innerHTML = result;
         }
      </script>
   </body>
</html>'

fn greet(e &ui.Event) string {
	name := e.get_arg[string]() or { panic('expected an argument') }
	println('${name} has reached the backend!')
	return 'Hello ${name} 馃悋'
}

fn main() {
	mut w := ui.new_window()
	w.bind('greet', greet)
	w.show(html)!
	ui.wait()
}

Find more examples in the examples/ directory.

Documentation

[!TIP] Until our online documentation is finished, you can refer to src/lib.v or use V's built-in v doc -comments vwebui in the terminal for the latest overview of exported functions.

Supported Web Browsers

BrowserWindowsmacOSLinux
Mozilla Firefox鉁旓笍鉁旓笍鉁旓笍
Google Chrome鉁旓笍鉁旓笍鉁旓笍
Microsoft Edge鉁旓笍鉁旓笍鉁旓笍
Chromium鉁旓笍鉁旓笍鉁旓笍
Yandex鉁旓笍鉁旓笍鉁旓笍
Brave鉁旓笍鉁旓笍鉁旓笍
Vivaldi鉁旓笍鉁旓笍鉁旓笍
Epic鉁旓笍鉁旓笍not available
Apple Safarinot availablecoming soonnot available
Operacoming sooncoming sooncoming soon

License

Licensed under the MIT License.