Skip to content

Input

Basic usage

Disabled

Disable the Input with the disabled attribute.

AllowClear

Make the Input allowClear with the allowClear attribute.

Password box

Setting the type=password attribute to obtain a password box that can be toggled between displaying and hiding

Input with icon

prefix and suffix named slots

Textarea

Resizable for entering multiple lines of text information. Add attribute type="textarea" to change input into native textarea.

Autosize Textarea

Setting the rows prop for a textarea type of Input makes the height to automatically adjust based on the content.

Size

Setting the size attribute to change the size of the input box. In addition to the default size, there are two other options: large and small

Limit length

maxlength and minlength attributes of input, they declare a limit on the number of characters a user can input. The "number of characters" is measured using JavaScript string length.Setting the maxlength prop for a text or textarea type of Input can limit the length of input value, allows you to show word count by setting showCount to true at the same time.

Input API

Input Attributes

NameDescriptionTypeDefaultVersion
typetype of inputstringtext
value(v-model)binding valuestring
maxlengththe max lengthnumber
showCountwhether show word countbooleanfalse
placeholderplaceholder of Inputstring
disabledwhether Input is disabledbooleanfalse
sizesize of Input, works when type is not textarealarge | default | small
prefixprefix icon componentComponent
suffixsuffix icon componentComponent
rowsnumber of rows of textarea, only works when type is textareanumber
readonlysame as readonly in native inputbooleanfalse
resizecontrol the resizabilitynone | both | horizontal | vertical

Input Events

NameDescriptionType
changetriggers when the input box loses focus or the user presses Enter, only if the modelValue has changed(value: string | number) => void
inputtriggers when the Input value change(value: string | number) => void
cleartriggers when the Input is cleared by clicking the clear button() => void

Input Slots

NameDescription
prefixcontent as Input prefix, only works when type is not textarea
suffixcontent as Input suffix, only works when type is not textarea

Input Exposes

NameDescriptionType
clearclear input value() => void
inputHTML input elementRef<HTMLInputElement>
textareaHTML textarea elementRef<HTMLTextAreaElement>

Contributors

lazy
Lazy

ChangeLog

4fac2 - style: 修复input样式问题 on 3/13/2025
2253f - style: 删除多余样式 on 3/13/2025
5e339 - style: 修复input长度问题 on 4/23/2024
586d9 - feat: 增加seach查询 on 4/18/2024
1bfea - fix: 修正无边框模式 on 11/21/2023
74b5c - feat: input-number on 11/21/2023
5a336 - style: 修正颜色 on 11/16/2023
d3d9d - feat: input on 11/5/2023

Released under the MIT License.