# @giusto/ink-select-input

> Select input component for Ink

Latest version **3.2.0** (published 2019-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @giusto/ink-select-input
pnpm add @giusto/ink-select-input
yarn add @giusto/ink-select-input
bun add @giusto/ink-select-input
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2019-10-11 |
| First published | 2019-10-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 5 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vadim Demedes |
| Maintainers | lujiajing1126 |
| Keywords | ink, ink-component |

## Links

- npm: https://www.npmjs.com/package/@giusto/ink-select-input
- Repository: https://github.com/lujiajing1126/ink-select-input
- Homepage: https://github.com/lujiajing1126/ink-select-input#readme
- Issues: https://github.com/lujiajing1126/ink-select-input/issues
- npm.io page: https://npm.io/package/@giusto/ink-select-input

## Dependencies (5)

- [figures](https://npm.io/package/figures.md) ^3.0.0
- [arr-rotate](https://npm.io/package/arr-rotate.md) ^1.0.0
- [lodash.map](https://npm.io/package/lodash.map.md) ^4.6.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [lodash.isequal](https://npm.io/package/lodash.isequal.md) ^4.5.0

## Recent versions

- 3.2.0 (latest) — 2019-10-11

## README

# ink-select-input [![Build Status](https://travis-ci.org/vadimdemedes/ink-select-input.svg?branch=master)](https://travis-ci.org/vadimdemedes/ink-select-input)

> Select input component for [Ink](https://github.com/vadimdemedes/ink)


## Install

```
$ npm install ink-select-input
```


## Usage

```jsx
import React from 'react';
import {render} from 'ink';
import SelectInput from 'ink-select-input';

const Demo = () => {
	const handleSelect = item => {
		// `item` = { label: 'First', value: 'first' }
	};

	const items = [{
		label: 'First',
		value: 'first'
	}, {
		label: 'Second',
		value: 'second'
	}, {
		label: 'Third',
		value: 'third'
	}];

	return <SelectInput items={items} onSelect={handleSelect}/>
};

render(<Demo/>);
```

<img src="media/demo.gif" width="508">


## Props

### items

Type: `array`<br>
Default: `[]`

Items 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.
If no `key` prop is provided, `value` will be used as the item key.

### isFocusEnabled

Type: `boolean`<br>
Default: `true`

Listen 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.

### initialIndex

Type: `number`
Default: `0`

Index of initially-selected item in `items` array.

### onSelect

Type: `function`

Function to call when user selects an item. Item object is passed to that function as an argument.

### onHighlight

Type: `function`

Function to call when user highlights an item. Item object is passed to that function as an argument.

### indicatorComponent

Type: `Component`

Custom component to override the default indicator component.

### itemComponent

Type: `Component`

Custom component to override the default item component.

### limit

Type: `number`

Number of items to display.


## License

MIT © [Vadim Demedes](http://github.com/vadimdemedes)

---
_Source: https://npm.io/package/@giusto/ink-select-input · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
