{"id":15774003,"url":"https://github.com/bezenson/react-odometerjs","last_synced_at":"2025-04-09T18:17:52.338Z","repository":{"id":44381072,"uuid":"76646336","full_name":"bezenson/react-odometerjs","owner":"bezenson","description":"Odometer.js React Component","archived":false,"fork":false,"pushed_at":"2024-02-01T16:42:09.000Z","size":1890,"stargazers_count":65,"open_issues_count":3,"forks_count":16,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T18:17:46.844Z","etag":null,"topics":["component","javascript","javascript-library","odometer","react","reactjs","wrapper","wrapper-library","yarn"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bezenson.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.MD","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-12-16T10:51:06.000Z","updated_at":"2025-03-13T09:52:03.000Z","dependencies_parsed_at":"2024-02-01T18:10:01.297Z","dependency_job_id":"e10bbbea-90db-41fe-9b7b-2e9ecd2282ab","html_url":"https://github.com/bezenson/react-odometerjs","commit_stats":null,"previous_names":["bezenson/react-odometerjs","inferusvv/react-odometerjs"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezenson%2Freact-odometerjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezenson%2Freact-odometerjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezenson%2Freact-odometerjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezenson%2Freact-odometerjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bezenson","download_url":"https://codeload.github.com/bezenson/react-odometerjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085321,"owners_count":21045139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component","javascript","javascript-library","odometer","react","reactjs","wrapper","wrapper-library","yarn"],"created_at":"2024-10-04T16:04:22.256Z","updated_at":"2025-04-09T18:17:52.310Z","avatar_url":"https://github.com/bezenson.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest version](https://img.shields.io/npm/v/react-odometerjs)](https://www.npmjs.com/package/react-odometerjs)\n[![Downloads](https://img.shields.io/npm/dm/react-odometerjs)](https://www.npmjs.com/package/react-odometerjs)\n\n# React Odometer.js\n\nSimple React wrapper around [Odometer.js](https://github.com/HubSpot/odometer).\n\n![Preview](preview.gif)\n\n  - [How to use this library](#how-to-use-this-library)\n  - [Options](#options)\n  - [Next.js integration](#nextjs-integration)\n  - [Gatsby integration](#gatsby-integration)\n  - [Issues](#issues)\n\n## How to use this library\n\n1. Install npm package:\n\n```bash\nnpm install --save react-odometerjs\n```\n\nor\n\n```bash\nyarn add react-odometerjs\n```\n\n2. Import CSS file in your app `\u003chead\u003e`:\n\n```html\n\u003clink rel=\"stylesheet\" href=\"odometer-theme-default.css\" /\u003e\n```\n\n\u003e Official themes can be found [here](http://github.hubspot.com/odometer/api/themes/).\n\n3. Include component in your application:\n\n```javascript\nimport React, { useEffect, useState } from 'react';\nimport Odometer from 'react-odometerjs';\n\nconst App = () =\u003e {\n    const [value, setValue] = useState(1234);\n\n    useEffect(() =\u003e {\n        const timeoutId = setTimeout(() =\u003e setValue(4321), 2000);\n        return () =\u003e {\n            clearTimeout(timeoutId);\n        };\n    }, []);\n\n    return \u003cOdometer value={value} format=\"(.ddd),dd\" /\u003e;\n}\n```\n\n## Options\n\n| Option      | Type                   | Default       | Description                                                                                                                                 |\n| ----------- | ---------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |\n| `animation` | `'count' \\| undefined` |               | Count is a simpler animation method which just increments the value, use it when you're looking for something more subtle.                  |\n| `duration`  | `number`               | `2000`        | Change how long the javascript expects the CSS animation to take.                                                                           |\n| `format`    | `string`               | `'(,ddd).dd'` | Change how digit groups are formatted, and how many digits are shown after the decimal point.                                               |\n| `theme`     | `string`               |               | Specify the theme (if you have more than one theme css file on the page). Will add CSS class .odometer-theme-{prop value} to wrapper `div`. |\n| `value`     | `number`               |               | Current value. Change it to run animation.                                                                                                  |\n\nYou can read about options on [official website](http://github.hubspot.com/odometer/).\n\nAlso component can receive any `div` property.\n\nExample:\n\n```javascript\n// Pass `style` prop\nreturn \u003cOdometer value={1234} style={{ cursor: 'pointer' }} /\u003e;\n```\n\n## Next.js integration\n\nBecause Odometer.js requires `document` object, we should load library using\n[dynamic import](https://github.com/zeit/next.js/#dynamic-import), to avoid loading library on server-side.\n\nExample snippet:\n\n```javascript\nimport dynamic from 'next/dynamic'\n\nconst Odometer = dynamic(import('react-odometerjs'), {\n    ssr: false,\n    loading: () =\u003e 0\n});\n\nconst App = () =\u003e {\n    return \u003cOdometer value={1234} /\u003e;\n}\n```\n\n## Gatsby integration\n\n`Odometer.js`\n```js\nimport Odometer from 'react-odometerjs'\n\nexport default Odometer;\n```\n\n`App.js`\n```js\nimport loadable from '@loadable/component'\n\nconst Odometer = loadable(() =\u003e import('./Odometer'))\n\nconst App = () =\u003e {\n    return \u003cOdometer value={1234} /\u003e;\n}\n```\n\n## Issues\n\nFound an issue? You are welcome [here](https://github.com/bezenson/react-odometerjs/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezenson%2Freact-odometerjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbezenson%2Freact-odometerjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezenson%2Freact-odometerjs/lists"}