{"id":16515642,"url":"https://github.com/insin/react-router-active-component","last_synced_at":"2025-09-21T00:31:37.338Z","repository":{"id":25479599,"uuid":"28910389","full_name":"insin/react-router-active-component","owner":"insin","description":"Factory function for React components which are active for a particular React Router route","archived":false,"fork":false,"pushed_at":"2018-07-20T21:05:50.000Z","size":41,"stargazers_count":113,"open_issues_count":5,"forks_count":23,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-19T16:09:26.244Z","etag":null,"topics":["react","react-component","react-router"],"latest_commit_sha":null,"homepage":"http://insin.github.io/react-router-active-component","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/insin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-07T10:45:05.000Z","updated_at":"2022-03-17T08:33:53.000Z","dependencies_parsed_at":"2022-09-12T06:30:40.922Z","dependency_job_id":null,"html_url":"https://github.com/insin/react-router-active-component","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/insin/react-router-active-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Freact-router-active-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Freact-router-active-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Freact-router-active-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Freact-router-active-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insin","download_url":"https://codeload.github.com/insin/react-router-active-component/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insin%2Freact-router-active-component/sbom","scorecard":{"id":489731,"data":{"date":"2025-08-11","repo":{"name":"github.com/insin/react-router-active-component","commit":"893823e098e289e062126691ce742a6bb1f08c86"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":1,"reason":"Found 3/27 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T18:45:48.868Z","repository_id":25479599,"created_at":"2025-08-19T18:45:48.868Z","updated_at":"2025-08-19T18:45:48.868Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276179298,"owners_count":25598565,"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","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["react","react-component","react-router"],"created_at":"2024-10-11T16:17:50.011Z","updated_at":"2025-09-21T00:31:37.042Z","avatar_url":"https://github.com/insin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## React Router Active Component\n\n[![Travis][build-badge]][build]\n[![Codecov][coverage-badge]][coverage]\n[![npm package][npm-badge]][npm]\n\nA factory function for creating [React](http://facebook.github.io/react) components which get a special `className` when a specified [React Router](https://github.com/rackt/react-router) route is active, and can also handle creating a link to the route.\n\nThe primary use case for this module is making it convenient to create components which contain a link to a route but put the active class name on the container rather than the link:\n\n**Using React Router's `Link` component:**\n\n```html\n\u003cul\u003e                                      \u003cul\u003e\n  \u003cli\u003e                                      \u003cli\u003e\n    \u003cLink to=\"/route\"                 =\u003e      \u003ca href=\"/route\" class=\"active\"\u003e\n          activeClassName=\"active\"\u003e             Link Text\n      Link Text\n```\n\n**Using the `activeComponent()` factory function:**\n\n```js\nvar NavLink = activeComponent('li')\n```\n```html\n\u003cul\u003e                           \u003cul\u003e\n  \u003cNavLink to=\"/route\"\u003e   =\u003e     \u003cli class=\"active\"\u003e\n    Link Text                      \u003ca href=\"/route\"\u003e\n                                     Link Text\n```\n\n### [Live Demo](http://insin.github.io/react-router-active-component) ([source](/demo/src/index.js))\n\nThe demo shows:\n\n* A `NavLink` component which creates a navigation `\u003cli\u003e` (including its `\u003ca\u003e`)\n  which gets an `\"active\"` class, as required by Bootstrap's CSS.\n\n  ```js\n  var NavLink = activeComponent('li')\n  ```\n\n* An `ActivePara` component which creates a `\u003cp\u003e` which only gets a `\"special\"`\n  class for a specific route.\n\n  ```js\n  var ActivePara = activeComponent('p', {link: false})\n  ```\n  ```html\n  \u003cActivePara to=\"/path/to\" activeClassName=\"special\"\u003e...\u003c/ActivePara\u003e\n  ```\n\n### Install\n\n```\nnpm install react-router-active-component\n```\n```\nimport activeComponent from 'react-router-active-component'\n// or\nvar activeComponent = require('react-router-active-component')\n```\n\n### API\n\n#### `activeComponent(component[, options])`\n\nCreates a `ReactComponent` which takes the same props as React Router's [Link](https://github.com/reactjs/react-router/blob/master/docs/API.md#link) component to configure when it is considered active and which class it will be given when active.\n\nThe component's contents will be wrapped in the given tag name or component - by default, its children will be used as contents for a `\u003cLink/\u003e`.\n\n##### `component`: `String` | `ReactComponent`\n\nThis can be anything that can be passed as the first argument to [`React.createElement()`](http://facebook.github.io/react/docs/top-level-api.html#react.createelement) - a tag name string or a `ReactComponent` which will be used to wrap the component's children.\n\n```js\nvar NavItem = activeComponent('li')\n```\n\nIf a custom React component is given, the following additional props will be passed to it when rendering:\n\n* `active`: `Boolean` - `true` if the specified route is active, `false` otherwise.\n* `className`: `String` - contains any `className` passed to the component plus its `activeClassName`, if active.\n* `style`: `Object` - the `activeStyle` object passed to the component, if active.\n\n##### `options`: `Object`\n\nAn options object with the following properties:\n\n###### `link`: `Boolean` (default: `true`)\n\nIf `true`, the component's `props` and `children` be used to create a `\u003cLink/\u003e`. Otherwise, its `children` will just be wrapped in the specified `component`.\n\n```js\nvar ActiveParagraph = activeComponent('p', {link: false})\n```\n\n###### `linkClassName` : `String`\n\nA default `className` for the nested `\u003cLink/\u003e`.\n\n#### Component Props\n\nThe component created by `activeComponent()` takes the same props as React Router's `Link` component. See the React Router [Link API](https://github.com/reactjs/react-router/blob/master/docs/API.md#link) docs for details.\n\nOne difference is that `activeClassName` will default to `active` if not provided, since determining if a component is active is the whole point of using `activeComponent()`!\n\nUse the `onlyActiveOnIndex` boolean prop to control when a component is considered active when its URL path matches part of a deeper path - for example, if you have a \"Home\" navigation link which you only want to display as active when the current path is `'/'`, you should use this prop:\n\n```js\n\u003cNavLink to=\"/\" onlyActiveOnIndex\u003eHome\u003c/NavLink\u003e\n\u003cNavLink to=\"/tasks\"\u003eTasks\u003c/NavLink\u003e\n```\n\nPass a `linkProps` object to provide additional props when rendering a nested `\u003cLink/\u003e`:\n\n```js\n\u003cNavLink to=\"/special\" linkProps={{className: 'special', onClick: this.handleSpecial}}\u003e\n  Special Link\n\u003c/NavLink\u003e\n```\n\n### MIT Licensed\n\n[build-badge]: https://img.shields.io/travis/insin/react-router-active-component/master.svg\n[build]: https://travis-ci.org/insin/react-router-active-component\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/insin/react-router-active-component.svg\n[coverage]: https://codecov.io/github/insin/react-router-active-component\n\n[npm-badge]: https://img.shields.io/npm/v/react-router-active-component.svg\n[npm]: https://www.npmjs.org/package/react-router-active-component\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsin%2Freact-router-active-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsin%2Freact-router-active-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsin%2Freact-router-active-component/lists"}