0.0.2 • Published 8 months ago

@licuido-ui/ui_rating v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Rating

The Rating component is a customizable rating widget that allows users to provide feedback or rate items using stars or emojis. It provides various options for customizing the icons, styles, and behavior of the rating component. The Rating component can be used in both star and emoji modes based on the variant prop.

Author

Link

Story Book Link Login

PlayGround

Try it have a fun codeBox

Installation

npm i @licuido-ui/ui_rating

Import component

import { Rating } from '@licuido-ui/ui_rating';

Usage

<Rating  variant= 'star'
    precision = {1}
    starRatingData= {[
      {
        filled: <FavoriteIcon />,
        unFilled: <FavoriteBorder />,
        starValue: 4.5,
        overallRating: '240 Reviews',
      },
      {
        filled: <FavoriteIcon />,
        unFilled: <FavoriteBorder />,
        starValue: 3.5,
        overallRating: '240 Reviews',
      },
    ]}
  overallRatingStyle= {}
  onClick={(rating) => handleRatingChange(rating.starValue)} />

Image

Variant1

Emoji rating

Variant2

Star rating

Sample Code

<Rating
 variant= 'star'
    precision = {1}
    starRatingData= {[
      {
        filled: <FavoriteIcon />,
        unFilled: <FavoriteBorder />,
        starValue: 4.5,
        overallRating: '240 Reviews',
      },
      {
        filled: <FavoriteIcon />,
        unFilled: <FavoriteBorder />,
        starValue: 3.5,
        overallRating: '240 Reviews',
      },
    ]}
  overallRatingStyle= {}
  onClick={(rating) => handleRatingChange(rating.starValue)}
/>

Props

NameDescriptionDefaultControl
ratingIdstringstringstring
variant"star" or "emoji""emoji"star / emoji
emojiDataAn array of objects with properties SelectIcon, unSelectIcon, label, and value[]Set object
selectedLabelStyleAn object with styles to apply to the selected label{}Set object
emojiContainerStyleAn object with styles to apply to the emoji container{}Set object
classNameA string representing the class name to apply to the component-Set string
sxAn object with styles to apply to the component root-Set object
starRatingDataAn array of objects with properties filled, unFilled, starValue, overallRating, and maximumIcon[]Set object
overallRatingAn object with styles to apply to the overallRating{}Set object
onMouseEnterA function called when the mouse enters a star() => {}-
onMouseLeaveA function called when the mouse leaves a star() => {}-
onClickA function called when a star is clicked() => {}-
isReadOnlyA boolean value indicating whether the component is read-onlyfalseSet boolean
isLabelVisibleA boolean value indicating whether the labels are visibletrueSet boolean
childrenStyleAn object with styles to apply to the children components{}Set object
precisionA number representing the precision of the rating1Set number