# react-bootstrap-touchspin

> React-Bootstrap-Touch-Spin

Latest version **1.6.0** (published 2022-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-bootstrap-touchspin
pnpm add react-bootstrap-touchspin
yarn add react-bootstrap-touchspin
bun add react-bootstrap-touchspin
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.0 |
| Published | 2022-02-27 |
| First published | 2022-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 32.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Arash Zhianfard |
| Maintainers | arash.zhianfard |
| Keywords | react, hooks, bootstrap, touchSpin, component |

## Links

- npm: https://www.npmjs.com/package/react-bootstrap-touchspin
- Repository: https://github.com/Arash-Zhianfard/React-Bootstrap-TouchSpin
- Homepage: https://github.com/Arash-Zhianfard/React-Bootstrap-TouchSpin#readme
- Issues: https://github.com/Arash-Zhianfard/React-Bootstrap-TouchSpin/issues
- npm.io page: https://npm.io/package/react-bootstrap-touchspin

## Dependencies (6)

- [ts-jest](https://npm.io/package/ts-jest.md) ^27.1.3
- [bootstrap](https://npm.io/package/bootstrap.md) ^4.6.0
- [@types/jest](https://npm.io/package/@types/jest.md) ^27.4.1
- [bootstrap-icons](https://npm.io/package/bootstrap-icons.md) ^1.8.0
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) ^12.1.3
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) ^5.16.2

## 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

- 1.6.0 (latest) — 2022-02-27
- 1.4.0 — 2022-02-22
- 1.3.0 — 2022-02-19
- 1.2.0 — 2022-02-19
- 1.1.0 — 2022-02-15
- 1.0.0 — 2022-02-15

## README

# React-Bootstrap-TouchSpin
#### No need for Jquery
<HR />

# Getting Started

## Installation

`npm i react-bootstrap-touchspin`

## Usage

### Import Bootstrap style to the project

```js
import 'bootstrap/dist/css/bootstrap.css';
import "bootstrap-icons/font/bootstrap-icons.css";
import "react-bootstrap-touchspin/lib/dist/styles.css";
```

**Bootstrap 4.6.0 has already installed.**

### The component can be used in following ways
1-Simple
```ts
const App = () => {
  const myCounterHandler = (counter: number) => {
    console.log(counter);
  };
  return (
    <React.Fragment>
      <TouchSpin counterHandler={myCounterHandler} />
    </React.Fragment>
  );
};
```
![](https://i.ibb.co/XyxSGt6/touch-Spine-without-Sign.png)

---
2-Sign On the left
```ts
<TouchSpin
  sign={'#'}
  signAlignment={Alignment.Left}
  step={1}
  initValue={0}
  max={100}
  min={-20}
  decimals={1}
  counterHandler={myCounterHandler}
/>
```
![](https://i.ibb.co/d2Wh6CD/touch-Spine-left-Sign.png)

---
3-Sign On the right
```ts
<TouchSpin
  sign={'#'}
  signAlignment={Alignment.Right}
  step={1}
  initValue={0}
  max={5000}
  min={0}
  decimals={1}
  counterHandler={myCounterHandler}
/>
```
![](https://i.ibb.co/nBFW3yM/touch-Spine-right-Sign.png)

---
4-Vertical buttons

```ts
<TouchSpin
 step={1.02}
 decimals={1}
 initValue={0}
 counterHandler={myCounterHandler}
 verticalButtons={true}
 />
```
 ![](https://i.ibb.co/hDKFSkB/up.jpg)

 ---
| Parameter |DefaultValue   |Optional| Description |
| --- | --- | --- | --- |
| signAlignment|**Left** if sign defined |*|Alignment for sign|
| sign|-|*|Sing to show on left/right of the touchspin |
| initValue|0|*|Initial value|
| step|1|*|Incremental/Decremental step on up/down change|
| min|0|*|	Minimum value|
| max|200000|*|Maximum value|
| decimals|0|*|Number of decimal points|
| counterHandler|-|-|Handler to get counter value |
| verticalButtons|false|*|Enables vertical up/down buttons|
| verticalUpClass|"bi bi-caret-up-fill"|*|Bootstrap icon's class name for up button if vertical buttons mode enabled|
| verticalDownClass|"bi bi-caret-down-fill"|*|Bootstrap icon's class name for down button if vertical buttons mode enabled|
|iconSize|11px|*|Bootstrap icon's size|
parentStyle|-|*|Style for the parent container|
inputStyle|-|*|Input's style|

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