Application types
Rune-Web applications
Author HTML views, reactive state, actions, and styles in Rune. Rune-Web is an @Frontend mode hosted by a REST app, and can also be exported as static HTML.
#!RUNE
@App
name = Counter site
type = REST
@Frontend
type = rune-web
path = %ROOT%
page = home
@Logic/counter
state:
clicks = 0
action increment():
clicks = clicks + 1
@Style/site
rules:
.counter:
padding = 2rem
color = #285f64
@Page/home
title = My counter
logic = counter
style = site
view:
main .counter:
h1 "Count: {clicks}"
button click=increment() "Add one"
Reading the syntax
- @Frontend type = rune-web mounts the frontend. path = %ROOT% mounts at /; page = home selects @Page/home.
- @Logic/counter defines state and actions. The page selects it with logic = counter; click=increment() calls the action.
- @Page/home contains a view: tree, where indentation nests elements. @Style/site supplies rules; reusable views use @Component/Name.
Run locally
Save as rune-web.rune. Run the server, or export a self-contained page with -o html.
vectrune rune-web.rune
vectrune rune-web.rune -o html > index.htmlThe counter below is compiled from the repository example. Expand its source to see a complete UI with styles and actions.
Live Rune-Web app
Counter
This preview is compiled from the actual Rune example, including its styles and actions. Interact with the app, then explore its source files.
View source code
No matching files.
counter.rune
#!RUNE
@App
name = Counter
type = REST
@Frontend
type = rune-web
path = %ROOT%
page = counter
@Page/counter
title = Counter
style = counter
state:
clicks = 0
view:
main .counter:
p "A little state goes a long way."
h1 "Count: {clicks}"
div .actions:
button click="decrement clicks by 1" "− Decrease"
button click="increment clicks by 1" "+ Increase"
button click="clicks = 0" "Reset"
@Style/counter
rules:
body:
margin = 0
font-family = system-ui, sans-serif
background = #eff6ff
color = #172033
.counter:
padding = 2rem 1rem
text-align = center
.actions:
display = flex
justify-content = center
flex-wrap = wrap
gap = 0.75rem
button:
padding = 0.75rem 1rem
border = 0
border-radius = 10px
background = #2563eb
color = white
font-size = 1rem
cursor = pointer