{"id":14384680,"url":"https://github.com/voronianski/react-star-rating-component","last_synced_at":"2025-05-16T07:06:33.192Z","repository":{"id":47463826,"uuid":"46379500","full_name":"voronianski/react-star-rating-component","owner":"voronianski","description":"Basic React component for star (or any other icon based) rating elements","archived":false,"fork":false,"pushed_at":"2023-02-11T00:46:32.000Z","size":888,"stargazers_count":380,"open_issues_count":25,"forks_count":76,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-10T16:18:47.679Z","etag":null,"topics":["component","react","star-ratings"],"latest_commit_sha":null,"homepage":"http://voronianski.github.io/react-star-rating-component/example","language":"JavaScript","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/voronianski.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":null}},"created_at":"2015-11-17T22:28:47.000Z","updated_at":"2025-04-20T03:38:56.000Z","dependencies_parsed_at":"2023-02-17T12:30:46.817Z","dependency_job_id":null,"html_url":"https://github.com/voronianski/react-star-rating-component","commit_stats":{"total_commits":43,"total_committers":12,"mean_commits":"3.5833333333333335","dds":"0.34883720930232553","last_synced_commit":"19882270b49247788c9748c6d5b216e3bfcc1cc6"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voronianski%2Freact-star-rating-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voronianski%2Freact-star-rating-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voronianski%2Freact-star-rating-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voronianski%2Freact-star-rating-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voronianski","download_url":"https://codeload.github.com/voronianski/react-star-rating-component/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485063,"owners_count":22078767,"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","react","star-ratings"],"created_at":"2024-08-28T18:01:34.609Z","updated_at":"2025-05-16T07:06:28.178Z","avatar_url":"https://github.com/voronianski.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# react-star-rating-component\n\n[![npm version](http://badge.fury.io/js/react-star-rating-component.svg)](http://badge.fury.io/js/react-star-rating-component)\n[![Dependency Status](http://david-dm.org/voronianski/react-star-rating-component.svg)](http://david-dm.org/voronianski/react-star-rating-component)\n[![Download Count](http://img.shields.io/npm/dm/react-star-rating-component.svg?style=flat)](http://www.npmjs.com/package/react-star-rating-component)\n\n\u003e Tiny [React.js](https://facebook.github.io/react) component for star (or any other *icon based*) ratings.\n\n## Install\n\n```bash\nnpm install react-star-rating-component --save\n```\n\n## Demo\n\n[\u003cimg src=\"https://image.ibb.co/d9VFZb/Basic_React_Component_For_Star_Ratings.gif\" width=\"600\" /\u003e](http://voronianski.github.io/react-star-rating-component/example)\n\n## Props\n\n```javascript\n\u003cStarRatingComponent\n    name={String} /* name of the radio input, it is required */\n    value={Number} /* number of selected icon (`0` - none, `1` - first) */\n    starCount={Number} /* number of icons in rating, default `5` */\n    onStarClick={Function(nextValue, prevValue, name)} /* on icon click handler */\n    onStarHover={Function(nextValue, prevValue, name)} /* on icon hover handler */\n    onStarHoverOut={Function(nextValue, prevValue, name)} /* on icon hover out handler */\n    renderStarIcon={Function(nextValue, prevValue, name)} /* it should return string or react component */\n    renderStarIconHalf={Function(nextValue, prevValue, name)} /* it should return string or react component */\n    starColor={String} /* color of selected icons, default `#ffb400` */\n    emptyStarColor={String} /* color of non-selected icons, default `#333` */\n    editing={Boolean} /* is component available for editing, default `true` */\n/\u003e\n```\n\n## Examples\n\n### Editable \n\n```javascript\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport StarRatingComponent from 'react-star-rating-component';\n\nclass App extends React.Component {\n  constructor() {\n    super();\n\n    this.state = {\n      rating: 1\n    };\n  }\n\n  onStarClick(nextValue, prevValue, name) {\n    this.setState({rating: nextValue});\n  }\n\n  render() {\n    const { rating } = this.state;\n    \n    return (                \n      \u003cdiv\u003e\n        \u003ch2\u003eRating from state: {rating}\u003c/h2\u003e\n        \u003cStarRatingComponent \n          name=\"rate1\" \n          starCount={10}\n          value={rating}\n          onStarClick={this.onStarClick.bind(this)}\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nReactDOM.render(\n  \u003cApp /\u003e, \n  document.getElementById('app')\n);\n```\n\n### Non-editable (with custom icons)\n\n```javascript\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport StarRatingComponent from 'react-star-rating-component';\n\nclass App extends React.Component {\n  render() {\n    const { rating } = this.state;\n\n    return (                \n      \u003cdiv\u003e\n        \u003ch2\u003eRating from state: {rating}\u003c/h2\u003e\n        \u003cStarRatingComponent \n          name=\"rate2\" \n          editing={false}\n          renderStarIcon={() =\u003e \u003cspan\u003e\u003c/span\u003e}\n          starCount={10}\n          value={8}\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nReactDOM.render(\n  \u003cApp /\u003e, \n  document.getElementById('app')\n);\n```\n\nCheck more in [examples folder](https://github.com/voronianski/react-star-rating-component/tree/master/example).\n\n---\n\n**MIT Licensed**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronianski%2Freact-star-rating-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoronianski%2Freact-star-rating-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronianski%2Freact-star-rating-component/lists"}