Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
react-rating
Advanced tools
React Rating is a react rating component which supports custom symbols both with inline styles and glyphicons found in popular CSS Toolkits like Fontawesome or Bootstrap.
I intend to port the jQuery bootstrap-rating to a React component.
See react-rating in action.
You can install react-rating
component using the npm package manager:
npm install --save react-rating
The react-rating
component peer depends on the React library.
You can install React using npm too:
npm install --save react
Require the Rating Component
var Rating = require('react-rating');
Start using it
With raw javascript:
React.createElement(Rating)
Or with JSX:
<Rating />
Property | Type | Default | Description |
---|---|---|---|
start | number | 0 | Range starting value (exclusive). |
stop | number | 5 | Range stop value (inclusive). |
step | number | 1 | Step increment (positive) or decrement (negative). |
placeholderRate | number | undefined | Placeholder rate value. |
initialRate | number | undefined | Initial rate value. |
empty | element or object or string or array | Style.empty | React element, inline style object, or classes applied to the rating symbols when empty. Or an array of such symbols that will be applied in a circular manner (round-robin). |
placeholder | element or object or string or array | Style.full | React element, inline style object, or classes applied to the rating symbols in HTML input placeholder fashion. Or an array of such symbols that will be applied in a circular manner (round-robin). |
full | element or object or string or array | Style.full | React element, inline style object, or classes applied to the rating symbols when full. Or an array of such symbols that will be applied in a circular manner (round-robin). |
readonly | bool | false | Whether the rating can be modified or not. |
quiet | bool | false | Whether to animate rate hovering or not. |
fractions | number | 1 | Number of equal parts that make up a whole symbol. |
Callback | Type | Description |
---|---|---|
onChange | function (rate) {} | Called when the selected rate is changed. |
onClick | function (rate, event) {} | Called when a rate is clicked. |
onRate | function (rate) {} | Called when a rate is entered or left. When a rate is left it is called with undefined . |
FAQs
A rating react component with custom symbols
The npm package react-rating receives a total of 35,657 weekly downloads. As such, react-rating popularity was classified as popular.
We found that react-rating demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.