2.0.1 • Published 5 days ago

ng-circle-countdown v2.0.1

Weekly downloads
-
License
-
Repository
github
Last release
5 days ago

Angular circle countdown (NgCircleCountdown)

Build Status npm version npm

An Angular package for displaying a circle countdown fully configurable.

alt

Compatibility:

AngularAngular
16.x.x1.0.3
17.x.x2.0.0

Installation

Install This Library

$ npm install ng-circle-countdown --save

Usage

Import

Add CircleCountdownModule to your module file:

imports: [CircleCountdownModule];

You can use it by this way:

<div class="counter-container">
    <ng-circle-countdown
        #timer_color
        [duration]="10000"
        [colors]="[ '#004777', '#F7B801', '#A30000', '#A30000' ]"
        [colorsTime]="[ 7, 5, 2, 0 ]">
        <ng-template #counter let-counter>
            <span class="remaining-time" [style.color]="counter.color">{{counter.value}}</span>
        </ng-template>
    </ng-circle-countdown>
</div>

To catch the onComplete countDown event, you have to import the CountdownService and use a compute on the isCompleted property:

public isCompleted: Signal
<boolean> = computed(() => this.countDown().isCompleted);

You can choose to use a formControl or just a formControlName. It depends on your needs.

Options

OptionsTypeDefaultDescription
durationnumber0Countdown duration (in ms)
colorstring#004777Primary color for the countdown displaying
colors<string>[][]Colors (HEX format) for the countdown displaying if you want to insert a gradient
colorsTimenumber[][]Time interval(in s) to determine when the countdown should change color
strokeWidthnumber6Line thickness countdown
sizenumberNoneDefine the component size to match with your UI
rotationRotationTypeclockwiseDirection of the countdown rotation

You can choose to set only one color to the countdown, so you just have to set the color property.

If you want to generate a gradient color, then set the colors array with the colors you want to display. You also have to set colorsTime array property to configure the color change moment.

2.0.1

5 days ago

2.0.0

6 days ago

1.0.2

5 months ago

1.0.3

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago