{"id":13525578,"url":"https://github.com/haensl/preact-component-console","last_synced_at":"2025-10-28T00:40:19.760Z","repository":{"id":57329444,"uuid":"133275696","full_name":"haensl/preact-component-console","owner":"haensl","description":"A console emulator for preact.","archived":false,"fork":false,"pushed_at":"2018-07-03T08:45:23.000Z","size":32247,"stargazers_count":30,"open_issues_count":4,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-20T18:39:47.443Z","etag":null,"topics":["console","preact","preact-components","terminal","terminal-emulator","typewriter"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haensl.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-05-13T21:28:47.000Z","updated_at":"2023-02-15T19:32:40.000Z","dependencies_parsed_at":"2022-09-14T18:52:19.081Z","dependency_job_id":null,"html_url":"https://github.com/haensl/preact-component-console","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haensl%2Fpreact-component-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haensl%2Fpreact-component-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haensl%2Fpreact-component-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haensl%2Fpreact-component-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haensl","download_url":"https://codeload.github.com/haensl/preact-component-console/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250754587,"owners_count":21481839,"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":["console","preact","preact-components","terminal","terminal-emulator","typewriter"],"created_at":"2024-08-01T06:01:20.091Z","updated_at":"2025-10-28T00:40:19.687Z","avatar_url":"https://github.com/haensl.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# preact-component-console\nConsole emulator preact component. Emulates realistic typing via dynamic char-typing delays.\n\n[![NPM](https://nodei.co/npm/preact-component-console.png?downloads=true)](https://nodei.co/npm/preact-component-console/)\n\n[![npm version](https://badge.fury.io/js/preact-component-console.svg)](http://badge.fury.io/js/preact-component-console)\n[![Build Status](https://travis-ci.org/haensl/preact-component-console.svg?branch=master)](https://travis-ci.org/haensl/preact-component-console)\n\n\n![Intro](intro.gif)\n\n## Quick Start\n\n1. Install the package\n\n    via NPM\n\n    ```bash\n    npm i --save preact-component-console\n    ```\n\n    via yarn\n    ```bash\n    yarn add preact-component-console\n    ```\n\n2. Use the component\n\n```javascript\nimport Console from 'preact-component-console';\n\n// ...\n\n  render() {\n    \u003cConsole lines={[\n      'Hi there!',\n      'How are you today?'\n    ]} /\u003e\n  }\n```\n\n## Options\n\n### lines `Array\u003cstring\u003e | string`\n\nThe lines to write.\n\n#### Example\n\n```javascript\n\u003cConsole\n  lines={[\n    'Hi there!',\n    'How are you today?'\n  ]}\n/\u003e\n```\n\n### console `Object`\n\nSet options on the console component.\n\n#### Signature\n\n```javascript\n{\n  append: false, // whether to append lines\n  classes: {\n    element: 'console' // class to set on the root element\n  },\n  typing: {\n    char: { // options concerning typing of individual characters\n      avgMs: 150, // average duration for typing a char in milliseconds\n      deviation: 0.3, // average deviation to apply to avgMs\n      minMs: 50, // minimum duration for typing a char in milliseconds\n      maxMs: Infinity // maximum duration for typing a char in milliseconds\n    },\n    line: { // options concerning typing of a line\n      delay: { // options concerning the delay between lines\n        avgMs: 1000, // average delay between to lines in milliseconds\n        deviation: 0.5, // average deviation to apply to avgMs\n        minMs: 500, // minimum delay between to lines in milliseconds\n        maxMs: 1500 // maximum delay between to lines in milliseconds\n      }\n    }\n  }\n}\n```\n\n#### Example\n\n```javascript\n\u003cConsole\n  console={{\n    classes: {\n      element: 'my-console' // set console component class to 'my-console'\n    }\n    typing={\n      char: {\n        avgMs: 200 // set average duration for typing a char to 200ms\n      }\n    }\n  }}\n  lines={[\n    'Hi there!',\n    'How are you today?'\n  ]}\n/\u003e\n```\n\n### line `Object`\n\nSet options for the line component(s).\n\n#### Signature\n\n```javascript\n{\n  classes: {\n    element: 'console-line', // class to set on a line component\n    content: 'console-line-content' // class to set on the line's text content\n  }\n}\n```\n\n#### Example\n\n```javascript\n\u003cConsole\n  lines={[\n    'Hi there!',\n    'How are you today?'\n  ]}\n  line={{\n    classes: {\n      element: 'line-text' // set the css class name for line text to 'line-text'\n    }\n  }}\n/\u003e\n```\n\n### ps1 `Object`\n\nSet options for the PS1 component.\n\n#### Signature\n\n```javascript\n{\n  classes: {\n    element: 'console-ps1', // class to set on a ps1 component\n  },\n  content: '$' // string to display as ps1\n}\n```\n\n### Example\n\n```javascript\n\u003cConsole\n  lines={[\n    'Hi there!',\n    'How are you today?'\n  ]}\n  ps1={{\n    content: \"∆\" // set the ps1 string to ∆\n  }}\n/\u003e\n```\n\n### cursor `Object`\n\nSet options for the cursor.\n\n#### Signature\n\n```javascript\n{\n  classes: {\n    blink: 'console-cursor--blink', // class to set on the cursor component when visible (in addition to the class set in element)\n    element: 'console-cursor', // class to set on a cursor component\n    write: 'console-cursor--write' // class to set on the cursor component while writing (in additon to the class set in element)\n    \n  },\n  intervalMs: 400 // duration between blink cycles in milliseconds\n}\n```\n\n#### Example\n\n```javascript\n\u003cConsole\n  lines={[\n    'Hi there!',\n    'How are you today?'\n  ]}\n  cursor={{\n    intervalMs: 250 // set interval for cursor blinking to 250ms\n  }}\n/\u003e\n```\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaensl%2Fpreact-component-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaensl%2Fpreact-component-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaensl%2Fpreact-component-console/lists"}