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🤷
- Host: GitHub
- URL: https://github.com/siamahnaf/otp-timer-ts
- Owner: siamahnaf
- License: mit
- Created: 2022-12-29T16:21:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-17T13:09:35.000Z (over 1 year ago)
- Last Synced: 2024-09-17T16:25:04.191Z (over 1 year ago)
- Topics: nextjs, otp, otp-timer, react, timer, timer-component
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/otp-timer-ts
- Size: 56.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)

# 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.
[](https://www.npmjs.com/package/otp-timer-ts)
[](https://github.com/siamahnaf198/otp-timer-ts)
[](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

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