This is a terminal for React web apps.
npx create-react-app my-terminal-project
cd my-terminal-project
npm i terminal-io
or yarn add terminal-io
/* src/index.css */
body {
padding: 16px;
margin: 0;
background: #211d1b;
}
update App.js
and add these codes
// src/App.js
import "./index.css";
import Terminal from "terminal-io";
import React from "react";
const App = () => {
const commands = [
{ name: "summary", value: () => <p>This is summary text</p> },
];
return <Terminal commands={commands} />;
};
export default App;
npm run start
or yarn start
Event | Description |
---|---|
onEnter | When the user presses the enter |
onDidMount | When the component install successfully |
Prop | Description |
---|---|
initialData | This data will add the command line automatically when the component loaded |
commands | All command list |
https://github.com/salihkesepara/salihkeseparacom
MIT