{"id":38841764,"url":"https://github.com/jaychase/ngx-arrow-state","last_synced_at":"2026-02-24T01:49:08.618Z","repository":{"id":331403348,"uuid":"1126486297","full_name":"JayChase/ngx-arrow-state","owner":"JayChase","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-02T02:57:02.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-07T18:57:10.409Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/JayChase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-02T02:28:40.000Z","updated_at":"2026-01-02T02:57:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/JayChase/ngx-arrow-state","commit_stats":null,"previous_names":["jaychase/ngx-arrow-state"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/JayChase/ngx-arrow-state","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayChase%2Fngx-arrow-state","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayChase%2Fngx-arrow-state/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayChase%2Fngx-arrow-state/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayChase%2Fngx-arrow-state/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JayChase","download_url":"https://codeload.github.com/JayChase/ngx-arrow-state/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayChase%2Fngx-arrow-state/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28753411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T10:25:12.305Z","status":"ssl_error","status_checked_at":"2026-01-25T10:25:11.933Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-17T14:00:29.590Z","updated_at":"2026-01-25T13:00:27.408Z","avatar_url":"https://github.com/JayChase.png","language":"TypeScript","funding_links":[],"categories":["Third Party Components"],"sub_categories":["Keyboard Mouse"],"readme":"# ngx-arrow-state\n\n[![CI](https://github.com/JayChase/ngx-arrow-state/actions/workflows/ci.yml/badge.svg)](https://github.com/JayChase/ngx-arrow-state/actions/workflows/ci.yml)\n[![npm version](https://badge.fury.io/js/ngx-arrow-state.svg)](https://www.npmjs.com/package/ngx-arrow-state)\n\nAn Angular library that provides terminal/shell-like input history navigation using arrow keys, and Ctrl+Enter form submission.\n\nImprove UX for chat interfaces, command-line style inputs, and AI prompt interfaces by letting users:\n\n- ⬆️ **Arrow Up** - Navigate to previous input values\n- ⬇️ **Arrow Down** - Navigate to next input values\n- ⌨️ **Ctrl+Enter** - Submit forms from textarea inputs (since Enter creates newlines)\n\n## Features\n\n- Works with both `\u003cinput type=\"text\"\u003e` and `\u003ctextarea\u003e` elements\n- Smart cursor detection for textarea inputs (only navigates history when cursor is at start/end)\n- Circular history navigation\n- Standalone directives (no module required)\n- Fully tested\n- Lightweight with no dependencies\n\n## Install\n\n```bash\nnpm i -S ngx-arrow-state\n```\n\n## Compatibility\n\n| Angular Version | Package Version |\n| --------------- | --------------- |\n| 21.x            | 0.0.x           |\n\n## Usage\n\n### ArrowState Directive\n\nAdd the `ngxArrowState` directive to any text input or textarea within a reactive form to enable arrow key history navigation.\n\n```typescript\nimport { Component } from '@angular/core';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { ArrowState } from 'ngx-arrow-state';\n\n@Component({\n  selector: 'app-chat',\n  imports: [ReactiveFormsModule, ArrowState],\n  template: `\n    \u003cform [formGroup]=\"formGroup\" (ngSubmit)=\"send()\"\u003e\n      \u003cinput type=\"text\" formControlName=\"message\" ngxArrowState placeholder=\"Type a message...\" /\u003e\n      \u003cbutton type=\"submit\"\u003eSend\u003c/button\u003e\n    \u003c/form\u003e\n  `,\n})\nexport class ChatComponent {\n  formGroup = new FormGroup({\n    message: new FormControl\u003cstring | null\u003e(null),\n  });\n\n  send() {\n    console.log(this.formGroup.value);\n    this.formGroup.reset();\n  }\n}\n```\n\n#### How it works\n\n1. When the form is submitted, the current input value is saved to history\n2. Press **Arrow Up** (when cursor is at the start) to cycle backwards through history\n3. Press **Arrow Down** (when cursor is at the end) to cycle forwards through history\n\n#### Textarea behavior\n\nFor `\u003ctextarea\u003e` elements, the directive intelligently detects cursor position:\n\n- **Arrow Up** only navigates history when the cursor is at position 0 (start of text)\n- **Arrow Down** only navigates history when the cursor is at the end of the text\n- Normal arrow key behavior is preserved when the cursor is in the middle of the text\n\nThis allows users to navigate multi-line text normally while still accessing history at the boundaries.\n\n### SubmitOnCtrlEnter Directive\n\nAdd the `ngxSubmitOnCtrlEnter` directive to enable form submission with Ctrl+Enter. This is especially useful for textarea inputs where Enter creates a new line.\n\n```typescript\nimport { Component } from '@angular/core';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { ArrowState, SubmitOnCtrlEnter } from 'ngx-arrow-state';\n\n@Component({\n  selector: 'app-chat',\n  imports: [ReactiveFormsModule, ArrowState, SubmitOnCtrlEnter],\n  template: `\n    \u003cform [formGroup]=\"formGroup\" (ngSubmit)=\"send()\"\u003e\n      \u003ctextarea\n        formControlName=\"message\"\n        ngxArrowState\n        ngxSubmitOnCtrlEnter\n        placeholder=\"Type a message... (Ctrl+Enter to send)\"\n      \u003e\u003c/textarea\u003e\n      \u003cbutton type=\"submit\"\u003eSend\u003c/button\u003e\n    \u003c/form\u003e\n  `,\n})\nexport class ChatComponent {\n  formGroup = new FormGroup({\n    message: new FormControl\u003cstring | null\u003e(null),\n  });\n\n  send() {\n    console.log(this.formGroup.value);\n    this.formGroup.reset();\n  }\n}\n```\n\n### Using both directives together\n\nFor the best chat/prompt experience, use both directives together:\n\n```html\n\u003ctextarea\n  formControlName=\"prompt\"\n  ngxArrowState\n  ngxSubmitOnCtrlEnter\n  placeholder=\"Enter your prompt...\"\n\u003e\u003c/textarea\u003e\n```\n\n## API Reference\n\n### ArrowState\n\n| Selector | `input[type=\"text\"][ngxArrowState], textarea[ngxArrowState]` |\n| -------- | ------------------------------------------------------------ |\n\nThe directive automatically:\n\n- Captures values on form submission\n- Provides circular navigation through history\n- Respects cursor position in textareas\n\n### SubmitOnCtrlEnter\n\n| Selector | `[ngxSubmitOnCtrlEnter]` |\n| -------- | ------------------------ |\n\nTriggers form submission when Ctrl+Enter is pressed. Works on any element within a reactive form.\n\n## Requirements\n\n- Angular 21+\n- `@angular/forms` (ReactiveFormsModule)\n\n## Development\n\nTo clone this repo and run it locally:\n\n```bash\ngit clone https://github.com/JayChase/ngx-arrow-state.git\ncd ngx-arrow-state\nnpm install\nnpm run build\n```\n\n### Demo\n\n```bash\nng serve demo\n```\n\n### Run tests\n\n```bash\nnpm test\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaychase%2Fngx-arrow-state","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaychase%2Fngx-arrow-state","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaychase%2Fngx-arrow-state/lists"}