# react-swipezor

> A beautiful react swipe button compatible with both desktop and mobile.

Latest version **1.0.7** (published 2021-10-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-swipezor
pnpm add react-swipezor
yarn add react-swipezor
bun add react-swipezor
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2021-10-22 |
| First published | 2020-09-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 559.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Simran Singh |
| Maintainers | zeus2198 |
| Keywords | react-swipezor, react, swipe-button, swipe, button, slide, swipe, button, slide-button, slide, button, swipezor |

## Links

- npm: https://www.npmjs.com/package/react-swipezor
- Repository: https://github.com/zeus2198/react-swipezor
- Homepage: https://github.com/zeus2198/react-swipezor#readme
- Issues: https://github.com/zeus2198/react-swipezor/issues
- npm.io page: https://npm.io/package/react-swipezor

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^16.13.1
- [webpack](https://npm.io/package/webpack.md) ^4.44.1
- [react-swipeable](https://npm.io/package/react-swipeable.md) ^5.5.1

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 1.0.7 (latest) — 2021-10-22
- 1.0.6 — 2020-09-12
- 1.0.5 — 2020-09-12
- 1.0.4 — 2020-09-12
- 1.0.3 — 2020-09-12
- 1.0.2 — 2020-09-12
- 1.0.1 — 2020-09-12
- 1.0.0 — 2020-09-12

## README

# react-swipezor
A beautiful react swipe button compatible with both desktop and mobile. This button uses [react-swipeable](https://github.com/FormidableLabs/react-swipeable) to detect the swipe action.

<center>
<img src="https://zeus2198.github.io/asset/swipe-mock.gif" />
</center>

## Installation
```bash
npm install --save react-swipezor
```
or
```bash
yarn add react-swipezor
```
## Demo / Example
[Click here](https://zeus2198.github.io/react-swipezor)

## Options
| Key              | Type                 | Default | Description                                                                                                                                                                                                                            |
|------------------|----------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| mainText         | `string` \| `react node` |         | Element that appears on button                                                                                                                                                                                                         |
| overlayText      | `string` \| `react node` |         | Element that appears on swipe overlay                                                                                                                                                                                                  |
| onSwipeDone      | `function`             |         | Callback that gets called when the button is swipped                                                                                                                                                                                   |
| reset            | `integer`            |         | If this value changes, the button is resseted to initial state, i.e., non-swiped state.                                                                                                                                                |
| caret | `string` \| `react node` |   | Element to serve as new caret, default is an image of arrow.
| classList        | `string`               | ''      | Class names that gets appended to main button element                                                                                                                                                                                  |
| overlayClassList | `string`               | ''      | Class names that gets appended to overlay element                                                                                                                                                                                      |
| caretClassList   | `string`               | ''      | Class names that gets appended to caret element                                                                                                                                                                                        |
| delta            | `integer`              | 10      | Minimum distance to swipe before swiping animation starts                                                                                                                                                                              |
| minSwipeWidth    | `float`              | 0.6     | Minimum width that a user needs to swipe till to change the button state to swipped state. Value ranges from `0-1`. For example, `0.6` means user needs to swipe atleast till 60% of total width of button to set it to swiped state. |
| minSwipeVelocity | `float`              | 0.6     | Other way to change button state to swiped is to swipe it quickly. If the swipe velocity is above this value then button is set to swiped state.  |

**Note**: Even if user swipes to lesser distance than the one specified by `minSwipeWidth` option, if his swipe velocity is above `minSwipeVelocity` the button state will be changed to swiped.


---
### Development
Firstly install the dependencies with `npm install` or `yarn install`.

Now make sure you are in root of the folder, use the following command to create a link locally, which is to be used in example project, using the following command
```bash
npm link
```
Now start the automatic rebuild for hot reloading purpose using the command:
```bash
npm start
```
Keep this terminal opened and move onto next step.

Now you need to start the example project, to do this make sure your current directory is `/example`, install its dependencies too using `npm install` or `yarn install` command. Now link react-swipezor to the example project using the command:
```bash
npm link react-swipezor
```
Now you can start the example project by running the command:
```
npm start
```
Now you are ready to make changes to `/src/index.js` file.

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