# @jamiedixon/ink-text-input

> Text input component for Ink

Latest version **3.0.2** (published 2019-03-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jamiedixon/ink-text-input
pnpm add @jamiedixon/ink-text-input
yarn add @jamiedixon/ink-text-input
bun add @jamiedixon/ink-text-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.0.2 |
| Published | 2019-03-07 |
| First published | 2019-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 1 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 183 |
| Author | Vadim Demedes |
| Maintainers | jamiedixon |
| Keywords | ink, text, input, component, jsx, react, stdin, keypress, search, query |

## Links

- npm: https://www.npmjs.com/package/@jamiedixon/ink-text-input
- Repository: https://github.com/vadimdemedes/ink-text-input
- Homepage: https://github.com/vadimdemedes/ink-text-input#readme
- Issues: https://github.com/vadimdemedes/ink-text-input/issues
- npm.io page: https://npm.io/package/@jamiedixon/ink-text-input

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 3.0.2 (latest) — 2019-03-07
- 3.0.1 — 2019-03-07
- 3.0.0 — 2019-03-07

## README

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

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


## Install

```
$ npm install ink-text-input
```


## Usage

```jsx
import React from 'react';
import {render} from 'ink';
import TextInput from 'ink-text-input';

class SearchQuery extends React.Component {
	constructor() {
		super();

		this.state = {
			query: ''
		};

		this.handleChange = this.handleChange.bind(this);
		this.handleSubmit = this.handleSubmit.bind(this);
	}

	render() {
		return (
			<Box>
				<Box marginRight={1}>
					Enter your query:
				</Box>

				<TextInput
					value={this.state.query}
					onChange={this.handleChange}
				/>
			</Box>
		);
	}

	handleChange(query) {
		this.setState({query});
	}
}

render(<SearchQuery/>);
```

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


## Props

### value

Type: `string`

Value to display in a text input.

### placeholder

Type: `string`

Text to display when `value` is empty.

### showCursor

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

Whether to show cursor and allow navigation inside text input with arrow keys.

### mask

Type: `string`

Replace all chars and mask the value. Useful for password inputs.

```jsx
<TextInput
	value="Hello"
	mask="*"
/>
//=> "*****"
```

### onChange

Type: `Function`

Function to call when value updates.


## License

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

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