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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-terminal-ui-lib

v0.1.6

Published

**Terminal UI Library** is a React component library inspired by the terminal look and feel, built with Tailwind CSS. It provides a set of components that allow you to create terminal-style UIs in your React applications.

Downloads

14

Readme

Terminal UI Library

Terminal UI Library is a React component library inspired by the terminal look and feel, built with Tailwind CSS. It provides a set of components that allow you to create terminal-style UIs in your React applications.

Table of Contents

Installation

To install the Terminal UI Library, use npm:

npm install react-terminal-ui-lib
yarn add react-terminal-ui-lib

Getting Started

After installing the library, you can start using the components in your React application. Make sure that you have Tailwind CSS set up in your project. If not, you can follow this guide to get started with Tailwind CSS. Components TerminalWindow

A container component that represents the terminal window.


import { TerminalWindow } from 'react-terminal-ui-lib';

<TerminalWindow>
  {/* Other components like TerminalLine, TerminalInput go here */}
</TerminalWindow>

TerminalLine

A component that displays a single line in the terminal, including a prompt and some text.

javascript


import { TerminalLine } from 'react-terminal-ui-lib';

<TerminalLine prompt="$">Hello, World!</TerminalLine>

TerminalInput

A component that allows users to input commands in the terminal. It takes a prompt prop and an onSubmit callback function.

javascript


import { TerminalInput } from 'react-terminal-ui-lib';

<TerminalInput prompt="$" onSubmit={(command) => console.log(command)} />

TerminalStatusBar

A component that represents the status bar at the bottom of the terminal, showing information like the current directory and status.

javascript


import { TerminalStatusBar } from 'react-terminal-ui-lib';

<TerminalStatusBar directory="~/projects/react-terminal-ui-lib" status="Normal Mode" />

CommandHistory

A component that displays a list of previously entered commands and their results.

javascript



import { CommandHistory } from 'react-terminal-ui-lib';

const history = [
  { prompt: '$', command: 'echo Hello', output: 'Hello' },
];

<CommandHistory history={history} />

TerminalOutput

A component that displays the output of the most recent command.


javascript

import { TerminalOutput } from 'react-terminal-ui-lib';

<TerminalOutput output="Command executed successfully." />

Example Usage

Here's an example of how you can put everything together:

javascript


import React, { useState } from 'react';
import {
  TerminalWindow,
  TerminalLine,
  TerminalInput,
  TerminalStatusBar,
  CommandHistory,
  TerminalOutput,
} from 'react-terminal-ui-lib';

function App() {
  const [history, setHistory] = useState([
    { prompt: '$', command: 'echo Welcome to the terminal!', output: 'Welcome to the terminal!' }
  ]);

  const handleCommandSubmit = (command) => {
    const newHistory = [...history, { prompt: '$', command, output: `You typed: ${command}` }];
    setHistory(newHistory);
  };

  return (
    <TerminalWindow>
      <CommandHistory history={history} />
      <TerminalInput prompt="$" onSubmit={handleCommandSubmit} />
      <TerminalOutput output="Type a command and press Enter..." />
      <TerminalStatusBar directory="~/projects/react-terminal-ui-lib" status="Normal Mode" />
    </TerminalWindow>
  );
}

export default App;

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you'd like to help improve the library. License

This project is licensed under the MIT License. See the LICENSE file for more details.

Overview:

  • Installation: Explains how to install the library.
  • Getting Started: Guides the user to set up the library and Tailwind CSS.
  • Components: Lists all available components with usage examples.
  • Example Usage: Demonstrates how to use multiple components together in a React app.
  • Contributing: Invites users to contribute to the library.
  • License: Provides licensing information.

This README.md gives users a comprehensive guide to get started with your terminal-inspired UI library.