{"name":"ink-select-input","version":"6.2.0","description":"Select input component for Ink","license":"MIT","repository":{"type":"git","url":"git+https://github.com/vadimdemedes/ink-select-input.git"},"author":{"name":"Vadim Demedes","email":"vdemedes@gmail.com","url":"https://github.com/vadimdemedes"},"type":"module","exports":{"types":"./build/index.d.ts","default":"./build/index.js"},"engines":{"node":">=18"},"scripts":{"pretest":"tsc","test":"xo && ava","build":"tsc","prepare":"tsc"},"keywords":["ink","ink-component"],"dependencies":{"figures":"^6.1.0","to-rotated":"^1.0.0"},"devDependencies":{"@sindresorhus/tsconfig":"^5.0.0","@types/node":"^22.14.1","@types/react":"^18.3.2","@types/sinon":"^17.0.3","@vdemedes/prettier-config":"^2.0.1","ava":"^6.1.3","delay":"^6.0.0","eslint-config-xo-react":"^0.27.0","eslint-plugin-react":"^7.34.1","eslint-plugin-react-hooks":"^4.6.2","ink":"^5.0.0","ink-testing-library":"^4.0.0","prettier":"^3.2.5","react":"^18.3.1","sinon":"^18.0.0","tsimp":"^2.0.11","typescript":"^5.4.5","xo":"^0.58.0"},"peerDependencies":{"ink":">=5.0.0","react":">=18.0.0"},"ava":{"extensions":{"ts":"module","tsx":"module"},"nodeArguments":["--import=tsimp/import"]},"xo":{"extends":["xo-react"],"prettier":true,"rules":{"unicorn/no-hex-escape":"off","unicorn/filename-case":"off","unicorn/prevent-abbreviations":"off"}},"prettier":"@vdemedes/prettier-config","_id":"ink-select-input@6.2.0","gitHead":"6cde55c0534a57b44606bcc79cd513485c4402b4","bugs":{"url":"https://github.com/vadimdemedes/ink-select-input/issues"},"homepage":"https://github.com/vadimdemedes/ink-select-input#readme","_nodeVersion":"23.6.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-304fZXxkpYxJ9si5lxRCaX01GNlmPBgOZumXXRnPYbHW/iI31cgQynqk2tRypGLOF1cMIwPUzL2LSm6q4I5rQQ==","shasum":"c8114a5022a79aaa3e163c148e9bf72a0989b8af","tarball":"http://registry-npm.ywwl.com/ink-select-input/download/ink-select-input-6.2.0.tgz","fileCount":15,"unpackedSize":18067,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCID6woBFDc/vXIOMlr0C/H37ARXNvstEpHl4EQcthJcCQAiBS2uyfPSswSJktAT4nTa4dDAHRrNCfDv3aZlSr5rbb0Q=="}],"size":5517,"noattachment":false,"key":"/ink-select-input/-/ink-select-input-6.2.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"vdemedes","email":"vadimdemedes@hey.com"},{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ink-select-input_6.2.0_1745926475000_0.6894559049848108"},"_hasShrinkwrap":false,"readme":"# ink-select-input [![test](https://github.com/vadimdemedes/ink-select-input/workflows/test/badge.svg)](https://github.com/vadimdemedes/ink-select-input/actions)\n\n> Select input component for [Ink](https://github.com/vadimdemedes/ink)\n\n## Install\n\n```sh\nnpm install ink-select-input\n```\n\n## Usage\n\n```jsx\nimport React from 'react';\nimport {render} from 'ink';\nimport SelectInput from 'ink-select-input';\n\nconst Demo = () => {\n\tconst handleSelect = item => {\n\t\t// `item` = { label: 'First', value: 'first' }\n\t};\n\n\tconst items = [\n\t\t{\n\t\t\tlabel: 'First',\n\t\t\tvalue: 'first'\n\t\t},\n\t\t{\n\t\t\tlabel: 'Second',\n\t\t\tvalue: 'second'\n\t\t},\n\t\t{\n\t\t\tlabel: 'Third',\n\t\t\tvalue: 'third'\n\t\t}\n\t];\n\n\treturn <SelectInput items={items} onSelect={handleSelect} />;\n};\n\nrender(<Demo />);\n```\n\nThe user can navigate using arrow up/down keys or the <kbd>j</kbd> <kbd>k</kbd> keys, then press <kbd>return</kbd> to select. Alternatively, press the number key corresponding to an option to select it instantly.\n\n<img src=\"media/demo.gif\" width=\"508\">\n\n## Props\n\n### items\n\nType: `array`\\\nDefault: `[]`\n\nItems to display in a list. Each item must be an object and have `label` and `value` props, it may also optionally have a `key` prop.\nIf no `key` prop is provided, `value` will be used as the item key.\n\n### isFocused\n\nType: `boolean`\\\nDefault: `true`\n\nListen to user's input. Useful in case there are multiple input components at the same time and input must be \"routed\" to a specific component.\n\n### initialIndex\n\nType: `number`\\\nDefault: `0`\n\nIndex of initially-selected item in `items` array.\n\n### limit\n\nType: `number`\n\nNumber of items to display.\n\n### indicatorComponent\n\nType: `Component`\n\nCustom component to override the default indicator component.\n\n### itemComponent\n\nType: `Component`\n\nCustom component to override the default item component.\n\n### onSelect\n\nType: `function`\n\nFunction to call when user selects an item. Item object is passed to that function as an argument.\n\n### onHighlight\n\nType: `function`\n\nFunction to call when user highlights an item. Item object is passed to that function as an argument.\n","publish_time":1745926475176,"_cnpm_publish_time":1745926475176,"dist-tags":{"latest":"6.2.0"}}