Skip to contents

Defines a terminal UI application from a UI tree and a server function. The runtime runs server(input, output) once during initialization to register outputs and observers, then re-evaluates only invalidated reactive graph nodes for each input event.

Usage

tuiApp(ui, server)

Arguments

ui

A UI component tree built with tuiColumn(), tuiRow(), tuiShowIf(), tuiModal(), tuiBox(), tuiOutputText(), tuiOutputNumeric(), tuiOutputTable(), tuiInputButton(), tuiInputText(), tuiInputCheckbox(), or tuiInputDropdown().

server

A function called as server(input, output). Both input and output are environments:

  • input$<id> is updated automatically from buttons, text inputs, checkboxes, dropdowns, and table header click events.

  • input$terminalWidth and input$terminalHeight are automatically managed read-only reactive inputs reflecting the current terminal size.

  • assign rendered outputs with output$<name> <- tuiRenderText(...) or output$<name> <- tuiRenderNumeric(...) / output$<name> <- tuiRenderTable(...).

  • use tuiObserve() / tuiObserveEvent() for reactive side effects.

Value

An object of class rtuiApp.

Examples

app <- tuiApp(
  ui = tuiColumn(
    tuiOutputNumeric("counter"),
    tuiInputButton("Increment", id = "inc")
  ),
  server = function(input, output) {
    output$counter <- tuiRenderNumeric(input$inc)
  }
)