Skip to content

Rating

ERating is an efficient way to assign a rating to content to demonstrate its quality or performance in several domains. Demo Here

Import

jsx
import ERating from "@components/Elements/ERating";

Usage

jsx
const RatingExample = () => {
  const [rating, setRating] = useState(1);

  const handleChange = (event, value) => {
    setRating(value);
  };

  return <ERating color="warning" rate={rate} onChange={handleChange} />;
};

export default RatingExample;

Props

For ERating component, the following props are available:

PropTypeDefaultNote
valueNumber-The rating value.
lengthNumber5Changes the number of rating icons.
hoverBooleanfalseHovering over the ratings determines a rating value.
classNameString-Overrides or extends the component's wrapper styles.
sizeString"md"The ERating element has three predefined sizes: sm, md, lg.
readOnlyBooleanfalsedisables the ability to interact with the symbols. Displays data about the average rating level.
iconObject{name: Star1,size: 24,type: linear}Customizes the icon of ERating element. More Info about icons here.
colorString"primary"The given color is applied to the ERating - utility colors are supported (e.g primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.

Callback Functions

The ERating component contains following callback functions.

FunctionDescription
onChangeProp that you pass to control the rating value. function(event: React.SyntheticEvent, ratingValue: Number) => void 👇

event: The event source of the callback.
ratingValue: new value

COPYRIGHT