Socket
Socket
Sign inDemoInstall

@tomik23/react-circular-progress-bar

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tomik23/react-circular-progress-bar

A circular progress bar in svg


Version published
Weekly downloads
171
decreased by-2.84%
Maintainers
1
Weekly downloads
 
Created
Source

react-circular-progress-bar

React library to help developers to draw animated, cross-browser, highly customizable progress circles using SVG and plain JavaScript.

Demo

See the demo - example

Install

yarn add @tomik23/react-circular-progress-bar
# or
npm install @tomik23/react-circular-progress-bar

Usage

import { CircularProgressBar } from '@tomik23/react-circular-progress-bar'
// available control variables
const props = {
  percent: 60, // is require
  colorSlice: '#00a1ff',
  colorCircle: '#00a1ff',
  fontColor: '#365b74',
  fontSize: '1.6rem',
  fontWeight: 400,
  size: 200,
  stroke: 10,
  strokeBottom: 5,
  opacity: 10,
  speed: 60,
  round: true,
  number: true,
  linearGradient: ["#ffff00", "brown"]
}

<CircularProgressBar {...props} />

Update percent

If you want to update component you have to add id to each of them

const config = {
  id: 0, // important
  percent: 50,
  colorSlice: '#E91E63',
}

function App() {
  const [update, setUpdate] = useState(config);

  useEffect(() => {
    const interval = setInterval(() => {
      setUpdate({
        ...config,
        id: 0, // we indicate which component we want to change
        percent: Math.floor(Math.random() * 100 + 1),
      });
    }, 3000);
    return () => clearInterval(interval);
  }, []);

  const newObject = { ...config, ...update };

  return (
    <div>
      <CircularProgressBar {...newObject} />
    </div>
  );
}

Configuration of the plugin

propstypedefaultrequiredescription
percentnumberRepresents the progress bar and animation of the animation progress expressed by a number e.g. 65%
idnumberIf you want to update a component, you need to add an id to each of them. Also when you want to display several components with different gradients - linearGradient
colorSlicestring'#00a1ff'Progress layer color and background "#ffff00","brown" *
colorCirclestring'#00a1ff'Bottom circle color Font "#ffff00","brown" *
strokenumber10Stroke width, chart thickness
strokrBottomnumber10If "strokBottom" is set, it is used to generate a background circle size
roundbooleanfalsePath rounding
speednumber60Animation speed, 60fps by default
opacitynumber10Opacity box-shadow, 10 = 1, 9 = 0.9 ... 1 = 0.1
numberbooleantrueAdd props number and set to false to hide the number with percent
sizenumber200Size progress bar width and height in px
fontSizestring1.6remFont size. The font can be shown in units rem, em, px ...
fontWeightnumber400400, 600, ...
fontColorstring'#365b74'Font color "#ffff00","brown" *
linearGradientarrayArray of colors "lineargradient": "#ffff00","brown" *

Colors names

* See colors names

Browsers support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Opera
Opera
Vivaldi
Vivaldi
IE11+, Edgelast 2 versionslast 2 versionslast 2 versionslast 2 versions

Keywords

FAQs

Package last updated on 08 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc