Plum-blossom ratingRating
A five-point rating that uses a five-petal plum blossom in place of stars.
Demo
四分
这本书你打几分
4 of 5
How would you rate this book
<div class="hao-stack" style="gap:var(--hao-space-6);max-width:none">
<div class="hao-row" style="gap:var(--hao-space-6)">
<span class="hao-row" style="gap:var(--hao-space-2)" role="img" aria-label="四分,满分五分">
<svg class="hao-plum hao-plum--lg" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<span style="font:600 24px/32px var(--hao-font-serif)">四分</span>
</span>
<span class="hao-row" style="gap:var(--hao-space-4)">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5"/><circle cx="15.53" cy="16.85" r="3.5"/><circle cx="8.47" cy="16.85" r="3.5"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5"/><circle cx="8.47" cy="16.85" r="3.5"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</span>
</div>
<div class="hao-row" style="gap:var(--hao-space-4)">
<span style="font-size:15px;color:var(--hao-ink-secondary)">这本书你打几分</span>
<span class="hao-rate" role="radiogroup" aria-label="评分">
<button role="radio" aria-checked="false" aria-label="1 分">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
<button role="radio" aria-checked="false" aria-label="2 分">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
<button role="radio" aria-checked="false" aria-label="3 分">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
<button role="radio" aria-checked="true" aria-label="4 分">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
<button role="radio" aria-checked="false" aria-label="5 分">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5"/><circle cx="17.71" cy="10.15" r="3.5"/><circle cx="15.53" cy="16.85" r="3.5"/><circle cx="8.47" cy="16.85" r="3.5"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
</span>
</div>
</div><div class="hao-stack" style="gap:var(--hao-space-6);max-width:none">
<div class="hao-row" style="gap:var(--hao-space-6)">
<span class="hao-row" style="gap:var(--hao-space-2)" role="img" aria-label="4 out of 5">
<svg class="hao-plum hao-plum--lg" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<span style="font:600 24px/32px var(--hao-font-serif)">4 of 5</span>
</span>
<span class="hao-row" style="gap:var(--hao-space-4)">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5"/><circle cx="15.53" cy="16.85" r="3.5"/><circle cx="8.47" cy="16.85" r="3.5"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5"/><circle cx="8.47" cy="16.85" r="3.5"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</span>
</div>
<div class="hao-row" style="gap:var(--hao-space-4)">
<span style="font-size:15px;color:var(--hao-ink-secondary)">How would you rate this book</span>
<span class="hao-rate" role="radiogroup" aria-label="Rating">
<button role="radio" aria-checked="false" aria-label="1 of 5">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
<button role="radio" aria-checked="false" aria-label="2 of 5">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
<button role="radio" aria-checked="false" aria-label="3 of 5">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
<button role="radio" aria-checked="true" aria-label="4 of 5">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5" class="on"/><circle cx="17.71" cy="10.15" r="3.5" class="on"/><circle cx="15.53" cy="16.85" r="3.5" class="on"/><circle cx="8.47" cy="16.85" r="3.5" class="on"/><circle cx="6.29" cy="10.15" r="3.5" class="on"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
<button role="radio" aria-checked="false" aria-label="5 of 5">
<svg class="hao-plum " viewBox="0 0 24 24" aria-hidden="true"><circle cx="12.00" cy="6.00" r="3.5"/><circle cx="17.71" cy="10.15" r="3.5"/><circle cx="15.53" cy="16.85" r="3.5"/><circle cx="8.47" cy="16.85" r="3.5"/><circle cx="6.29" cy="10.15" r="3.5"/><circle class="hao-plum__c" cx="12" cy="12" r="1.9"/></svg>
</button>
</span>
</div>
</div>Usage
The motif comes from the dispelling-winter chart (九九消寒图): from the winter solstice on, you paint a branch of plain plum blossoms, one petal a day; when every petal is filled, spring has arrived. Here one blossom has five petals—fill in as many petals as the score.
- For display: one
<svg class="hao-plum">with five petal<circle>s; filled ones getclass="on", and the last one,class="hao-plum__c", is the pistil. One blossom says the whole score, in less space than five stars.hao-plum--lgis 40px. - For rating:
.hao-rate(role="radiogroup") holds five buttons (role="radio"), a whole blossom in each; the chosen one and the ones before it gethao-plum--on. - The petals fill clockwise, starting from straight up.
- Petals use
tint; the pistil usesgold. Don’t fill them red: cinnabar belongs to seals alone. - There is always text alongside (“4 of 5”), or an
aria-label(“4 out of 5”). - Use it only for five-point scales. Percentages and progress use the waxing moon.
- The five petals touch one another without overlapping, their centers on a circle of radius 6 (on a canvas of 24), petal radius 3.5. Draw to these proportions and it stays clean at any size.
Behavior (when the behavior script is loaded)
- The row of blossoms used for rating is tappable: tap any blossom and it, with every one before it, fills in. The left and right arrow keys move the score by one; the whole group is a single Tab stop; a change fires a
hao-changeevent.