Create an application
Arguments
- ...
Widgets to show, plus optional
on()event handlers andbind()key bindings.- bindings
A list of
bind()key bindings.- actions
A named list of action functions
function(app)that bindings can refer to by name.- title
Optional title.
- mouse
Enable mouse input (clicks, wheel, hover)?
- stylesheet
A
stylesheet(), stylesheet text, a file path, or a list of them.- theme
A
termr_theme()or a built-in theme name ("default","dark","light").- debug
Bind F12 to a debug overlay (focused and hovered widget, last event, repaint statistics)?
- reduce_motion
Turn decorative animation off?
NULLfollowsmotion_reduced().
Examples
hello <- app(
vertical(
label("What is your name?"),
input(id = "name"),
button("Say hello", id = "hello"),
label("", id = "output")
),
on("button.pressed", "#hello", function(event, app) {
name <- app$query_one("#name")$value
app$query_one("#output")$update(paste("Hello", name))
}),
bind("escape", "quit")
)
if (interactive()) run(hello)