<div data-slot='rating' aria-label='Example rating: 4.5 out of 5' role='img'>
{% for number in (1..5) %}
<span class='rating__star' aria-hidden='true'>
<svg viewBox='0 0 24 24' fill='currentColor'>
<path d="m12 2 3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1Z"/>
</svg>
<span
class='rating__fill'
{% if number == 5 %}
style='width: 50%'
{% endif %}
>
<svg viewBox='0 0 24 24' fill='currentColor'>
<path d="m12 2 3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1Z"/>
</svg>
</span>
</span>
{% endfor %}
<span>Example rating</span>
</div>Installation
npx shadcn@latest add https://ui.full.dev/r/liquid/rating.json
Follow the one-time layout setup. A full components install already includes this item.
Usage
After this install, render these once in the layout head before theme overrides and other modules. The full ui hook already includes them. The command also installs the parts used in this example.
{% render 'ui-init' %}
{% render 'ui-rating' %}
The preview and its Usage tab render the same native Liquid source. Use data-slot for parts, data-variant for variants and data-size for sizes. Keep your store’s labels, translations and Shopify data in your theme.
Each star is a rating__star with a rating__fill over it. A fill shows the whole star; give it a width, such as style='width: 50%', for part of one.
Parts
rating.