Skip to content

KInputNumber

Input numerical values with a customizable range.

Install

bash
pnpm add @ikun-ui/input-number
bash
yarn add @ikun-ui/input-number
bash
npm install @ikun-ui/input-number

Basic usage

1

Disabled inputNumber

Disable the input through the disabled attribute

Step

Allows you to define incremental steps.

1

Step strictly

The stepStrictly attribute accepts a boolean. if this attribute is true, input value can only be multiple of step.

2

Precision

Add precision attribute to set the precision of input value.

2

Ranges

Example of limiting value through min and max attributes

2

Sizes

Add size attribute to change the size of InputNumber. It supports sm, md and lg.

InputNumber Props

NameTypeDefaultDescription
sizesm | md |lgmdsize of InputNumber.
valuenumber | null-Binding value.
maxnumber-InfinityThe maximum allowed value.
minnumberInfinityThe minimum allowed value.
stepnumber1Incremental step.
stepStrictlybooleanfalseWhether input value can only be multiple of step.
precisionnumber | null-Precision of input value.
disabledbooleanfalseDisable the InputNumber.
controlsbooleanfalseWhether to enable the control buttons.
valueOnClearnumber | nullnullValue should be set when input box is cleared.
placeholderstring-InputNumber's placeholder
idstring-InputNumber's placeholder
namestring-InputNumber's placeholder
readonlybooleanfalseInputNumber's placeholder
appendstring-The class name of the append button, following the unocss standard.
prependstring-The class name of the prepend button, following the unocss standard.
useCompositionInputbooleanfalseBind value will be updated after the composition input ends
clsstring-Additional class
attrsRecord<string, string>{}Additional attributes

InputNumber Events

NameDescriptionType
inputEvent fired on input(value: number)=> void
enterEvent fired when enter is pressed(e: Event)=> void
keydownEvent fired when keyboard is pressed(e: Event)=> void
changeEvent fired when the value is changes(e: Event)=> void
compositionstartThe compositionstart event is fired when a text composition system(e: CompositionEvent)=> void
compositionendThe compositionend event is fired when a text composition system(e: CompositionEvent)=> void
compositionInputEvent fired when enable useCompositionInput(e: CompositionEvent)=> void
triggerPrependEvent fired on prepend button(value: HTMLInputElement.value)=> void
triggerAppendEvent fired on append button(value: HTMLInputElement.value)=> void
searchWhen search is true and you press enter or click the prepend button or click the append button, the event will be triggered.(value: HTMLInputElement.value)=> void
blurTriggers when Input blurs.(e: Event)=> void
focusTriggers when Input focuses.(e: Event)=> void

InputNumber Slots

NameDescription
appendCustomize input append content
prependCustomize input prepend content

MIT Licensed