Skip to content

Input

Input input box component, used for users to input text information.

Basic usage

js
<script setup>
    import { ref } from 'vue'
    const msg = ref('')
</script>

<template>
  <m-input v-model="msg" placeholder="Please enter text"></m-input>
</template>

Prefix Suffix

Prefix

Prefix

Suffix

suffix
js
<template>
    <m-input v-model="msg" placeholder="Please enter text" prefix="Prefix"></m-input>
    <m-input v-model="msg" placeholder="Please enter text" suffix="suffix"></m-input>
</template>

Prepend Append

prepend

prepend

append

append
js
<template>
    <m-input v-model="msg" placeholder="Please enter text" prepend="prepend"></m-input>
    <m-input v-model="msg" placeholder="Please enter text" append="append"></m-input>
</template>

Disabled

js
<template>
   <m-input v-model="msg" placeholder="Please enter text" disabled></m-input>
</template>

Readonly

js
<template>
   <m-input v-model="msg" placeholder="Please enter text" readonly></m-input>
</template>

Size

Size values: minismalllarge, Default small

js
<template>
   <m-input v-model="msg" placeholder="Please enter text" size="large"></m-input>
</template>

Clearable

js
<template>
   <m-input v-model="msg" placeholder="Please enter text" clearable></m-input>
</template>

Password

js
<template>
   <m-input v-model="msg" type="password" showPasswordIcon placeholder="Please enter text" show-password></m-input>
</template>

Limit Count

0/10
js
<template>
   <m-input v-model="msg" placeholder="Please enter text" :maxlength="10" showLimitCount></m-input>
</template>

API

PropertyDescriptionTypeDefault
v-modelBinding valuestring-
valueBinding valuestring-
typeInput box typestringtext
placeholderPlaceholder textstring-
disabledDisabled state of input boxbooleanfalse
readonlyReadonly state of input boxbooleanfalse
sizeSize of input box, optional values: minismalllargestringsmall
showPasswordIconShow password iconbooleanfalse
showLimitCountShow limit countbooleanfalse
maxLengthMaximum number of characters allowednumber-
prependPrepend slotstring-
appendAppend slotstring-
prefixPrefix slotstring-
suffixSuffix slotstring-
clearableWhether to show the clear buttonbooleanfalse

Events

Event NameDescriptionParameters
changeTriggered when the value changes(value: string)
focusTriggered when the input box gets focus(event: Event)
blurTriggered when the input box loses focus(event: Event)

Slots

NameDescription
prependPrepend slot
appendAppend slot
prefixPrefix slot
suffixSuffix slot

Released under the MIT License.