progress-halo
💫 React component, for adding dynamic progress ring around other components, for example around user avatar.
Examples
https://galpsi.netlify.app/posts/progress-halo
Install
If you're using npm:
npm install progress-halo --save
If you're using yarn:
yarn add progress-halo
Usage
In react component:
;;{const progress color progressColor radius = 60 width } = props;return<Wrapper>/*your custom avatar component or any other component*/<CustomAvatar src=avatar_img /><ProgressHaloprogress=progresscolor=colorprogressColor=progressColorradius=radiuswidth=width/></Wrapper>;};
Positioning with styled-components (preferred):
;;const Wrapper = styleddiv`position: relative;`;const CustomAvatar = styledimg`max-width: 100px;`;const StyledProgressHalo = `position: absolute;top: -10px;left: -10px;`;
Positioning with css:
Props
Props | Description |
---|---|
progress?: number |
set current progress value in percentage |
color?: string |
hex color code for basic fill |
progressColor?: string |
hex color code for progress part |
radius?: number |
radius of the ring |
width?: number |
width of the ring, use integer number |
className?: string |
css class name for styling |
- changing of progress property has smooth animation