An open API service indexing awesome lists of open source software.

https://github.com/siamahnaf/otp-timer-ts

A simple react otp timer component with resend functionality🤷
https://github.com/siamahnaf/otp-timer-ts

nextjs otp otp-timer react timer timer-component

Last synced: 7 months ago
JSON representation

A simple react otp timer component with resend functionality🤷

Awesome Lists containing this project

README

          

# ⚠️ Package Renamed & No Longer Maintained

## This package has been renamed to [`@siamf/otp-timer`](https://www.npmjs.com/package/@siamf/otp-timer)

### Please use [`@siamf/otp-timer`](https://www.npmjs.com/package/@siamf/otp-timer) instead.

This package **is no longer maintained**. For the latest updates and improvements, migrate to:

👉 [`@siamf/otp-timer`](https://www.npmjs.com/package/@siamf/otp-timer)



Siam Ahnaf

# otp-timer-ts

A simple and customizable react otp timer component with typescript support. very simple and more customizable design and smallest bundle size about 13kb. You can use this component into any react and nextjs projects.

[![npm downloads](https://cdn.jsdelivr.net/gh/siamahnaf198/react-simple-phone-input@main/assets/downloads.svg)](https://www.npmjs.com/package/otp-timer-ts)
[![PRs Welcome](https://cdn.jsdelivr.net/gh/siamahnaf198/react-simple-phone-input@main/assets/prs-welcome.svg)](https://github.com/siamahnaf198/otp-timer-ts)
[![MIT licensed](https://cdn.jsdelivr.net/gh/siamahnaf198/react-simple-phone-input@main/assets/license.svg)](https://github.com/siamahnaf198/otp-timer-ts/blob/main/LICENSE)

- SSR Friendly
- Customizable
- TypeScript Support
- Smallest Bundle Size(About 13kb)

## Installation

```shell-script
$ npm i otp-timer-ts --save
```

## Demo

Girl in a jacket

## Usage?

```
import { Otptimer } from "otp-timer-ts";

const Home = () => {
const handleResend = () => {
//desired function to be performed on clicking resend button
}
return (




);
};

export default Home;

```

## Options

| name | Description | Default Value |
| :--------- | :-------------------------------------------------------------: | :-----------: |
| seconds | number of seconds for which timer must be set | 30 |
| minutes | number of minutes for which the timer must be set | 0 |
| onResend | function that would get triggered on clicking the resend button | n/a |
| text | content that you want to put down | Resend otp in |
| ButtonText | button text | Resend |

## Styling


Name
Type
Description


containerClass
string
timer Container class name


textClass
string
text class name


timerClass
string
timer class name


buttonContainerClass
string
button container class


buttonStyle
CSSProperties
styles for resend button


buttonContainerStyle
CSSProperties
styles for resend button container


textStyle
CSSProperties
styles for text


timerStyle
CSSProperties
styles for timer


textContainerStyle
CSSProperties
styles for timer text container

## Issues

You are welcome to create an issue.

## Stay in touch

- Author - [Siam Ahnaf](https://www.siamahnaf.com/)
- Website - [https://www.siamahnaf.com/](https://www.siamahnaf.com/)
- Twitter - [https://twitter.com/siamahnaf198](https://twitter.com/siamahnaf198)
- Github - [https://github.com/siamahnaf](https://github.com/siamahnaf)

## License
otp-timer-ts is [MIT licensed](https://github.com/siamahnaf/otp-timer-ts/blob/main/LICENSE).