1.1.4 • Published 3 years ago

@sakit-sa/countdown-timer v1.1.4

Weekly downloads
36
License
MIT
Repository
github
Last release
3 years ago

@sakit-sa/countdown-timer

Simple, easy countdown timer for React

NPM JavaScript Style Guide

Countdown timer

Spinner gif

Live Playground

For examples of the countdown-timer in action, go to https://abdilar.github.io/countdown-timer.

OR

To run that demo on your own computer:

Getting Started

Install

npm install @sakit-sa/countdown-timer

Usage

import CountdownTimer from '@sakit-sa/countdown-timer';

<CountdownTimer 
  time={90}
  format="[hh]:[mm]:[ss]"
  onComplete={() => console.log("The timer completed")} 
/>

Props

NameTypeDefaultDescription
idstringcountdown-timer-[random-number]The unique identifier for the component.
classNameobject{}Apply a className to the control
timenumberrequiredThe value of the timer base on second.
formatstringHH:MM:SSFormats a time value.
onCompletefunction-Trigger when timer is zero.

Format Token

TokenDescription
HHHours leading zero for single-digit hours.
hhHours no leading zero for single-digit hours.
MMMinute leading zero for single-digit minute.
mmMinute no leading zero for single-digit minute.
SSSecond leading zero for single-digit second.
ssSecond no leading zero for single-digit second.

className Token

wrapperClass symbolClass digitClass hourClass minuteClass secondClass hourWrapperClass minuteWrapperClass secondWrapperClass

See examples for more information (go to https://abdilar.github.io/countdown-timer/?path=/story/theme--class-name)

License

MIT Licensed. © Copyright Saeed Abdilar