@flowtty/tty-backend
v1.0.0-alpha.1
Published
TTY backend for @flowtty/react: paints to stdout, reads raw input + parses key sequences.
Downloads
29
Maintainers
Readme
@flowtty/tty-backend
The canonical TTY backend for flowtty — a library for building terminal apps in React.
It implements @flowtty/core's Backend interface against a real terminal:
- Paints the cell
Bufferto stdout using the alt-screen, full-frame model. - Frame diffing — writes only the cells that changed since the previous frame; adjacent changes share one cursor move, and no-op repaints write nothing.
- Reads raw input and parses key sequences (arrows, function keys via xterm tilde sequences, Ctrl/Alt modifiers).
- Restores cooked mode and shows the cursor on
dispose().
This is the backend you pass to render() for CLI tools and full-screen terminal apps.
Install
npm install @flowtty/react @flowtty/tty-backend reactUsage
import { render, Box, Text } from '@flowtty/react';
import { TtyBackend } from '@flowtty/tty-backend';
await render(
<Box flexDirection="column">
<Text bold>Hello, flowtty!</Text>
</Box>,
new TtyBackend(),
);For an inline (non-alt-screen) live region with append-only log lines above it, use @flowtty/inline-tty-backend instead.
See also
@flowtty/react— the React adapter.@flowtty/core— theBackendinterface and data model.- flowtty on GitHub — full docs and examples.
