Noctiflorous Pansy Mulch
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

react-simple-countdown

1.2.1 • Public • Published

react-simple-countdown

A simple countdown component with React <3

install

npm install react-simple-countdown --save

How to use

import component:

import CountDown from 'react-simple-countdown';

Props

date

A string width valid date like isoformat or js dates

className

Custom component class

Example

import React from 'react';
import { render } from 'react-dom';
import CountDown from 'react-simple-countdown';
 
function finish() {
  console.log('Countdown finished');
}
 
function MyComponent() {
  // i18n or custom messages
  const messages = {
    days: {
      plural: 'Days',
      singular: 'Day',
    },
    hours: 'Hours',
    mins: 'Min',
    segs: 'Seg',
  }
  return (
    <CountDown
      date="2015-09-12T00:00:00+00:00"
      className="MyCoundown"
      {...messages}
      onEnd={finish}
    />
  );
}
 
render(<MyComponent/>, document.body);

Custom classNames

Rendered html output for prop className="MyCountdown"

<div className="MyCountdown">
  <div class="MyCountdown-col is-day">
    <p><strong>01</strong><span>Days</span></p>
  </div>
 
  <div class="MyCountdown-col is-hour">
    <p><strong>00</strong><span>Hours</span></p>
  </div>
  <div class="MyCountdown-col is-min">
    <p><strong>00</strong><span>Mins</span></p>
  </div>
  <div class="MyCountdown-col is-seg">
    <p><strong>10</strong><span>Seg</span></p>
  </div>
</div>

install

npm i react-simple-countdown

Downloadsweekly downloads

20

version

1.2.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
Report a vulnerability