Rendering Modes

Compare the three rendering modes in @visulima/tui: React mode, raw-buffer mode, and inline mode

Rendering Modes

@visulima/tui supports three runtime modes.

React Mode

Use when you want component-driven terminal apps with hooks and Yoga layout.

import { render } from "@visulima/tui/react";

render(<App />);

What you get:

  • React components and hooks
  • Yoga flex layout
  • Focus management (Tab/Shift+Tab)
  • Alternate screen lifecycle
  • Resize handling (SIGWINCH)

Guide: Quickstart: React Mode

Raw-Buffer Mode

Use when you want direct control over every cell.

import { Renderer, TerminalGuard, terminalSize } from "@visulima/tui/core";

const { cols, rows } = terminalSize();
const guard = new TerminalGuard();
const renderer = new Renderer(cols, rows);
const buf = new Uint32Array(cols * rows * 2);

renderer.render(buf);

What you get:

  • Direct Uint32Array painting
  • Rust diff engine output
  • No React/Yoga overhead
  • Alternate screen lifecycle

Guide: Quickstart: Raw-Buffer Mode

Inline Mode

Use when you want a fixed-height region below the current cursor (no alternate screen takeover).

renderInline()

import { renderInline } from "@visulima/tui/react";

renderInline(<Picker />, { rows: 8, onExit: "preserve" });

createInlineLoop()

import { createInlineLoop } from "@visulima/tui/core";

const loop = createInlineLoop(
    (buf, cols, rows, frame) => {
        // paint frame
    },
    { rows: 8, fps: 30, onExit: "preserve" },
);

loop.start();

Notes:

  • Inline mode preserves normal scrollback behavior.
  • onExit: 'preserve' keeps rendered lines; onExit: 'destroy' clears the region.
  • Current implementation exits the process when the inline loop stops.

Guide: Raw Buffer API

Quick Comparison

CapabilityReact modeRaw-buffer modeInline mode
Alternate screen
Yoga layoutoptional
React hooksoptional
Direct cell paintindirectdirectdirect
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues