5.2.0 • Published 3 years ago

react-console-emulator-fork v5.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

react-console-emulator-fork

Note: this is a fork of react-console-emulator. A simple, powerful and highly customisable Unix terminal emulator for React.

Live demo
Configuration guide
Command API

Features

  • Highly customisable: Add custom responses, restyle and tweak the terminal to your liking and much more.
  • A Unix terminal in the browser: Accurately emulate a native Unix terminal in the browser with no setup required.
  • Familiar shortcuts: The terminal can keep track of commands and allows the user to recall them at their behest.
  • Easy and powerful command system: Execute code from your own application and send the results to the terminal output.
  • Async output support: Push output to the terminal at any time, even after a command response has been emitted.
  • Unlimited concurrency: Register as many terminals as you like with no risk of input confusion.

Usage

import React, { Component } from 'react'
import Terminal from 'react-console-emulator'

const commands = {
  echo: {
    description: 'Echo a passed string.',
    usage: 'echo <string>',
    fn: function () {
      return `${Array.from(arguments).join(' ')}`
    }
  }
}

export default class MyTerminal extends Component {
  render () {
    return (
      <Terminal
        commands={commands}
        welcomeMessage={'Welcome to the React terminal!'}
        promptLabel={'me@React:~$'}
      />
    )
  }
}

License

MIT © Linus Willner and Curtis Fowler.
"React" and any associated logos are trademarks of Facebook, Inc.