0

I'm working on the input using Hyva, so with AlpineJS. I would need to understand how I have to do to make the input look like in the image using the + and - to increase or decrease the quantity. enter image description here

1 Answer 1

1

If you mean the functional area of the + and -, below is an example of AlpineJS component to do that (the styling is more relevant to TailwindCSS and not AlpineJS):

<div x-data="{counter: 0}">
    <button @click="counter = counter - (counter > 0)" > 
        <!-- (counter > 0) prevents negative values, if you want them replace it with 1 -->
        <span>-</span>
    </button>
    <input type="number" min="0" :value="counter" />
    <button @click="counter = counter + 1" > 
        <span>+</span>
    </button>
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.