Coder Social home page Coder Social logo

Comments (3)

therayess avatar therayess commented on June 30, 2024 2

Awesome! Got it to work as described ^^ thanks Drey!

from react-rating.

dreyescat avatar dreyescat commented on June 30, 2024 1

I have created a jsfiddle with a simple example using the placeholder property.

from react-rating.

dreyescat avatar dreyescat commented on June 30, 2024

The placeholder property is a little bit tricky. It does not hold a real value. The idea of this property is to simulate the HTML input placeholder attribute. It is only shown when the rating has no value.

In your case, you are initializing the rating with a value (initialRate={ratingAvg}) so your placeholder is simply ignored because it has an actual value.

If you remove the initialRate property then the placeholder will take place.

<Rating
  empty="glyphicon glyphicon-star-empty star-grey fs-xl"
  placeholder="glyphicon glyphicon-star-empty star-red fs-xl" placeholderRate={ratingAvg} 
  full="glyphicon glyphicon-star star-yellow fs-xl"
/>

it should display yellow stars by default and on hover it should display red ones, right?

When you hover over the rating the full property is applied. While no rate is selected, the placeholder is shown when you hover out the rating. Of course, until you select a rate. Then placeholder is ignored in favour of the full property.

Hope it helps. Let me know otherwise 😃.

from react-rating.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.