Rating

x-rating

An interactive star rating with hover preview and click-to-set (click the current value again to clear). Read-only mode for display. Works with wire:model or a plain form field.

php artisan components:add rating

Examples

Sizes & read-only

Interactive stars in two sizes, plus a read-only display mode.

<div class="flex flex-col items-center gap-4">
    <x-components.rating :value="4" />
    <x-components.rating :value="3" size="lg" />
    <x-components.rating :value="5" size="sm" readonly />
</div>

Props

Prop Type Default Description
value text 0 Initial number of selected stars.
max text 5 Total number of stars.
readonly boolean false Display the rating without allowing changes.
name text Name for a hidden input, for plain form submission.
size select sm · md · lg md Star size.