百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

react-star-rating-component

> 前端框架
开源

用于星级 (或任何其他基于图标的) 评分元素的基本 React 组件

378 stars0 点赞4 次浏览
访问官网GitHub

工具介绍

用于星级 (或任何其他基于图标的) 评分元素的基本 React 组件

react-star-rating-component

Tiny React.js component for star (or any other icon based) ratings.

Install

bash
npm install react-star-rating-component --save

Demo

Props

javascript

Examples

Editable

javascript
import React from 'react';
import ReactDOM from 'react-dom';
import StarRatingComponent from 'react-star-rating-component';

class App extends React.Component {
  constructor() {
    super();

    this.state = {
      rating: 1
    };
  }

  onStarClick(nextValue, prevValue, name) {
    this.setState({rating: nextValue});
  }

  render() {
    const { rating } = this.state;
    
    return (                
      

    );
  }
}

ReactDOM.render(
  , 
  document.getElementById('app')
);

Non-editable (with custom icons)

javascript
import React from 'react';
import ReactDOM from 'react-dom';
import StarRatingComponent from 'react-star-rating-component';

class App extends React.Component {
  render() {
    const { rating } = this.state;

    return (                
      

    );
  }
}

ReactDOM.render(
  , 
  document.getElementById('app')
);

Check more in examples folder.


MIT Licensed

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptcomponentreactstar-ratings

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架