Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ito

ito is the terminal UI library uji draws its screen with, and require("ito") gives it to your config, your plugins and your themes. You build what the screen shows out of views, change how each view looks with modifiers, and keep values between frames with state. uji draws a new frame whenever one of those values changes.

local ito = require("ito")

local Clock = ito.view(function()
  local shown = ito.state(os.date("%H:%M"))
  return ito.HStack({
    ito.Text("uji"):bold(),
    ito.Spacer(),
    ito.Text(shown.value):foreground(ito.Color.cyan),
  }):on_tap(function()
    shown.value = os.date("%H:%M:%S")
  end)
end)

uji.ui.toolbar({ ito.ToolbarItem(ito.ToolbarPlacement.top_bar_leading, Clock) })

This puts a bar at the top of the screen with the time on the right. A click on the bar adds the seconds.

Where views go

PlaceHow
A section of the screenuji.ui.toolbar declares toolbar items for the top bar, the row above the input or the bottom bar.
A box over the screenuji.ui.overlay shows a view until you close it.
A part a theme can replaceAny view made with ito.view. A theme gives its own in views, keyed by the view. See Views.
The whole screenA theme replaces uji.ui.Screen. See The screen.

Pages

PageContents
Viewsito.view, the stacks, text, lines and layouts of your own.
ModifiersBorders, padding, colours, sizes, alignment, overlays and clicks.
StateValues a view keeps between frames, values it hands to the views inside it, and the theme.
ToolbarsItems a plugin puts in a section of the screen, and the sections that show them.
ControlsA text field, a list, a scrolling view and a spinner, and which of them gets the keys.
ImagesA picture in a view, and the viewer that zooms and pans it.
TerminalThe screen and the input uji draws on.