M Majid DS mds
GitHub

mds components

mds:quantity

A cart quantity stepper.

2
<mds:quantity :value="2" :min="1" :max="5" name="qty" />

Sizes

1
2
3
<div class="flex items-center gap-4">
    <mds:quantity :value="1" size="sm" />
    <mds:quantity :value="2" />
    <mds:quantity :value="3" size="lg" />
</div>

Bounds and step

The buttons disable themselves at the bounds.

1
10
<div class="flex items-center gap-4">
    <mds:quantity :value="1" :min="1" :max="3" />
    <mds:quantity :value="10" :step="5" :min="5" :max="50" />
</div>

With Livewire

The hidden input always holds Latin digits, whatever the display shows — so the value that reaches your component is a number, not a Persian string.

2
<mds:quantity wire:model.live="quantity" :min="1" :max="10" />

Persian output

config('mds.persian_digits') — on by default in a real app, off in these docs — switches the displayed digits and the built-in strings to Persian: the buttons are labeled افزایش تعداد and کاهش تعداد for screen readers. :fa="true" does it for a single stepper.

۲
<mds:quantity :value="2" :min="1" :max="10" :fa="true" />

Reference

mds:quantity

PropDescription
valueStarting quantity.
minLower bound. Default: 1.
maxUpper bound.
stepIncrement. Default: 1.
sizeOptions: sm, lg.
nameField name for a plain form.
faPersian digits and built-in strings. Default: config('mds.persian_digits').
increment-labelAccessible label for the plus button. Default: "Increase quantity", or افزایش تعداد in Persian.
decrement-labelAccessible label for the minus button. Default: "Decrease quantity", or کاهش تعداد in Persian.
wire:modelBinds to a Livewire property.

Related