M Majid DS mds
GitHub

mds components

mds:rating

A star rating, read-only or as an input.

Half stars are supported, and the review count comes along.

<mds:rating :value="4.3" :count="126" />

Sizes

<div class="flex flex-wrap items-center gap-8">
    <mds:rating :value="4.6" size="sm" />
    <mds:rating :value="4.6" />
    <mds:rating :value="4.6" size="lg" />
</div>

Without the number

<div class="flex flex-wrap items-center gap-8">
    <mds:rating :value="5" :count="12" />
    <mds:rating :value="2.5" :show-value="false" />
</div>

As an input

mds:rating.input is a real radio group under the hood, so it works in a plain form and with the keyboard. Its default group label follows the config language — "Rating" here, امتیاز in Persian.

<mds:rating.input name="score" :value="3" />

Persian output

config('mds.persian_digits') — on by default in a real app, off in these docs — switches the value and count to Persian digits and the built-in labels to Persian; :fa="true" does it for a single rating.

<div class="flex flex-wrap items-center gap-8">
    <mds:rating :value="4.3" :count="126" :fa="true" />
    <mds:rating :value="3.7" :count="1205" :fa="true" />
</div>

Reference

mds:rating

PropDescription
valueThe rating. Default: 0.
maxNumber of stars. Default: 5.
countReview count shown after the stars.
sizeOptions: sm, lg.
show-valueShows the numeric value. Default: true.
faPersian digits. Default: config('mds.persian_digits').

mds:rating.input

PropDescription
valuePre-selected rating.
maxNumber of stars. Default: 5.
nameField name for a plain form.
sizeOptions: sm, lg.
labelAccessible group label. Default: "Rating", or امتیاز in Persian (follows the config).
reverseFlips Arrow Left/Right. By default Right is always next, in RTL and LTR alike; set this when Right should follow the visual order of an RTL star row.
wire:modelBinds to a Livewire property.

Related