Introduction

React-based TUI library powered by a native Rust diff engine, drop-in Ink-compatible API

@visulima/tui

React-based terminal UI library powered by a native Rust diff engine.

@visulima/tui provides a component-driven TUI framework with an Ink-compatible API, a high-performance Rust diff renderer, and first-class support for React hooks, Yoga layout, mouse events, scrolling, and raw-buffer rendering.

Key Features

  • Ink-compatible API — Drop-in replacement for most Ink component and hook usage
  • Rust diff engine — Native NAPI binding emits only changed terminal cells as ANSI
  • Three rendering modes — React, raw-buffer, and inline mode
  • Full hook set — Input, paste, mouse, focus, scrollable, text input, window size
  • Ratatat-only extras<Spinner>, <ProgressBar>, useMouse, useScrollable, useTextInput
  • TypeScript first — Full type safety with exported types

Quick Start

import { render, Box, Text, useInput } from "@visulima/tui/react";
import React, { useState } from "react";

function Counter() {
    const [count, setCount] = useState(0);

    useInput((_input, key) => {
        if (key.upArrow) setCount((c) => c + 1);
        if (key.downArrow) setCount((c) => c - 1);
    });

    return (
        <Box flexDirection="column" padding={1}>
            <Text bold color="cyan">
                Counter
            </Text>
            <Text>Count: {count}</Text>
            <Text dim>↑↓ to change · Ctrl+C to exit</Text>
        </Box>
    );
}

render(<Counter />);

Next Steps

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