Skip to content

Input Component ​

Input Component

Input is a basic form control for users to enter data, supporting various types of input.

Basic Usage ​

Basic input for entering single-line text.

Current value:
Show CodeArrow
CopyGitHub

Disabled State ​

Set the disabled attribute to disable the input.

Show CodeArrow
CopyGitHub

Password Input ​

Set the password attribute to create a password input with show/hide password toggle.

Show CodeArrow
CopyGitHub

Clearable Input ​

By default, inputs with v-model will show a clear icon after entering content, which can be clicked to clear the content.

Default with clear button:
Disable clear button:
Show CodeArrow
CopyGitHub

Different Sizes ​

Input supports three sizes: small, default, and large.

Small input:
Default input:
Large input:
Show CodeArrow
CopyGitHub

Maximum Input Length ​

Set the maxLength attribute to limit the maximum input length.

Current length: 0/10
Show CodeArrow
CopyGitHub

Event Handling ​

Input provides multiple events: focus, blur, enter, input, clear.

Event Log:
Show CodeArrow
CopyGitHub

Input API ​

Attributes ​

AttributeDescriptionTypeAccepted ValuesDefault
v-modelBinding valuestring——
sizeSizestringsmall / default / largedefault
placeholderPlaceholder textstring——
disabledWhether disabledboolean—false
clearableWhether clearableboolean—true
passwordWhether password inputboolean—false
maxLengthMaximum input lengthnumber——
debounceDebounce callback(value: string) => void——
debounceDelayDebounce delay (ms)number—1000
autocompleteAutocompletestringon / offoff
isTipWhether show tipboolean—true

Events ​

Event NameDescriptionParameters
focusTriggered when input is focused(value: string)
blurTriggered when input loses focus(value: string)
enterTriggered when Enter key is pressed(value: string)
inputTriggered when input value changes(value: string)
clearTriggered when clear button is clicked—

Slots ​

Slot NameDescription
prefixInput prefix content
defaultInput default content

Style Variables ​

The input component uses the following style variables, which can be customized through SCSS variables:

Variable NameDescription
$theme-color-primaryTheme color - Primary
$text-color-defaultDefault text color
$border-color-defaultDefault border color
$bg-color-defaultDefault background color
$opacity-disabledDisabled state opacity
$font-size-smallSmall font size
$font-size-defaultDefault font size
$font-size-largeLarge font size

Released under the MIT License