1.0.0 • Published 3 years ago

@delowar/react-circle-progressbar v1.0.0

Weekly downloads
1,195
License
MIT
Repository
github
Last release
3 years ago

React Circle Progressbar

React Circle Progressbar

Highly customizable & lightweight circular progressbar component for React, built with SVG and extensively customizable.

Table of contents

Installation

Install with npm:

npm i @delowar/react-circle-progressbar

or yarn:

yarn add @delowar/react-circle-progressbar

Usage and Examples

import React from 'react';
import Progress from '@delowar/react-circle-progressbar';

// Basic Usage
<Progress percent={40}/>

// with children 
<Progress percent={40}>40%</Progress>

// Default Gradient
<Progress isGradient />

// Customize Gradient
<Progress 
    isGradient 
    gradient={{
        angle: 90,
        startColor: '#ff0000',
        stopColor: '#ffff00'
    }}
/>

// Default Shadow
<Progress isBgShadow />   

// Customize Shadow
<Progress
    isBgShadow 
    bgShadow={{
        inset: true,
        vertical: 2,
        horizontal: 2,
        blur: 4,
        opacity: .4,
        color: '#000000'
    }}
    emptyColor="#f7f7f7" 
    borderWidth="6"
    borderBgWidth="30" 
/>

Props

Available Props, this package supports 30+ props

NamesDescriptionDefault ValueTypeRange/Max
sizeCircle height & Width180Int
borderWidthCircle Border width15Int
borderBgWidthCircle Border Background width15Int
fillColorStroke Fill Color#288febStringN/A
emptyColorStroke (empty) BG Fill Color#288febStringN/A
backgroundCircle BackgroundnoneStringN/A
classNameComponent Custom Class''StringN/A
percentFill Percent55Int100
linecapStroke Line StyleroundStringN/A
isGradientEnable GradientfalseBooleanN/A
transitionApply transition when percent change200 (ms)Int
gradientGradient Essential Values{...}ObjectN/A
isShadowEnable Circle ShadowfalseBooleanN/A
shadowShadow Essential Values{...}ObjectN/A
isBgShadowEnable Circle BG ShadowfalseBooleanN/A
bgShadowShadow Essential Values{...}ObjectN/A
viewportAnimate when element is in viewporttrueBooleanN/A
onViewportCallback function to detect viewportnullFunctionN/A

Example:

<Progress size={20} />

props.gradient

NamesDescriptionDefault ValueTypeRange/Max
angleGradinet Angle0Int0-360
startColorGradient Start Color#ff0000StringN/A
stopColorGradient Stop Color#ffff00StringN/A

Example:

<Progress 
    isGradient 
    gradient={{
        angle: 90,
        startColor: '#ff0000',
        stopColor: '#ffff00'
    }}
/>

props.shadow

NamesDescriptionDefault ValueTypeRange/Max
insetSet Shadow Inset or OutsetfalseBooleanN/A
verticalShadow Vertical Offset3Int
horizontalShadow Horizontal Offset0Int
blurShadow Blur0Int
opacityShadow Opacity.4Float0-1
colorShadow Color#000000String0-1

Example

<Progress
    isShadow 
    shadow={{
        inset: true,
        vertical: 2,
        horizontal: 2,
        blur: 4,
        opacity: .4,
        color: '#000000'
    }}
/>

props.bgShadow

NamesDescriptionDefault ValueTypeRange/Max
insetSet Shadow Inset or OutsetfalseBooleanN/A
verticalShadow Vertical Offset3Int
horizontalShadow Horizontal Offset0Int
blurShadow Blur0Int
opacityShadow Opacity.4Float0-1
colorShadow Color#000000String0-1

Example

<Progress
    isBgShadow 
    bgShadow={{
        inset: true,
        vertical: 2,
        horizontal: 2,
        blur: 4,
        opacity: .4,
        color: '#000000'
    }}
/>

Callback

This callback function fires when the target element is in the viewport.

<Progress
    onViewport={elem => {
        // console.log(elem)
    }} 
/>

Default Props

const defaultProps = {
    size: 180,
    borderWidth: 15,
    borderBgWidth: 15,
    fillColor: '#288feb',
    emptyColor: '#dddddd',
    background: 'none',
    className: '',
    percent: 55,
    linecap: 'round',
    isGradient: false,
    gradient: {
        angle: 0,
        startColor: '#ff0000',
        stopColor: '#ffff00',
    },
    isShadow: false,
    shadow: {
        inset: false,
        vertical: 10,
        horizontal: 0,
        blur: 10,
        opacity: .5,
        color: '#000000'
    },
    isBgShadow: false,
    bgShadow: {
        inset: true,
        vertical: 3,
        horizontal: 0,
        blur: 3,
        opacity: .4,
        color: '#000000'
    },
    viewport: true
}
1.0.0

3 years ago

0.1.6

3 years ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.95

4 years ago

0.0.91

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago