Skip to main content
OpenTUI includes a powerful built-in console overlay that captures all console output (console.log, console.info, console.warn, console.error, console.debug) and displays it in a visual overlay without disrupting your main interface.

Quick Start

The console is automatically available in every OpenTUI application. Press ` (backtick) to toggle it.

Configuration

Customize the console when creating the renderer:

Console Positions

The console can be positioned at any edge:
Best for most applications - doesn’t interfere with typical layouts.

Keyboard Controls

When the console is focused, you can navigate and control it:

Programmatic Control

Show, Hide, and Toggle

Clear Console

Log Levels and Colors

Different log levels are automatically color-coded:

Debug Mode

Enable debug mode to show caller information (file name, line number) with each log:
With debug mode enabled:

Text Selection and Copy

Select text in the console with mouse drag or keyboard, then copy it:

Mouse Selection

  1. Click and drag to select text
  2. Click the [Copy] button or press Ctrl+Shift+C

Custom Copy Handler

Handle the copy action yourself (e.g., to copy to system clipboard):

Custom Key Bindings

Customize the copy shortcut:

Saving Logs

Save console output to a file:
Saved logs include timestamps and log levels:

Environment Variables

Control console behavior via environment variables:

Advanced: Custom Key Bindings

Completely customize console keyboard controls:
Available actions:
  • scroll-up - Scroll up one line
  • scroll-down - Scroll down one line
  • scroll-to-top - Jump to top
  • scroll-to-bottom - Jump to bottom
  • position-previous - Move to previous edge
  • position-next - Move to next edge
  • size-increase - Make console larger
  • size-decrease - Make console smaller
  • save-logs - Save logs to file
  • copy-selection - Copy selected text

Complete Example

Performance Tips

Set reasonable limits for stored logs:
Disable console capture in production:
Debug mode collects stack traces which adds overhead:

Common Issues

Check if console is enabled:
Ensure you’re using console methods after renderer is created:
Provide a copy handler:

Next Steps

Animations

Add smooth animations to your app

3D Rendering

Render 3D graphics with WebGPU