Customizable React progress bar with a labeled timer
npm install react-progress-bar-timer!NPM Version
!GitHub
!ECMAScript Version
Customizable React progress bar with a labeled timer

Demo •
Examples •
Tech Stack •
Features •
Installation •
Usage •
Styling
+ You can change the component's props via controls and see the rendered output.
+ Go to the Docs tab to see example usage code snippets and documentation for props of ProgressTimer.
+ Example Parcel App
+ Control timer via functions exposed by ref or started prop.
+ This can be served during development.
+ source code
+ Halo Time
+ Halo Infinite spawn timer SPA that controls started state of timers via started prop or by clicking a progress bar.
+ source code
+ React
+ Material-UI
+ react-scripts
+ Node.js
+ Chromatic
+ Vercel
+ Click to stop while running.
+ Click to start when unstarted.
+ Click to restart when finished.
+ Control timer with start(), stop(), and restart() via a ref.
+ Control timer with started prop.
+ Progress bar can fill or empty to represent progress.
+ Progress bar can move left or right.
+ Configure duration in seconds.
+ Flashing animation upon finishing.
+ Slide and Shrink/Grow text animations
+ When the timer is inactive, the label will be replaced with buttonText if provided.
+ Always show timer even when inactive with showDuration set to true
+ onFinish callback fired when timer finishes.
+ Customized styling with props
+ color
+ fontColor
+ fontSize
+ rootRounded
+ barRounded
+ classes
See Usage and Styling for more info.
yarn
``sh`
yarn add react-progress-bar-timer
npm
`sh`
npm install react-progress-bar-timer
`jsx
import ProgressTimer from 'react-progress-bar-timer';
const ExampleComponent = () => (
);
`
ProgressTimer Usage Docs
+ Use the story controls to change prop values and click Show code to see a snippet
| Name | Type | Default | Description |
|--------------|-----------------------|-------------|--------------------------------------------------------------------------------------------------------------|
| barRounded | boolean | false | Whether the progress bar should be rounded. |string
| buttonText | | | Text displayed when timer is inactive (overrides label). |object
| classes | | | Styles applied to the component (override or append to existing styles). ⓘ CSS Classes |string
| color | | "#1976d2" | Color of the bar; background is same with lower opacity. |"left"
| direction | \| "right" | "right" | Direction the bar grows toward. |number
| duration | | 60 | Duration of the timer in seconds. |string
| fontColor | |"#ffffffd9"| Color of the label and timer. |string
| fontSize | \| number | | Font size of the label and timer. Progress bar scales with font size. |string
| label | | | Label that describes the timer. |func
| onFinish | | | Callback fired when the timer finishes. |boolean
| rootRounded | | true | Whether the progress bar's root element should be rounded. |boolean
| showDuration | | false | Whether the timer's duration should be shown when inactive. |boolean
| started | \| null | | Whether the timer should be started.true (start) \| false (stop) \| null/undefined (await input). |"fill"
| variant | \| "empty" | "fill" | Determines if the bar fills or empties. |
+ The following classes can be used with the classes prop to customize the styling.
| Name | Type | Description |
|-------------------|----------|-----------------------------------------------|
| root | string | Styles applied to the root element. |string
| progressContainer | | Styles applied to the progress bar container. |string
| textContainer | | Styles applied to the text container. |string
| progress | | Styles applied to the progress bar. |string
| label | | Styles applied to the label. |string
| time | | Styles applied to the time. |
yarn
`sh`
yarn install
npm
`sh`
npm install
> Storybook can be used to demo your code changes in real time with HMR.
#### Starting Storybook
yarn
`sh`
yarn storybook
npm
`sh`
npm storybook
> In addition to Storybook, you can use the example app in example/ to test changes.
#### Watch for changes to src/
yarn
`sh`
yarn start
npm
`sh`
npm start
#### Serve Example App
yarn
`sh`
cd example/
yarn install
yarn start
npm
`sh``
cd example/
npm install
npm start
> The example app will now be served locally and use HMR to live update on changes to the source code or example app.