Features · Installation · Usage · Documentation · WebUI
WebUI is not a web-server solution or a framework, but it allows you to use any web browser as a GUI, with your preferred language in the backend and HTML5 in the frontend. All in a lightweight portable lib.
- 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)
- One header file
- Multi-platform & Multi-Browser
- Using private profile for safety
v install https://github.com/webui-dev/v-webui
After the installation, prepare the WebUI library for usage.
# Linux / macOs
~/.vmodules/vwebui/setup.vsh
# Windows PowerShell
v run %USERPROFILE%/.vmodules/vwebui/setup.vsh
Tip
On Windows it is recommended to use GCC or Clang to compile a WebUI V program. TCC is currently not working due to missing header files.
You can use the -cc
flag to specify a custom compiler. E.g.:
v -cc gcc run .
import vwebui as ui
const html = '<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
background: linear-gradient(to left, #36265a, #654da9);
color: AliceBlue;
font: 16px sans-serif;
text-align: center;
}
</style>
<script src="webui.js"></script>
</head>
<body>
<h1>Thanks for using WebUI!</h1>
<button onclick="webui.my_v_func()">Call V!</button>
</body>
</html>'
fn my_v_func(e &ui.Event) voidptr {
println('Hello From V!')
return ui.no_result
}
w := ui.new_window()
w.bind('my_v_func', my_v_func)
w.show(html)!
ui.wait()
Find more examples in the examples/
directory.
- Online Documentation (WIP)
Note
Until our Online Documentation is finished, you can referrer to src/lib.v
or use V's builtin v doc -comments vwebui.src
for the latest overview of exported and commented functions.
-
To use WebUI's debug build in your V-WebUI application, add the
-d webui_log
flag. E.g.:v -d webui_log run examples/call_v_from_js.v
-
Run tests locally:
VJOBS=1 v -stats test tests/
Browser | Windows | macOS | Linux |
---|---|---|---|
Mozilla Firefox | ✔️ | ✔️ | ✔️ |
Google Chrome | ✔️ | ✔️ | ✔️ |
Microsoft Edge | ✔️ | ✔️ | ✔️ |
Chromium | ✔️ | ✔️ | ✔️ |
Yandex | ✔️ | ✔️ | ✔️ |
Brave | ✔️ | ✔️ | ✔️ |
Vivaldi | ✔️ | ✔️ | ✔️ |
Epic | ✔️ | ✔️ | not available |
Apple Safari | not available | coming soon | not available |
Opera | coming soon | coming soon | coming soon |
Licensed under the MIT License.