Skip to main content
Version: 0.1.0-alpha.3

TUI Components Overview

Invowk™ includes a set of interactive terminal UI components inspired by gum. Use them in your scripts to create interactive prompts, selections, and styled output.

Available Components

ComponentDescriptionUse Case
inputSingle-line text inputNames, paths, simple values
writeMulti-line text editorDescriptions, commit messages
chooseSelect from optionsMenus, choices
confirmYes/no promptConfirmations
filterFuzzy filter listSearch through options
fileFile pickerSelect files/directories
tableDisplay tabular dataCSV, data tables
spinSpinner with commandLong-running tasks
pagerScrollable content viewerLogs, code review, long output
formatFormat text (markdown, code)Rendering content
styleStyle text (colors, bold)Decorating output

Quick Examples

# Get user input
NAME=$(invowk tui input --title "What's your name?")

# Choose from options
COLOR=$(invowk tui choose --title "Pick a color" red green blue)

# Confirm action
if invowk tui confirm "Continue?"; then
echo "Proceeding..."
fi

# Show spinner during long task
invowk tui spin --title "Installing..." -- npm install

# Style output
echo "Success!" | invowk tui style --foreground "#00FF00" --bold

Using in Invkfiles

TUI components work great inside command scripts, including those running in containers with interactive mode (-i):

Container Support

TUI components work seamlessly inside containers when using interactive mode. The components render as modal overlays on your host terminal. See Container Runtime - Interactive Mode for details.

{
name: "setup"
description: "Interactive project setup"
implementations: [{
script: """
#!/bin/bash

# Gather information
NAME=$(invowk tui input --title "Project name:")
TYPE=$(invowk tui choose --title "Type:" cli library api)

# Confirm
echo "Creating $TYPE project: $NAME"
if ! invowk tui confirm "Proceed?"; then
echo "Cancelled."
exit 0
fi

# Execute with spinner
invowk tui spin --title "Creating project..." -- mkdir -p "$NAME"

# Success message
echo "Project created!" | invowk tui style --foreground "#00FF00" --bold
"""
runtimes: [{name: "native"}]
platforms: [{name: "linux"}, {name: "macos"}]
}]
}

Common Patterns

Input with Validation

while true; do
EMAIL=$(invowk tui input --title "Email address:")
if echo "$EMAIL" | grep -qE '^[^@]+@[^@]+\.[^@]+$'; then
break
fi
echo "Invalid email format" | invowk tui style --foreground "#FF0000"
done
ACTION=$(invowk tui choose --title "What would you like to do?" \
"Build project" \
"Run tests" \
"Deploy" \
"Exit")

case "$ACTION" in
"Build project") make build ;;
"Run tests") make test ;;
"Deploy") make deploy ;;
"Exit") exit 0 ;;
esac

Progress Feedback

echo "Step 1: Installing dependencies..."
invowk tui spin --title "Installing..." -- npm install

echo "Step 2: Building..."
invowk tui spin --title "Building..." -- npm run build

echo "Done!" | invowk tui style --foreground "#00FF00" --bold

Styled Headers

invowk tui style --bold --foreground "#00BFFF" "=== Project Setup ==="
echo ""
# ... rest of script

Piping and Capture

Most components work with pipes:

# Pipe to filter
ls | invowk tui filter --title "Select file"

# Capture output
SELECTED=$(invowk tui choose opt1 opt2 opt3)
echo "You selected: $SELECTED"

# Pipe for styling
echo "Important message" | invowk tui style --bold

Exit Codes

Components use exit codes to communicate:

ComponentExit 0Exit 1
confirmUser said yesUser said no
inputValue enteredCancelled
chooseOption selectedCancelled
filterOption selectedCancelled
pagerExited normallyError occurred

Use in conditionals:

if invowk tui confirm "Delete files?"; then
rm -rf ./temp
fi

Next Steps

Explore each component in detail: