{"name":"ink-select-input","version":"6.1.0","keywords":["ink","ink-component"],"author":{"url":"https://github.com/vadimdemedes","name":"Vadim Demedes","email":"vdemedes@gmail.com"},"license":"MIT","_id":"ink-select-input@6.1.0","maintainers":[{"name":"vdemedes","email":"vadimdemedes@hey.com"},{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/vadimdemedes/ink-select-input#readme","bugs":{"url":"https://github.com/vadimdemedes/ink-select-input/issues"},"xo":{"rules":{"unicorn/filename-case":"off","unicorn/no-hex-escape":"off","unicorn/prevent-abbreviations":"off"},"extends":["xo-react"],"prettier":true},"ava":{"extensions":{"ts":"module","tsx":"module"},"nodeArguments":["--import=tsimp/import"]},"dist":{"shasum":"303ad773c50d66a94f8361f16eadb4cda545c13e","tarball":"http://registry-npm.ywwl.com/ink-select-input/download/ink-select-input-6.1.0.tgz","fileCount":15,"integrity":"sha512-1boZhTVKdaT0SlqQLmKLYgBI6UUSwmdHLXUh8fpMdYx/c06cXjskQSKQZptSOzt+diagemTMwnmIzV+fvJuBNw==","signatures":[{"sig":"MEQCICVq/vPY39C37oCh3e5Dvg8a28B4fIsQvS2FSZZCJLMSAiA7g+ChkNA5tmvEsZQVtCkrJtzhu8HKbl+cjbvfmZcrRw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16818,"size":5174,"noattachment":false,"key":"/ink-select-input/-/ink-select-input-6.1.0.tgz"},"type":"module","engines":{"node":">=18"},"exports":{"types":"./build/index.d.ts","default":"./build/index.js"},"gitHead":"f82c536ef00dd72b055b419184090d080e9d5e9e","scripts":{"test":"xo && ava","build":"tsc","prepare":"tsc","pretest":"tsc"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"prettier":"@vdemedes/prettier-config","repository":{"url":"git+https://github.com/vadimdemedes/ink-select-input.git","type":"git"},"_npmVersion":"10.9.2","description":"Select input component for Ink","directories":{},"_nodeVersion":"23.6.1","dependencies":{"figures":"^6.1.0","to-rotated":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.58.0","ava":"^6.1.3","ink":"^5.0.0","delay":"^6.0.0","react":"^18.3.1","sinon":"^18.0.0","tsimp":"^2.0.11","prettier":"^3.2.5","typescript":"^5.4.5","@types/node":"^22.14.1","@types/react":"^18.3.2","@types/sinon":"^17.0.3","eslint-plugin-react":"^7.34.1","ink-testing-library":"^4.0.0","@sindresorhus/tsconfig":"^5.0.0","eslint-config-xo-react":"^0.27.0","@vdemedes/prettier-config":"^2.0.1","eslint-plugin-react-hooks":"^4.6.2"},"peerDependencies":{"ink":">=5.0.0","react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ink-select-input_6.1.0_1744994475534_0.15247225181284008","host":"s3://npm-registry-packages-npm-production"},"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":1744994475735,"_cnpm_publish_time":1744994475735,"dist-tags":{"latest":"6.2.0"}}