Code Monkey home page Code Monkey logo

react-count-to's Introduction

Build Status

React Count To

Animated counter component for React.js

Installation

$ npm install react-count-to --save

Demo

Live

http://react-count-to.herokuapp.com

Docker (thanks to Cirpo)

  • docker build -t react-count-to .
  • docker run -p 3000:3000 -it react-count-to
  • connect to http://localhost:3000 and enjoy

Usage

import CountTo from 'react-count-to';

<CountTo to={1234} speed={1234} />

or by passing function as a children

import CountTo from 'react-count-to';

const fn = value => <span>{value}</span>;

<CountTo to={1234} speed={1234}>{fn}</CountTo>

Attributes

  • from (optional): Counting from (default: 0).
  • to: Counting to.
  • speed: Duration (in milliseconds).
  • delay (optional): Delay (in milliseconds) between each refresh (default: 100).
  • onComplete (optional): A callback triggered when counting is done.
  • digits (optional): The number of digits to appear after the decimal point (default: 0).
  • className (optional): HTML class attribute for counter element.
  • tagName (optional): Element name that will be displayed (default: 'span').
  • children (optional): Function invoked on every update with value as parameter. Must return valid React element or null.
  • easing (optional): Function returning easing value based on input progress value from 0.0 to 1.0 (default: identity function).

Test

$ npm test

react-count-to's People

Contributors

michelebertoli avatar pwolaq avatar englercj avatar zetta83 avatar newoldmax avatar cirpo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.