Home

Awesome

vue-integer-plusminus

npm npm

Integer input with increment and decrement buttons

Live demo here

This component fits as spinbutton, allowing keyboard functionalities (up/down arrows or page up/down to increment/decrement, home/end to min/max)

Global use

npm install --save vue-integer-plusminus
import { IntegerPlusminus } from 'vue-integer-plusminus'
export default {
    components: { IntegerPlusminus },
    methods: ...
}

Components

Integer plus/minus

<integer-plusminus></integer-plusminus>
<integer-plusminus :min="ipm_min"
                   :max="ipm_max"
                   :step="ipm_step"
                   :vertical="ipm_vertical"
                   :disabled="imp_disabled"
                   formName="integer_plus_minus"
                   v-model="ipm_value">
    <p>Your value is</p>
    {{ ipm_value }}
    
    <template slot="decrement">{{ ipm_slot_decr }}</template>
    
    <template slot="increment">{{ ipm_slot_incr }}</template>
</integer-plusminus>
PropTypeNote
minnumberminimum possible value. Cannot decrement lower. Default is 0
maxnumbermaximum possible value. Cannot increment over. Default is undefined
stepnumberIncremental and decremental step. Must be greater than 0. Default is 1
stepIncrementnumberIncremental step, optional. If greater than 0 (default), this value replaced the 'step' one when incrementing
stepDecrementnumberDecremental step, optional. If greater than 0 (default), this value replaced the 'step' one when decrementing
verticalBooleanUse vertical layout. Default is false
disabledBooleanDisabled buttons and keys events. Default is false
spinButtonAriaLabelstringSet aria-label attribute on value element, optional
incrementAriaLabelstringSet aria-label attribute on decrement button element, optional
decrementAriaLabelstringSet aria-label attribute on increment button element, optional
formNamestringSet the 'name' attribute of the form input. Default is 'integerPlusMinus'

This component provide 3 slots

Style could be overwritten using !important css keyword

.int-input-increment {
    background: #5CB85C !important;
}

Events:

Contribution