Add

Lorem ipsum

Lorem ipsum

CMS & Logic

3 views

4 min

How to Create a +/- Counter in a Webflow Form with Finsweet

Learn how to create a counter with + and - buttons in a Webflow form using Finsweet Attributes Form Counter.

In this tutorial, Sandro, co-founder of Gemeos Webflow agency, shows you how to create a counter with + and - buttons in a Webflow form using Finsweet Attributes Form Counter.

AttributeElementValue
fs-counter-elementNumber Inputinput
fs-counter-elementIncrement button (+)increment
fs-counter-elementDecrement button (-)decrement
fs-counter-minNumber InputMinimum value (e.g. 0)
fs-counter-maxNumber InputMaximum value (e.g. 99)
fs-counter-stepNumber InputIncrement step (e.g. 1)

1. Add the script to the head

<script src="https://cdn.jsdelivr.net/npm/@finsweet/attributes-counter@1/counter.js" defer>script>

2. Build the counter structure

In your Webflow form, add a Number Input with the fs-counter-element="input" attribute. Create two buttons side by side: the "+" button with fs-counter-element="increment" and the "-" button with fs-counter-element="decrement". Group these 3 elements inside the same Div container.

3. Set the limits

On the Number Input, add the control attributes: fs-counter-min="0" (minimum value), fs-counter-max="99" (maximum value), fs-counter-step="1" (increment). Finsweet automatically disables the "-" button when the value reaches the minimum and the "+" button when it reaches the maximum.

4. Hide the native field (optional)

If you don't want to display the native number field (with its browser arrows), hide it visually while keeping it in the DOM for form submission. Use opacity: 0 with position: absolute instead of display: none so the value is properly submitted.

good to know

Finsweet Counter is compatible with Finsweet multi-step forms and with native Webflow form validation. If you set a 'required' attribute on the Number Input, the form won't submit if the value is empty. Set a default value (the 'value' attribute in the Number Input Settings) to avoid an empty field on load.

Conclusion

Finsweet Counter improves form UX for numeric fields. Use cases:

  • Quantity selector on an order form
  • Number of event attendees
  • Duration selector (number of months, days)

Published on

You might be interested in these tutorials

Similar tutorials

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...