ink-autocomplete
Autocomplete component for Ink.
Install
$ npm install ink-autocomplete
Usage
Use arrows to navigate up and down and press enter to submit.
import h render Component Text from 'ink'import AutoComplete from '..' // Demo { thisstate = value: '' selected: null thishandleChange = thishandleChange thishandleSubmit = thishandleSubmit } { const countries = label: 'United Kingdom' value: country: 'United Kingdom' capital: 'London' label: 'United States' value: country: 'United States' capital: 'Washington DC' label: 'United Arab Emirates' value: country: 'United Arab Emirates' capital: 'Abu Dhabi' return <div> <Text >'Enter your country: '</Text> <AutoComplete = = = = = /> selected && <span> <Text>The capital of your country is: </Text> <Text >selectedvaluecapital</Text> </span> </div> } { this } { this } // Ink

Props
string
value Value of the input.
string
placeholder String displayed when the input is empty.
array<item>
items A list of all items. Each item must include
label
andvalue
property.
string => item => bool
getMatch Called to determine which items satisfy the input.
function string => ()
onChange Called each time input is changed.
function (item) => ()
onSubmit Called once suggestion is selected.
Component
indicatorComponent Custom component to override the default item component.
Component
itemComponent Custom component to override the default item component.
License
MIT © Matic Zavadlal