UIInput
UIInput
A versatile input component with various types and validation support.
<template> <UIInput v-model:value="inputValue" placeholder="Enter text" :type="type" :clearable="true" :disabled="false" :maxLength="100" @change="handleChange" @clear="handleClear" > <template #prefix> <SearchIcon class="w-4 h-4" /> </template> <template #suffix> <span class="text-gray-400">suffix</span> </template> </UIInput></template>
<script setup lang="ts">const inputValue = ref('')const type = ref('text')
const handleChange = (value: string) => { console.log('Input changed:', value)}
const handleClear = () => { console.log('Input cleared')}</script>Props
value(string | number): Input valuetype(‘text’ | ‘password’ | ‘email’ | ‘number’ | ‘tel’ | ‘url’): Input typeplaceholder(string): Placeholder textdisabled(boolean): Disable inputreadonly(boolean): Make input readonlyclearable(boolean): Show clear buttonmaxLength(number): Maximum input lengthshowCount(boolean): Show character countsize(‘small’ | ‘medium’ | ‘large’): Input sizestatus(‘error’ | ‘warning’ | ‘success’): Input statusbordered(boolean): Show input borderround(boolean): Round input cornersautoFocus(boolean): Auto focus input
Events
update:value: Emitted when input value changeschange: Emitted when input value is changed and blurinput: Emitted when input value is being typedfocus: Emitted when input is focusedblur: Emitted when input loses focusclear: Emitted when clear button is clickedpressEnter: Emitted when Enter key is pressed
Slots
prefix: Content before inputsuffix: Content after inputprepend: Content before input groupappend: Content after input group