# ink-confirm-input

> Confirmation input component for Ink

Latest version **2.0.0** (published 2019-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install ink-confirm-input
pnpm add ink-confirm-input
yarn add ink-confirm-input
bun add ink-confirm-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 | 2.0.0 |
| Published | 2019-09-11 |
| First published | 2017-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Kevin Mårtensson |
| Maintainers | kevva |
| Keywords | boolean, checked, component, confirm, input, ink, no, yes |

## Links

- npm: https://www.npmjs.com/package/ink-confirm-input
- Repository: https://github.com/kevva/ink-confirm-input
- Homepage: https://github.com/kevva/ink-confirm-input#readme
- Issues: https://github.com/kevva/ink-confirm-input/issues
- npm.io page: https://npm.io/package/ink-confirm-input

## Dependencies (3)

- [yn](https://npm.io/package/yn.md) ^3.1.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10
- [ink-text-input](https://npm.io/package/ink-text-input.md) ^3.2.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-09-11
- 1.0.3 — 2017-07-24
- 1.0.2 — 2017-07-24
- 1.0.1 — 2017-07-24
- 1.0.0 — 2017-07-24

## README

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

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


## Install

```
$ npm install ink-confirm-input
```


## Usage

```js
import React, {useCallback, useState} from 'react';
import {render, Box} from 'ink';
import ConfirmInput from 'ink-confirm-input';

const UnicornQuestion = () => {
	const [answer, setAnswer] = useState();
	const [value, setValue] = useState('');
	const handleSubmit = useCallback(submitValue => {
		if (submitValue === false) {
			setAnswer({answer: 'You are heartless…'});
			return;
		}

		setAnswer({answer: 'You love unicorns!'});
	}, [setAnswer]);

	return (
		<Box>
			Do you like unicorns? (Y/n)

			<ConfirmInput
				isChecked
				value={value}
				onChange={setValue}
				onSubmit={handleSubmit}
			/>

			{answer && answer}
		</Box>
	);
};

render(<UnicornQuestion/>);
```


## API

### `<ConfirmInput/>`

#### Props

`<ConfirmInput/>` accepts the same props as [`<TextInput/>`](https://github.com/vadimdemedes/ink-text-input) in addition to the ones below.

##### isChecked

Type: `boolean`

Whether to return `true` or `false` by default.

##### value

Type: `string`

Value to display in a text input.

##### placeholder

Type: `string`

Text to display when `value` is empty.

##### onChange

Type: `Function`

Function to call when value updates. Returns a `string` with the input.

##### onSubmit

Type: `Function`

Function to call when user press <kbd>Enter</kbd>. Returns a `boolean` for the answer.

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