{"id":26608201,"url":"https://github.com/astralarya/react-console","last_synced_at":"2025-06-14T01:35:05.780Z","repository":{"id":57158482,"uuid":"59540864","full_name":"astralarya/react-console","owner":"astralarya","description":"Simple react console emulator","archived":false,"fork":false,"pushed_at":"2023-01-24T13:46:08.000Z","size":591,"stargazers_count":66,"open_issues_count":6,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-09T21:53:14.100Z","etag":null,"topics":["react","react-component","readline","terminal-emulators"],"latest_commit_sha":null,"homepage":"https://astralarya.github.io/react-console/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astralarya.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-24T04:40:48.000Z","updated_at":"2024-12-15T14:18:09.000Z","dependencies_parsed_at":"2023-02-13T22:01:00.219Z","dependency_job_id":null,"html_url":"https://github.com/astralarya/react-console","commit_stats":null,"previous_names":["autochthe/react-console"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astralarya%2Freact-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astralarya%2Freact-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astralarya%2Freact-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astralarya%2Freact-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astralarya","download_url":"https://codeload.github.com/astralarya/react-console/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119400,"owners_count":21050754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","react-component","readline","terminal-emulators"],"created_at":"2025-03-23T23:49:52.896Z","updated_at":"2025-04-09T21:53:18.536Z","avatar_url":"https://github.com/astralarya.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-console\n\nSimple React.js console emulator.\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][npm-url]\n[![Travis Build][travis-image]][travis-url]\n[![Coverage Status][coveralls-image]][coveralls-url]\n\n[![Demo Image][demo-image]][demo-url]\n\n## Example\n\nSimple prompt that echoes back input:\n\n```javascript\nlet EchoConsole = React.createClass({\n\techo: function(text) {\n\t\tthis.refs.console.log(text);\n\t\tthis.refs.console.return();\n\t},\n\trender: function() {\n\t\treturn \u003cConsole ref=\"console\"\n\t\t\thandler={this.echo}\n\t\t\tautofocus={true}\n\t\t/\u003e;\n\t}\n});\n```\n\nSee the [example project](docs/example) used in the [live demo][demo-url].\n\n\n## Installation\n\n    npm install --save-dev react-console-component\n\n\n## Features\n\n* Readline emulation\n* Mobile friendly\n* Input Method Editor (IME) support\n\n\n## Props\n\nProperties you can pass to the console element\n\n| Prop\t\t\t| Type\t\t\t\t\t\t\t\t\t| Description\n| ----\t\t\t| ----\t\t\t\t\t\t\t\t\t| ----\n| autofocus?\t\t| bool\t\t\t\t\t\t\t\t| Autofocus the console on component mount.\n| cancel?\t\t| ()=\u003eany\t\t\t\t\t\t\t| Function that should stop execution of the current command and call `this.return()`.\n| complete?\t\t| (words: string[], cursor: number, prompt: string)=\u003estring[]\t| Return a list of possible completions given a list of (`words`), index of the word containing the cursor (`cursor`) , and the full prompt text (`prompt`).\n| continue?\t\t| (prompt: string)=\u003ebool\t\t\t\t\t| Return a boolean indicating whether to continue asking for user input on a newline given the current prompt text (`prompt`).\n| handler\t\t| (command: string)=\u003eany\t\t\t\t\t| Handle a command (`command`), logging data with `this.log()` or `this.logX()`, and calling `this.return()` when finished.\n| promptLabel?\t\t| string \\| ()=\u003estring\t\t\t\t\t\t| String or function that generates a string displayed to prompt user for input.\n| welcomeMessage?\t| string\t\t\t\t\t\t\t| Initial message displayed after mount.\n\n\n## Public members\n\n| Member\t| Type\t\t\t\t\t\t\t| Description\n| ----\t\t| ----\t\t\t\t\t\t\t| ----\n| log\t\t| (...messages: any)=\u003evoid\t\t\t| Log messages to the console. If string, print the value, otherwise, print the JSON value of the message.\n| logX\t\t| (type: string, ...messages: any)=\u003evoid\t| Log messages of a particular type to the console. The messages will be given the class `react-console-message-{type}`.\n| return\t| ()=\u003evoid\t\t\t\t\t| Signal the current command has finished and a new prompt should be displayed.\n\n\n## Awknoledgements\n\nReact-console is inspired by [chrisdone/jquery-console](https://github.com/chrisdone/jquery-console).\n\n[demo-image]: https://astralarya.github.io/react-console/images/example.svg\n[demo-url]: https://astralarya.github.io/react-console/#react-console\n[npm-image]: https://img.shields.io/npm/v/react-console-component.svg\n[npm-url]: https://npmjs.org/package/react-console-component\n[downloads-image]: https://img.shields.io/npm/dm/react-console-component.svg\n[travis-image]: https://img.shields.io/travis/astralarya/react-console/master.svg\n[travis-url]: https://travis-ci.org/astralarya/react-console\n[coveralls-image]: https://coveralls.io/repos/github/astralarya/react-console/badge.svg?branch=master\n[coveralls-url]: https://coveralls.io/github/astralarya/react-console?branch=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastralarya%2Freact-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastralarya%2Freact-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastralarya%2Freact-console/lists"}