A Progress Component Toolkit for React
npm install progress-kit
import React from "react";
import { ProgressBar } from "progress-kit";
function Example() {
return <ProgressBar />;
}
The useProgressState
hook is inspired by the patterns from Reakit.
import React from "react";
import { View } from "styled-view";
import { progressDefaultProps, useProgressState } from "progress-kit";
export const defaultProps = {
...progressDefaultProps,
color: "currentColor",
height: 20,
transition: "all 200ms ease"
};
export function MyProgressBar(props) {
const { color, transition, height, ...restProps } = props;
const { progress, progressProps } = useProgressState(props);
const barCssProps = {
backgroundColor: color,
height,
transition
};
return (
<View
{...progressProps}
{...barCssProps}
style={{
width: `${progressStateProps.progress}%`
}}
/>
);
}
MyProgressBar.defaultProps = defaultProps;
export default ProgressBar;