0.1.8 • Published 5 years ago

react-component-countdown-timer v0.1.8

Weekly downloads
532
License
MIT
Repository
github
Last release
5 years ago

React component Countdown Timer

This is a simple countdown timer react component.

Demo

The demo app source code lives inside the src/docs folder.

Documentation

Installation

npm

npm install react-component-countdown-timer --save

⚠️ Also install react-component-countdown-timer for css

@import "~react-component-countdown-timer/lib/styles.css";

Example

import React from "react";
import CountdownTimer from "react-component-countdown-timer";

class SimpleCountdownTimer extends React.Component {
  render() {
    var settings = {
      count: 5432,
      border: true,
      showTitle: true,
      noPoints: true,
    };
    return (
      <CountdownTimer {...settings} />
    );
  }
}

OR

import React from "react";
import CountdownTimer from "react-component-countdown-timer";

class SimpleCountdownTimer extends React.Component {
  render() {
    return (
      <CountdownTimer count={5432} border showTitle noPoints />
    );
  }
}

Common API

NameTypeDefaultDescription
classNamestring''Additional CSS class for the root DOM node
idstring''Additional id for the root DOM node
countnumber0The count value of the timer base on second
borderbooleanfalseIf the value is true, it means a react-component-countdown-timer has a border
showTitlebooleanfalseIf the value is true, it means a react-component-countdown-timer has a title top of each section
directionright or leftleftValue to be added or subtracted on each step the slider makes. Must be greater than zero, and max - min should be evenly divisible by the step value. When marks is not an empty object, step can be set to null, to make marks as steps.
noPointsbooleanfalseIf vertical is true, the react-component-countdown-timer will be : between each section .
colorstring#000
backgroundColorstring#fff
responsivebooleanfalseIf true, with is responsive.
sizenumber18count number font size
labelSizenumber12if showTitle is true this set label font size
responsivebooleanfalseIf true, with is responsive.
hideDaybooleanfalseIf true, hide day.
hideHoursbooleanfalseIf true, hide hours .
dayTitlestringDay
hourTitlestringHour
minuteTitlestringMin
secondTitlestringSec
onEndFunction() => {}

License

react-component-countdown-timer is released under the MIT license.