# @n3/react-input

> Input component for react applications based on @n3/kit

Latest version **0.2.0** (published 2021-01-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @n3/react-input
pnpm add @n3/react-input
yarn add @n3/react-input
bun add @n3/react-input
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-01-26 |
| First published | 2020-06-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 20.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vadim Taits |
| Maintainers | v.voloshin, n3admin, vtaits, k.kulik, a_sannikov |

## Links

- npm: https://www.npmjs.com/package/@n3/react-input
- Repository: git@gitlab.develop.netrika.ru:web/n3components
- npm.io page: https://npm.io/package/@n3/react-input

## Dependencies (3)

- [@n3/css-base](https://npm.io/package/@n3/css-base.md) ^0.1.1
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.12.5
- [styled-components](https://npm.io/package/styled-components.md) ^5.2.1

## Recent versions

- 0.2.0 (latest) — 2021-01-26
- 0.1.1 — 2020-06-08
- 0.1.0 — 2020-06-05

## README

# @n3/react-input

Инпут для приложений на базе `@n3/input`.

```javascript
import Input from '@n3/react-input';
```

## Использование

### Обычный инпут

```javascript
import React, { useState } from 'react';
import Input from '@n3/react-input';

const Example = () => {
  const [value, setValue] = useState('');
  
  <Input
    value={value}
    onChange={(event) => {
      setValue(event.target.value);
    }}
  />
};
```

### С кнопкой

```javascript
import React, { useState } from 'react';
import Input, {
  StyledButton,
} from '@n3/react-input';

const Example = () => {
  const [value, setValue] = useState('');
  
  <Input
    value={value}
    onChange={(event) => {
      setValue(event.target.value);
    }}
    buttons={[
      (inputProps, index) => (
        <StyledButton
          type="button"
          key={index}
        >
          <FontAwesomeIcon
            icon="cog"
          />
        </StyledButton>
      ),

      (inputProps, index) => (
        <StyledButton
          type="button"
          key={index}
        >
          <FontAwesomeIcon
            icon="file"
          />
        </StyledButton>
      ),
    ]}
  />
};
```

### Обычный инпут

```javascript
const [value, setValue] = useState('');

<Input
  value={value}
  onChange={(event) => {
    setValue(event.target.value);
  }}
/>
```

## Props

### Input

| Название | Обязательность | Тип | Значение по умолчанию | Описание |
|----------|----------------|-----|-----------------------|----------|
| component |  | InputComponent |  | Компонент корневого элемента инпута |
| disabled |  | boolean |  | Выключено ли поле |
| hasError |  | boolean |  | Есть ли у поля ошибка |
| hasWarning |  | boolean |  | Есть ли у поля предупреждение |
| small |  | boolean |  | Маленькое ли поле |
| className |  | string |  | Дополнительный класс корневого компонента инпута |
| isOnlyBorderBottom |  | boolean |  | Отображение без рамки только с подчёркиванием снизу |
| buttons |  | RenderInputButton[] |  | Массив функций реднеда кнопок<br>@param props - все props инпута<br>@param index - индекс кнопки |

### StyledButton

| Название | Обязательность | Тип | Значение по умолчанию | Описание |
|----------|----------------|-----|-----------------------|----------|
| disabled |  | boolean |  | Кнопка выключена |
| $small |  | boolean |  | Кнопка маленькая |

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