|
| 1 | +# React component Count Down Timer |
| 2 | + |
| 3 | +This is a simple count down timer react component. |
| 4 | + |
| 5 | +### Demo |
| 6 | + |
| 7 | +The demo app source code lives inside the `src/docs` folder. |
| 8 | + |
| 9 | +## [Documentation](http://react-slick.neostack.com) |
| 10 | + |
| 11 | +### Installation |
| 12 | + |
| 13 | +**npm** |
| 14 | + |
| 15 | +```bash |
| 16 | +npm install count-down-timer --save |
| 17 | +``` |
| 18 | + |
| 19 | +⚠️ Also install count-down-timer for css |
| 20 | + |
| 21 | +```bash |
| 22 | +@import "~count-down-timer/lib/styles.css"; |
| 23 | +``` |
| 24 | + |
| 25 | + |
| 26 | +### Example |
| 27 | + |
| 28 | +```js |
| 29 | +import React from "react"; |
| 30 | +import CountDownTimer from "count-down-timer"; |
| 31 | + |
| 32 | +class SimpleCountDownTimer extends React.Component { |
| 33 | + render() { |
| 34 | + var settings = { |
| 35 | + count: 5432, |
| 36 | + border: true, |
| 37 | + showTitle: true, |
| 38 | + noPoints: true, |
| 39 | + }; |
| 40 | + return ( |
| 41 | + <CountDownTimer {...settings} /> |
| 42 | + ); |
| 43 | + } |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | +OR |
| 49 | + |
| 50 | + |
| 51 | +```js |
| 52 | +import React from "react"; |
| 53 | +import CountDownTimer from "count-down-timer"; |
| 54 | + |
| 55 | +class SimpleCountDownTimer extends React.Component { |
| 56 | + render() { |
| 57 | + return ( |
| 58 | + <CountDownTimer count={5432} border showTitle noPoints /> |
| 59 | + ); |
| 60 | + } |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +### Common API |
| 68 | + |
| 69 | +| Name | Type | Default | Description | |
| 70 | +| ------------ | ------- | ------- | ----------- | |
| 71 | +| className | string | `''` | Additional CSS class for the root DOM node | |
| 72 | +| count | number | `0` | The count value of the timer base on second | |
| 73 | +| border | boolean | `false` | If the value is `true`, it means a count-down-timer has a border | |
| 74 | +| showTitle | boolean | `false` | If the value is `true`, it means a count-down-timer has a title top of each section | |
| 75 | +| direction | `right` or `left` | `right` | Value 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. <br /> When `marks` is not an empty object, `step` can be set to `null`, to make `marks` as steps. | |
| 76 | +| noPoints | boolean | `false` | If vertical is `true`, the count-down-timer will be `:` between each section . | |
| 77 | +| color | string | `#000` | | |
| 78 | +| backgroundColor | string | `#fff` | | |
| 79 | +| responsive | boolean | `false` | If `true`, with is responsive. | |
| 80 | +| size | `small` or `middle` or `large` or `big` | `middle` | | |
| 81 | +| responsive | boolean | `false` | If `true`, with is responsive. | |
| 82 | +| hideDay | boolean | `false` | If `true`, hide day. | |
| 83 | +| hideHours | boolean | `false` | If `true`, hide hours . | |
| 84 | +| dayTitle | string | `Day` | | |
| 85 | +| hourTitle | string | `Hour` | | |
| 86 | +| minuteTitle | string | `Min` | | |
| 87 | +| secondTitle | string | `Sec` | | |
| 88 | +| onEnd | Function | () => {} | | |
| 89 | + |
| 90 | +## License |
| 91 | + |
| 92 | +`count-down-timer` is released under the MIT license. |
0 commit comments