npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@term-ui/react

v0.0.1

Published

[![npm version](https://img.shields.io/npm/v/@term-ui/react)](https://www.npmjs.com/package/@term-ui/react) [![MIT License](https://img.shields.io/badge/license-MIT-green)](LICENSE)

Readme

@term-ui/react

npm version MIT License

Build beautiful, interactive terminal applications with React. Leverage familiar React components and styling patterns to harness the power of the terminal—no more wrestling with low‑level ANSI codes.

⚠️ Alpha Status: Term UI is currently in alpha. The API is unstable and subject to change. You may encounter bugs during use.

📺 Terminal Compatibility: Some features depend on terminal capabilities and may not work in all terminal emulators. In the future, we plan to provide an easy-to-use API for detecting these features so applications can gracefully fallback when needed.


📖 Table of Contents


✨ Features

  • React for the Terminal: Build terminal UIs with React components and hooks.
  • React 19 Support: Compatible with the latest React version.
  • Flexbox Layout: Arrange elements with display: 'flex', flexDirection, justifyContent, and alignItems.
  • Styling: Inline styles support colors, borders, padding, margin, and background.
  • Color Compositing: Use full RGBA color values for backgrounds, borders, and text. $1
  • Built with Zig, WebAssembly & TypeScript: Zig and WebAssembly for performance, TypeScript and React for developer convenience.

⚙️ Installation

# npm
npm install @term-ui/react

# pnpm
pnpm add @term-ui/react

# bun
bun install @term-ui/react

# yarn
yarn add @term-ui/react

🚀 Quick Start

import React, { useState } from 'react';
import TermUi from '@term-ui/react';

const App = () => {
  const [count, setCount] = useState(0);
  const [borderColor, setBorderColor] = useState('gray');

  return (
    <term-view
      style={{
        width: '100%',
        height: '100%',
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'center',
        justifyContent: 'center',
        padding: 2,
        gap: 1,
        borderStyle: 'rounded',
        borderColor: 'cyan',
      }}
    >
      <term-text style={{ color: 'cyan', bold: true }}>Count: {count}</term-text>

      <term-view
        style={{
          borderStyle: 'double',
          padding: 1,
          cursor: 'pointer',
          borderColor,
        }}
        onClick={() => setCount(count + 1)}
        onMouseEnter={() => setBorderColor('pink')}
        onMouseLeave={() => setBorderColor('gray')}
      >
        <term-text>Click to increment</term-text>
      </term-view>
    </term-view>
  );
};

TermUi.createRoot(<App />);

🧩 API Reference

<term-view>

The primary container component. Use it to build layouts and capture events.

| Prop | Type | | -------------- | ------------------- | | style | React.CSSProperties | | onClick | (event: MouseClickEvent) => void | | onMouseEnter | (event: MouseEnterEvent) => void | | onMouseLeave | (event: MouseLeaveEvent) => void | | onMouseMove | (event: MouseMoveEvent) => void | | onMouseDown | (event: MouseDownEvent) => void | | onMouseUp | (event: MouseUpEvent) => void | | onScroll | (event: ScrollEvent) => void | | children | ReactNode |

<term-text>

Text rendering component. Supports styling props for typography.

| Prop | Type | | ---------- | ------------------- | | style | React.CSSProperties | | children | ReactNode |


🎨 Styling

Term UI uses inline style objects:

<term-view
  style={{
    width: 40,
    height: 5,
    display: 'flex',
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center',
    borderStyle: 'rounded',
    borderColor: 'cyan',
    backgroundColor: 'rgba(0, 0, 0, 0.5)',
    color: 'white',
    padding: 1,
    margin: 2,
    cursor: 'pointer',
  }}
>
  <term-text style={{ fontWeight: 'bold', textDecoration: 'underline' }}>Hello, Terminal!</term-text>
</term-view>

Supported style properties:

| Property | Accepted Values | |----------|----------------| | display | 'flex', 'block', 'inline-block', 'inline-flex', 'none', 'inline' | | position | 'relative', 'absolute' | | width, height | Numbers, percentages (e.g., '50%'), 'auto' | | minWidth, minHeight | Numbers, percentages (e.g., '50%'), 'auto' | | maxWidth, maxHeight | Numbers, percentages (e.g., '50%'), 'auto' | | top, right, bottom, left | Numbers, percentages (e.g., '50%'), 'auto' | | margin, marginTop, marginRight, marginBottom, marginLeft | Numbers, percentages, 'auto' | | padding, paddingTop, paddingRight, paddingBottom, paddingLeft | Numbers, percentages | | overflow, overflowX, overflowY | 'visible', 'hidden', 'clip', 'scroll' | | flexDirection | 'row', 'column', 'row-reverse', 'column-reverse' | | flexWrap | 'no-wrap', 'wrap', 'wrap-reverse' | | flexBasis | Numbers, percentages, 'auto' | | flexGrow, flexShrink | Numbers | | alignItems, alignSelf, justifyItems, justifySelf | 'start', 'end', 'flex-start', 'flex-end', 'center', 'baseline', 'stretch' | | alignContent, justifyContent | 'start', 'end', 'flex-start', 'flex-end', 'center', 'stretch', 'space-between', 'space-around', 'space-evenly' | | gap | Numbers, percentages | | textAlign | 'start', 'end', 'left', 'right', 'center', 'inherit' | | textWrap | 'wrap', 'nowrap', 'inherit' | | fontWeight | 'normal', 'bold', 'dim', 'inherit' | | fontStyle | 'normal', 'italic', 'inherit' | | textDecoration | 'none', 'underline', 'double', 'dashed', 'line-through', 'wavy', 'inherit' | | color | Named colors (all CSS colors supported), hex values ('#ff0000'), RGB/RGBA values | | backgroundColor, borderColor | Named colors (all CSS colors supported), hex values ('#ff0000'), RGB/RGBA values, 'linear-gradient(...)', 'radial-gradient(...)' | | borderStyle | 'none', 'solid', 'heavy', 'double', 'rounded', 'dashed'/'dashed-double', 'dashed-double-heavy', 'dashed-wide', 'dashed-wide-heavy', 'dashed-triple', 'dashed-triple-heavy', 'dashed-quadruple', 'dashed-quadruple-heavy' | | cursor | 'alias', 'cell', 'copy', 'crosshair', 'default', 'e-resize', 'ew-resize', 'grab', 'grabbing', 'help', 'move', 'n-resize', 'ne-resize', 'nesw-resize', 'no-drop', 'not-allowed', 'ns-resize', 'nw-resize', 'nwse-resize', 'pointer', 'progress', 's-resize', 'se-resize', 'sw-resize', 'text', 'vertical-text', 'w-resize', 'wait', 'zoom-in', 'zoom-out' |

Color Support:

  • Named colors: Supports all CSS named colors including 'white', 'black', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', etc.
  • Hex: '#ff0000', '#f00'
  • RGB/RGBA: 'rgb(255, 0, 0)', 'rgba(255, 0, 0, 0.5)'
  • Gradients: 'linear-gradient(to right, red, blue)', 'radial-gradient(circle, yellow, green)'

Size Units:

  • Numbers are interpreted as character cells: width: 10 (10 characters wide)
  • 'px' units are supported but treated as equivalent to 1 character cell (e.g., width: '20px' is the same as width: 20)

Examples

Check out the examples directory for more complex examples and use cases.

🗺️ Roadmap

Here are some features and improvements we're planning for future releases:

  • Element Focus Management: Keyboard navigation and focus control between elements
  • Form Inputs: Native form components like text inputs, checkboxes, and select menus
  • Built-in State Selectors: CSS-like :hover and :active state selectors for styling without JavaScript state tracking
  • Advanced Styling System: Class-based styling with CSS selectors for targeting children and siblings, with improved style cascading.
  • DevTools: Developer tools for inspecting and debugging terminal UI applications
  • Build Tools: Optimized build configurations for terminal applications
  • Hot Reloading: Support for hot module replacement during development

📄 License

Released under the MIT License. See LICENSE for details.