M Majid DS mds
GitHub

mds components

mds:price

Money in Toman or Rial — separators, currency label and discount badge from one amount.

Grouping separators and the currency label, from one amount. These docs render the kit configured for English — Latin digits, Toman; the last section shows the Persian output a Persian-configured app gets by default.

2,500,000 Toman
<mds:price :amount="2500000" />

With an original price

Pass original and you get the strikethrough and the discount badge for free — the percentage is computed, not passed in.

22%
3,200,000
2,500,000 Toman
<mds:price :amount="2500000" :original="3200000" size="lg" />

Currency

toman and rial render تومان / ریال in Persian mode and Toman / Rial in English mode, none drops the label, and any other string is used verbatim.

2,500,000 Toman
890,000
890,000 AED
<div class="flex flex-wrap items-center gap-8">
    <mds:price :amount="2500000" />
    <mds:price :amount="890000" currency="none" />
    <mds:price :amount="890000" currency="AED" />
</div>

Sizes

2,500,000 Toman
2,500,000 Toman
2,500,000 Toman
<div class="flex flex-wrap items-center gap-8">
    <mds:price :amount="2500000" size="sm" />
    <mds:price :amount="2500000" />
    <mds:price :amount="2500000" size="lg" />
</div>

Decimals and no badge

1,250.75 Toman
3,200,000
2,500,000 Toman
<div class="flex flex-wrap items-center gap-8">
    <mds:price :amount="1250.75" :decimals="2" />
    <mds:price :amount="2500000" :original="3200000" :badge="false" />
</div>

Persian output

config('mds.persian_digits') — on by default in a real app, off in these docs — switches the digits, the ٬ separator and the currency label to Persian; :fa="true" does it for a single price. The @toman and @rial directives are Persian by definition — money inside a Persian sentence.

۲۲٪
۳٬۲۰۰٬۰۰۰
۲٬۵۰۰٬۰۰۰ تومان
۱۴٬۵۰۰٬۰۰۰ ریال

قیمت این کالا ۲٬۵۰۰٬۰۰۰ تومان است.

<div class="flex flex-col items-center gap-6">
    <div class="flex flex-wrap items-center gap-8">
        <mds:price :amount="2500000" :original="3200000" size="lg" :fa="true" currency="toman" />
        <mds:price :amount="14500000" :fa="true" currency="rial" />
    </div>

    <flux:text>قیمت این کالا @toman(2500000) است.</flux:text>
</div>

Reference

mds:price

PropDescription
amountThe price. Default: 0.
originalPre-discount price; adds the strikethrough and the badge.
currencytoman, rial (the Persian words), none, or a literal label. Default: config('mds.currency').
decimalsDecimal places. Default: 0.
sizeOptions: sm, lg.
faPersian digits, separators and built-in labels. Default: config('mds.persian_digits').
badgeShows the discount badge when original is set. Default: true.

@toman / @rial

Blade directives for a formatted amount inline, e.g. @toman($order->total). Persian digits and labels by definition — they exist for Persian sentences.

Related