Skip to content

Input

Input component is used for keyboard input content. It is the most basic form field wrapper. Supports text, password, number and other input types.

Platform Compatibility

App(vue)App(nvue)H5Mini Program

Basic Usage

html
<template>
  <seeInput v-model="value" placeholder="Please enter content" />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('')
</script>

Input Types

Set input type via type property. Supports text, number, password, digit, tel, idcard.

html
<template>
  <seeInput v-model="textValue" type="text" placeholder="Text input" />
  <seeInput v-model="numberValue" type="number" placeholder="Number input" />
  <seeInput v-model="passwordValue" type="password" placeholder="Password input" />
  <seeInput v-model="digitValue" type="digit" placeholder="Integer input" />
  <seeInput v-model="telValue" type="tel" placeholder="Phone input" />
</template>

<script setup>
import { ref } from 'vue'

const textValue = ref('')
const numberValue = ref('')
const passwordValue = ref('')
const digitValue = ref('')
const telValue = ref('')
</script>

Password Input

Set type="password" to create a password input. Use the showPassword property to toggle password visibility.

html
<template>
  <seeInput
    v-model="password"
    type="password"
    placeholder="Please enter password"
    show-password
  />
</template>

<script setup>
import { ref } from 'vue'

const password = ref('')
</script>

Clearable

Set the isClearable property to show a clear button for clearing input content with one click.

html
<template>
  <seeInput
    v-model="value"
    placeholder="Clearable input"
    is-clearable
  />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('Clearable content')
</script>

Word Limit

Set the isShowWordLimit property to display word count. Must be used together with maxlength.

html
<template>
  <seeInput
    v-model="value"
    placeholder="Please enter content"
    maxlength="20"
    is-show-word-limit
  />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('')
</script>

Prefix and Suffix Icons

Set prefix and suffix icons via prefixIcon and suffixIcon properties.

html
<template>
  <seeInput
    v-model="value"
    prefix-icon="search"
    placeholder="Search content"
  />
  <seeInput
    v-model="value"
    suffix-icon="calendar"
    placeholder="Select date"
  />
</template>

Slot Usage

Use prefix and suffix slots to customize prefix and suffix content.

html
<template>
  <seeInput v-model="value" placeholder="Please enter URL">
    <template #prefix>
      <text>https://</text>
    </template>
    <template #suffix>
      <text>.com</text>
    </template>
  </seeInput>
</template>

Formatter

Format input content via the formatter property, for example phone numbers, bank card numbers, etc.

html
<template>
  <seeInput
    v-model="phone"
    type="tel"
    placeholder="Please enter phone number"
    :formatter="formatPhone"
    maxlength="13"
  />
</template>

<script setup>
import { ref } from 'vue'

const phone = ref('')

const formatPhone = (value) => {
  // Phone number format: xxx xxxx xxxx
  const cleaned = value.replace(/\D/g, '')
  const match = cleaned.match(/^(\d{3})(\d{0,4})(\d{0,4})$/)
  if (match) {
    return [match[1], match[2], match[3]].filter(Boolean).join(' ')
  }
  return cleaned
}
</script>

Sizes

Set input size via size property. Supports small, default, large.

html
<template>
  <seeInput v-model="value" size="small" placeholder="Small size" />
  <seeInput v-model="value" size="default" placeholder="Default size" />
  <seeInput v-model="value" size="large" placeholder="Large size" />
</template>

Disabled and Readonly

Set disabled and readonly states via isDisabled and isReadonly properties.

html
<template>
  <seeInput v-model="value" is-disabled placeholder="Disabled state" />
  <seeInput v-model="value" is-readonly placeholder="Readonly state" />
</template>

Borderless Mode

Set isBorder to false to hide the input border.

html
<template>
  <seeInput v-model="value" :is-border="false" placeholder="Borderless input" />
</template>

API

Props

ParameterDescriptionTypeDefaultPlatform
modelValueBound valuestring | number''-
typeInput typestring'text'-
placeholderPlaceholder textstring''-
isDisabledWhether disabledbooleanfalse-
isReadonlyWhether readonlybooleanfalse-
isClearableWhether to show clear buttonbooleanfalse-
maxlengthMaximum input lengthnumber-1-
isShowWordLimitWhether to show word countbooleanfalse-
prefixIconPrefix iconstring''-
suffixIconSuffix iconstring''-
sizeSizestring'default'-
isBorderWhether to show borderbooleantrue-
formatterInput formatter function(value: string) => string--
nameForm field namestring''-
showPasswordWhether to show password toggle buttonbooleanfalse-

Events

EventDescriptionTypePlatform
onInputTriggered on input(value: string | number) => void-
onFocusTriggered on focus(event: FocusEvent) => void-
onBlurTriggered on blur(event: FocusEvent) => void-
onClearTriggered when clear button is clicked() => void-
onChangeTriggered when value changes (on blur or enter)(value: string | number) => void-
onConfirmTriggered when confirm button is clicked(value: string | number) => void-

Slots

SlotDescription
prefixContent at the beginning of the input
suffixContent at the end of the input

Liao ICP No. 2025070134