Counter
A way to let users increase a value one at a time.
Default counter orc-c-field orc-c-field--counter
A way to let users increase a value one at a time.
-
<div class="orc-c-field orc-c-field--small orc-c-field--counter"> <label class="orc-c-field__label " for="number-rooms">Label</label> <div class="orc-c-field__body"> <button class="orc-c-btn orc-c-field__btn-left orc-c-btn--bare orc-js-minus" title="subtract button"> <div class="orc-c-btn__inner"> <svg class="orc-c-btn__icon "> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../../orchid-icons.svg#minus"></use> </svg> </div><!--end orc-c-btn__inner--> </button> <!-- end orc-c-btn --> <input type="number" name="number-rooms" id="number-rooms" value="3" min="1" max="6" class="orc-c-input"> <button class="orc-c-btn orc-c-field__btn-right orc-c-btn--bare orc-js-plus" title="add button"> <div class="orc-c-btn__inner"> <svg class="orc-c-btn__icon "> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../../orchid-icons.svg#plus"></use> </svg> </div><!--end orc-c-btn__inner--> </button> <!-- end orc-c-btn --> </div> <!--end orc-c-field__body--> </div> <!--end orc-c-field-->
Usage
When to use
This is the simple way for users to indicate a number of something: tickets needed, rooms being booked, number of adults or children.
When to consider an alternative
The counter is excellent for display on homepage, offerings pages, and other high-priority pages. On more administrative pages like form submissions, a select field is better for managing amounts.
Class Name | Description |
---|---|
Required
|
Form field within the |
Modifier
|
Add to |
Modifier
|
Add to |
Required
|
Word or short phrase applied to an |
Required
|
Form field container that houses the buttons and input of the counter |
Required
|
Form field container that houses the buttons and input of the counter |
Required
|
The button component is used for the minus and plus buttons of the counter. These are also used with |
JS
|
Add to the minus button to get JavaScript to target this element for proper functionality |
JS
|
Add to the plus button to get JavaScript to target this element for proper functionality |
Required
|
The input where the number value is stored. The |