All Projects β†’ awran5 β†’ react-simple-star-rating

awran5 / react-simple-star-rating

Licence: MIT license
A simple react component for adding a star rating to your project.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to react-simple-star-rating

ui-glassmorphism
πŸ“˜ React component library on 'glassmorphism' UI/UX trend.
Stars: ✭ 20 (-72.97%)
Mutual labels:  react-library
react-emotion-multi-step-form
React multi-step form library with Emotion styling
Stars: ✭ 25 (-66.22%)
Mutual labels:  react-library
react-native-tus-client
React Native client for the tus resumable upload protocol.
Stars: ✭ 38 (-48.65%)
Mutual labels:  react-library
animated-number-react
Super easy way to animate numbers with React
Stars: ✭ 91 (+22.97%)
Mutual labels:  react-library
stan
πŸ”¨ Collection of front-end engineering tools
Stars: ✭ 19 (-74.32%)
Mutual labels:  react-library
Reactcss
πŸ’„ Inline Styles in JS
Stars: ✭ 1,603 (+2066.22%)
Mutual labels:  react-library
react-timepicker
React timepicker in Android KitKat style
Stars: ✭ 23 (-68.92%)
Mutual labels:  react-library
react-ratings-declarative
A customizable rating component for selecting x widgets or visualizing x widgets
Stars: ✭ 41 (-44.59%)
Mutual labels:  star-rating
awesome-libraries-resources
Awesome js and css libraries for web development.
Stars: ✭ 32 (-56.76%)
Mutual labels:  react-library
reoil
🧑Reoil is a low-level react original component library which can be used as wapper to replace <div> <img> etc, also can be wrapper for any other components."
Stars: ✭ 26 (-64.86%)
Mutual labels:  react-library
react-loading-icons
A TypeScript-React edition of Sam Herbert's amazing SVG Loaders.
Stars: ✭ 32 (-56.76%)
Mutual labels:  react-library
react-sketch-canvas
Freehand vector drawing component for React using SVG as canvas πŸ–ŒοΈ
Stars: ✭ 109 (+47.3%)
Mutual labels:  react-library
Semantic Ui React
The official Semantic-UI-React integration
Stars: ✭ 12,561 (+16874.32%)
Mutual labels:  react-library
lmth
πŸ‘‹ WIP: Say good-bye to HTML, a document markup which is not for applications.
Stars: ✭ 37 (-50%)
Mutual labels:  react-library
react-semantic-render
Semantic helper components for rendering content with React.
Stars: ✭ 13 (-82.43%)
Mutual labels:  react-library
useCustomHooks
πŸ“¦ npm package containing a set of custom hooks for your next React project.
Stars: ✭ 12 (-83.78%)
Mutual labels:  react-library
React Flow
Highly customizable library for building interactive node-based UIs, editors, flow charts and diagrams
Stars: ✭ 8,348 (+11181.08%)
Mutual labels:  react-library
vue-star-rating
⭐ A simple star rating component for vue apps
Stars: ✭ 30 (-59.46%)
Mutual labels:  star-rating
React-TypeScript-Boilerplate-Example
React + TypeScript + Redux Boilerplate Example
Stars: ✭ 18 (-75.68%)
Mutual labels:  react-typescript
rater-js
Star rating widget for the browser. Unlimited number of stars. No dependencies. No Jquery required.
Stars: ✭ 66 (-10.81%)
Mutual labels:  star-rating

React Simple Rating

A simple react component for adding a star rating to your project.

NPM JavaScript Style Guidenpm bundle sizeGitHub

screenshot

Install

npm

npm i react-simple-star-rating

Yarn

yarn add react-simple-star-rating

Usage

import React, { useState } from 'react'
import { Rating } from 'react-simple-star-rating'

export default function MyComponent() {
  const [rating, setRating] = useState(0)

  // Catch Rating value
  const handleRating = (rate: number) => {
    setRating(rate)

    // other logic
  }
  // Optinal callback functions
  const onPointerEnter = () => console.log('Enter')
  const onPointerLeave = () => console.log('Leave')
  const onPointerMove = (value: number, index: number) => console.log(value, index)

  return (
    <div className='App'>
      <Rating
        onClick={handleRating}
        onPointerEnter={onPointerEnter}
        onPointerLeave={onPointerLeave}
        onPointerMove={onPointerMove}
        /* Available Props */
      />
    </div>
  )
}

Available Props

Prop Type Options Description Default
onClick function Optional callback with hover, index and event values passed -
onPointerMove function Optional callback with hover, index and event values passed -
onPointerEnter function Optional callback with event passed -
onPointerLeave function Optional callback with event passed -
initialValue number Optional Set initial value 0
iconsCount number Optional Number of the icons 5
readonly boolean Optional Readonly mode false
rtl boolean Optional RTL mode false
transition boolean Optional Adds a smooth transition effect on mouse hover false
allowFraction boolean Optional Enable a fractional icon (half icon) false
className string Optional Applied to the main span react-simple-star-rating
style CSSProperties Optional Inline style applied to the main span basic style
size number Optional SVG Icon width / height in px 25
SVGstrokeColor string Optional SVG Icon stroke color currentColor
SVGstorkeWidth string | number Optional SVG Icon storke width 0
SVGclassName string Optional SVG Icon css class star-svg
SVGstyle CSSProperties Optional SVG inline style -
fillIcon ReactNode Optional Custom fill icon SVG null
fillColor string Optional Fill icons color #f1a545
fillColorArray array Optional Array of string to add color range []
fillStyle CSSProperties Optional Inline style applied to filled icon span basic style
fillClassName string Optional Applied to the filled icon span filled-icons
emptyIcon ReactNode Optional Custom empty icon SVG null
emptyColor string Optional Empty icons color #cccccc
emptyStyle CSSProperties Optional Inline style applied to empty icon span basic style
emptyClassName string Optional Applied to the empty icon span empty-icons
customIcons array of object Optional Add a group of icons []
allowHover boolean Optional Enable / Disable hover effect true
disableFillHover boolean Optional Enable / Disable hover effect on filled stars false
showTooltip string Optional Show a tooltip with live values false
tooltipDefaultText string Optional Initial tooltip text if no rating value Your Rate
tooltipArray array Optional Array of strings to show inside tooltip []
tooltipClassName string Optional Tooltip CSS class rating-tooltip
tooltipStyle CSSProperties Optional Inline style applied to the tooltip span basic style
titleSeparator string Optional Separator word in a title of a rating star (1 out of 5) out of


BREAKING CHANGES: version 4.1.0 (2022-10-03)

old new changes
allowHalfIcon allowFraction Renamed
fullIcon fillIcon Renamed
fullStyle fillStyle Renamed
fullClassName fillClassName Renamed
ratingValue - Removed

Demos

See all demos and usage examples in action.


Edit react-simple-rating-ts

License

MIT Β© awran5

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].