{"id":18277966,"url":"https://github.com/tanem/react-nprogress","last_synced_at":"2025-05-14T08:09:30.887Z","repository":{"id":37292924,"uuid":"150989267","full_name":"tanem/react-nprogress","owner":"tanem","description":":hourglass: A React primitive for building slim progress bars.","archived":false,"fork":false,"pushed_at":"2025-05-05T21:58:00.000Z","size":25684,"stargazers_count":451,"open_issues_count":6,"forks_count":20,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T22:40:43.047Z","etag":null,"topics":["animation","component","higher-order-component","hoc","hook","hooks","javascript","loading","nprogress","progress","progress-bar","progressbar","react","render-props","spinner","typescript"],"latest_commit_sha":null,"homepage":"https://npm.im/@tanem/react-nprogress","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/tanem.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-09-30T17:28:01.000Z","updated_at":"2025-05-05T21:56:36.000Z","dependencies_parsed_at":"2024-01-18T09:29:33.840Z","dependency_job_id":"cd5bf403-da90-43a4-b9ed-e4b36756bec7","html_url":"https://github.com/tanem/react-nprogress","commit_stats":null,"previous_names":[],"tags_count":210,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanem%2Freact-nprogress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanem%2Freact-nprogress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanem%2Freact-nprogress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanem%2Freact-nprogress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanem","download_url":"https://codeload.github.com/tanem/react-nprogress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101558,"owners_count":22014908,"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":["animation","component","higher-order-component","hoc","hook","hooks","javascript","loading","nprogress","progress","progress-bar","progressbar","react","render-props","spinner","typescript"],"created_at":"2024-11-05T12:22:19.395Z","updated_at":"2025-05-14T08:09:25.873Z","avatar_url":"https://github.com/tanem.png","language":"TypeScript","readme":"# react-nprogress\n\n[![npm version](https://img.shields.io/npm/v/@tanem/react-nprogress.svg?style=flat-square)](https://www.npmjs.com/package/@tanem/react-nprogress)\n[![build status](https://img.shields.io/github/actions/workflow/status/tanem/react-nprogress/ci.yml?style=flat-square)](https://github.com/tanem/react-nprogress/actions?query=workflow%3ACI)\n[![coverage status](https://img.shields.io/codecov/c/github/tanem/react-nprogress.svg?style=flat-square)](https://codecov.io/gh/tanem/react-nprogress)\n[![npm downloads](https://img.shields.io/npm/dm/@tanem/react-nprogress.svg?style=flat-square)](https://www.npmjs.com/package/@tanem/react-nprogress)\n[![minzipped size](https://img.shields.io/bundlephobia/minzip/@tanem/react-nprogress?style=flat-square)](https://bundlephobia.com/result?p=@tanem/react-nprogress)\n\n\u003e A React primitive for building slim progress bars.\n\n[Background](#background) | [Usage](#usage) | [Live Examples](#live-examples) | [API](#api) | [Installation](#installation) | [License](#license)\n\n## Background\n\nThis is a React port of [rstacruz](https://github.com/rstacruz)'s [`nprogress`](https://github.com/rstacruz/nprogress) module. It exposes an API that encapsulates the logic of `nprogress` and renders nothing, giving you complete control over rendering.\n\n## Usage\n\nIn the following examples, `Container`, `Bar` and `Spinner` are custom components.\n\n**Hook**\n\n```jsx\nimport { useNProgress } from '@tanem/react-nprogress'\nimport React from 'react'\nimport { render } from 'react-dom'\n\nimport Bar from './Bar'\nimport Container from './Container'\nimport Spinner from './Spinner'\n\nconst Progress = ({ isAnimating }) =\u003e {\n  const { animationDuration, isFinished, progress } = useNProgress({\n    isAnimating,\n  })\n\n  return (\n    \u003cContainer animationDuration={animationDuration} isFinished={isFinished}\u003e\n      \u003cBar animationDuration={animationDuration} progress={progress} /\u003e\n      \u003cSpinner /\u003e\n    \u003c/Container\u003e\n  )\n}\n\nrender(\u003cProgress isAnimating /\u003e, document.getElementById('root'))\n```\n\n**Render Props**\n\n```jsx\nimport { NProgress } from '@tanem/react-nprogress'\nimport React from 'react'\nimport { render } from 'react-dom'\n\nimport Bar from './Bar'\nimport Container from './Container'\nimport Spinner from './Spinner'\n\nrender(\n  \u003cNProgress isAnimating\u003e\n    {({ animationDuration, isFinished, progress }) =\u003e (\n      \u003cContainer animationDuration={animationDuration} isFinished={isFinished}\u003e\n        \u003cBar animationDuration={animationDuration} progress={progress} /\u003e\n        \u003cSpinner /\u003e\n      \u003c/Container\u003e\n    )}\n  \u003c/NProgress\u003e,\n  document.getElementById('root')\n)\n```\n\n**HOC**\n\n```jsx\nimport { withNProgress } from '@tanem/react-nprogress'\nimport React from 'react'\nimport { render } from 'react-dom'\n\nimport Bar from './Bar'\nimport Container from './Container'\nimport Spinner from './Spinner'\n\nconst Inner = ({ animationDuration, isFinished, progress }) =\u003e (\n  \u003cContainer animationDuration={animationDuration} isFinished={isFinished}\u003e\n    \u003cBar animationDuration={animationDuration} progress={progress} /\u003e\n    \u003cSpinner /\u003e\n  \u003c/Container\u003e\n)\n\nconst Enhanced = withNProgress(Inner)\n\nrender(\u003cEnhanced isAnimating /\u003e, document.getElementById('root'))\n```\n\n## Live Examples\n\n- HOC: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/hoc) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/hoc)\n- Material UI: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/material-ui) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/material-ui)\n- Multiple Instances: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/multiple-instances) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/multiple-instances)\n- Next Pages Router: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/next-pages-router) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/next-pages-router)\n- Original Design: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/original-design) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/original-design)\n- Plain JS: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/plain-js) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/plain-js)\n- Reach Router: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/reach-router) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/reach-router)\n- React Router V5: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/react-router-v5) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/react-router-v5)\n- React Router V6: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/react-router-v6) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/react-router-v6)\n- Render Props: [Source](https://github.com/tanem/react-nprogress/tree/master/examples/render-props) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/render-props)\n- UMD Build (Development): [Source](https://github.com/tanem/react-nprogress/tree/master/examples/umd-dev) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/umd-dev)\n- UMD Build (Production): [Source](https://github.com/tanem/react-nprogress/tree/master/examples/umd-prod) | [Sandbox](https://codesandbox.io/s/github/tanem/react-nprogress/tree/master/examples/umd-prod)\n\n## API\n\n**Props**\n\n- `animationDuration` - _Optional_ Number indicating the animation duration in `ms`. Defaults to `200`.\n- `incrementDuration` - _Optional_ Number indicating the length of time between progress bar increments in `ms`. Defaults to `800`.\n- `isAnimating` - _Optional_ Boolean indicating if the progress bar is animating. Defaults to `false`.\n- `minimum` - _Optional_ Number between `0` and `1` indicating the minimum value of the progress bar. Defaults to `0.08`.\n\n**Hook Example**\n\n```jsx\nconst Progress = ({\n  animationDuration,\n  incrementDuration,\n  isAnimating,\n  minimum\n}) =\u003e {\n  const { isFinished, progress } = useNProgress({\n    animationDuration,\n    incrementDuration,\n    isAnimating,\n    minimum\n  })\n\n  return (\n    \u003cContainer animationDuration={animationDuration} isFinished={isFinished}\u003e\n      \u003cBar animationDuration={animationDuration} progress={progress} /\u003e\n      \u003cSpinner /\u003e\n    \u003c/Container\u003e\n  )\n}\n\n\u003cProgress\n  animationDuration={300}\n  incrementDuration={500}\n  isAnimating\n  minimum={0.1}\n/\u003e\n```\n\n**Render Props Example**\n\n```jsx\n\u003cNProgress\n  animationDuration={300}\n  incrementDuration={500}\n  isAnimating\n  minimum={0.1}\n\u003e\n  {({ animationDuration, isFinished, progress }) =\u003e (\n    \u003cContainer animationDuration={animationDuration} isFinished={isFinished}\u003e\n      \u003cBar animationDuration={animationDuration} progress={progress} /\u003e\n      \u003cSpinner /\u003e\n    \u003c/Container\u003e\n  )}\n\u003c/NProgress\u003e\n```\n\n**HOC Example**\n\n```jsx\nconst Inner = ({ animationDuration, isFinished, progress }) =\u003e (\n  \u003cContainer animationDuration={animationDuration} isFinished={isFinished}\u003e\n    \u003cBar animationDuration={animationDuration} progress={progress} /\u003e\n    \u003cSpinner /\u003e\n  \u003c/Container\u003e\n)\n\nconst Enhanced = withNProgress(Inner)\n\n\u003cEnhanced\n  animationDuration={300}\n  incrementDuration={500}\n  isAnimating\n  minimum={0.1}\n/\u003e\n```\n\n## Installation\n\n```\n$ npm install @tanem/react-nprogress\n```\n\nUMD builds are also available for use with pre-React 19 via [unpkg](https://unpkg.com/):\n\n- https://unpkg.com/@tanem/react-nprogress/dist/react-nprogress.umd.development.js\n- https://unpkg.com/@tanem/react-nprogress/dist/react-nprogress.umd.production.js\n\nFor the non-minified development version, make sure you have already included:\n\n- [`React`](https://unpkg.com/react@18/umd/react.development.js)\n- [`ReactDOM`](https://unpkg.com/react-dom@18/umd/react-dom.development.js)\n\nFor the minified production version, make sure you have already included:\n\n- [`React`](https://unpkg.com/react@18/umd/react.production.min.js)\n- [`ReactDOM`](https://unpkg.com/react-dom@18/umd/react-dom.production.min.js)\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanem%2Freact-nprogress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanem%2Freact-nprogress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanem%2Freact-nprogress/lists"}