Skip to content

Input ​

shadcn/ui uslubidagi matn inputi. Mask, debounce, formatter, textarea, raqamli stepper, qidiruv va boshqalarni qo'llab-quvvatlaydi.

vue
<template>
  <VxInput v-model="value" placeholder="Type something..." />
</template>

Sizes ​

vue
<template>
  <VxInput size="sm" />
  <VxInput />
  <VxInput size="lg" />
</template>

Clearable ​

vue
<template>
  <VxInput v-model="value" clearable />
</template>

Password ​

vue
<template>
  <VxInput type="password" placeholder="Enter password..." />
</template>

Prefix & Suffix ​

vue
<template>
  <VxInput placeholder="Search...">
    <template #prefix><SearchIcon /></template>
  </VxInput>
</template>

Mask ​

# = raqam, A = harf, * = istalgan belgi. Ajratgichlar avtomatik qo'shiladi.

Phone: ###-###-####
Card: #### #### #### ####
vue
<template>
  <VxInput mask="###-###-####" placeholder="Phone" />
  <VxInput mask="#### #### #### ####" placeholder="Card" />
</template>

Mask with Unmasked Value ​

v-model mask qilingan qiymatni qaytaradi (masalan, +1 (234) 567-89-01). Faqat xom raqamlarni olish uchun v-model:unmasked-value dan foydalaning.

Phone: +# (###) ###-##-##
v-model (masked): –
unmasked-value: –
Credit Card: #### #### #### ####
v-model (masked): –
unmasked-value: –
vue
<script setup>
const phone = ref('')
const phoneRaw = ref('')
// phone will be "+1 (234) 567-89-01" (masked)
// phoneRaw will be "12345678901" (unmasked)
</script>

<template>
  <VxInput v-model="phone" v-model:unmasked-value="phoneRaw" mask="+# (###) ###-##-##" />
</template>

Debounce ​

v-model yangilanishini kechiktiradi. @input baribir darhol ishga tushadi.

Debounced: –
vue
<template>
  <VxInput v-model="value" :debounce="500" />
</template>

Trim ​

Blur paytida bo'sh joylarni avtomatik tozalaydi.

""
vue
<template>
  <VxInput v-model="value" trim />
</template>

Lazy ​

v-model'ni har bir tugma bosilishida emas, balki blur paytida yangilaydi.

v-model: –
vue
<template>
  <VxInput v-model="value" lazy />
</template>

Autofocus ​

vue
<template>
  <VxInput autofocus />
</template>

Loading ​

vue
<template>
  <VxInput v-model="value" loading />
</template>

Formatter / Parser ​

Formatlangan qiymatni ko'rsatish, xom qiymatni saqlash. Formatter blur paytida, parser input paytida ishga tushadi.

Raw: 1234567 (number)
vue
<script setup>
function formatter(v) { return Number(v).toLocaleString('en-US') }
function parser(v) { return v.replace(/,/g, '') }
</script>

<template>
  <VxInput v-model="value" :formatter="formatter" :parser="parser" />
</template>

Textarea ​

vue
<template>
  <VxInput v-model="value" type="textarea" :rows="4" />
</template>

Autosize Textarea ​

vue
<template>
  <VxInput type="textarea" :autosize="{ minRows: 2, maxRows: 6 }" />
</template>

Number ​

Stepper tugmalari va strelka tugmalari qo'llab-quvvatlashi bilan.

Basic
0
Min: 0, Max: 10, Step: 2
5
Precision: 2
1.5
vue
<template>
  <VxInput v-model="value" type="number" />
  <VxInput v-model="value" type="number" :min="0" :max="10" :step="2" />
  <VxInput v-model="value" type="number" :step="0.25" :precision="2" />
</template>

Regex ​

Input'ni regex shabloniga mos keladigan belgilar bilan cheklang. Mos kelmaydigan belgilar real vaqtda olib tashlanadi.

Numbers only (/[0-9]/)
Letters only (/[a-zA-Z]/)
Alphanumeric (/[a-zA-Z0-9]/)
vue
<template>
  <!-- Numbers only -->
  <VxInput v-model="value" :regex="/[0-9]/" />

  <!-- Letters only -->
  <VxInput v-model="value" :regex="/[a-zA-Z]/" />

  <!-- Alphanumeric -->
  <VxInput v-model="value" :regex="/[a-zA-Z0-9]/" />
</template>

O'rnatilgan qidiruv ikoni. Enter bosilganda @search hodisasini chiqaradi.

vue
<template>
  <VxInput type="search" placeholder="Search..." @search="onSearch" clearable />
</template>

Word Limit ​

0 / 50
vue
<template>
  <VxInput :maxlength="50" show-word-limit />
</template>

Floating Label ​

floating-label yoqilganda, placeholder fokus paytida yoki input qiymatga ega bo'lganda yuqori chegaraga animatsiya bilan ko'tariladi.

vue
<template>
  <VxInput v-model="val" placeholder="Username" floating-label />
  <VxInput v-model="email" placeholder="Email" floating-label type="email" />
  <VxInput v-model="pass" placeholder="Password" floating-label type="password" />
</template>

Disabled & Readonly ​

vue
<template>
  <VxInput disabled />
  <VxInput readonly />
</template>

Props ​

PropTypeDefaultDescription
modelValuestring | number''Qiymat (v-model)
placeholderstring''Placeholder
type'text' | 'password' | 'email' | 'number' | 'search' | 'tel' | 'url' | 'textarea''text'Input turi
size'sm' | 'default' | 'lg''default'O'lchami
disabledbooleanfalseO'chirish
readonlybooleanfalseFaqat o'qish uchun
clearablebooleanfalseTozalash tugmasi
debouncenumber0v-model yangilanishini kechiktirish (ms)
maskstring''Input mask (#=raqam, A=harf, *=istalgan)
unmaskedValuestring—Mask belgilaridan tashqari xom qiymat (v-model:unmasked-value)
trimbooleanfalseBlur paytida bo'sh joylarni tozalash
lazybooleanfalsev-model'ni faqat blur paytida yangilash
autofocusbooleanfalseMount paytida fokus
loadingbooleanfalseYuklanish spinnerini ko'rsatish
formatter(v: string) => string—Ko'rinadigan qiymatni formatlash (blur paytida)
parser(v: string) => string—Emit oldidan qiymatni parse qilish
maxlengthnumber—Maksimal belgilar
showWordLimitbooleanfalseBelgilar sonini ko'rsatish
rowsnumber3Textarea qatorlari
autosizeboolean | { minRows, maxRows }falseTextarea'ning avtomatik kengayishi
minnumber—Minimal qiymat (number turi)
maxnumber—Maksimal qiymat (number turi)
stepnumber1Qadam o'sishi (number turi)
precisionnumber—O'nlik belgilari (number turi)
regexRegExp—Faqat regex'ga mos keluvchi belgilarga ruxsat berish
inputClassstring | string[] | Record''O'zgartirilgan wrapper klassi
inputStyleRecord<string, string>—O'zgartirilgan wrapper uslubi
floatingLabelbooleanfalseFokus paytida placeholder'ni yuqori chegaraga animatsiya qilish

Events ​

EventTypeDescription
update:modelValue(v: string | number)Qiymat o'zgardi
input(v: string | number)Har bir tugma bosilishida
change(v: string | number)Blur/Enter paytida
focus(e: FocusEvent)Fokuslandi
blur(e: FocusEvent)Fokusdan chiqdi
clear()Tozalandi
search(v: string)Enter bosildi (search turi)

Slots ​

SlotDescription
prefixInput'dan oldin (type="search" uchun avtomatik qidiruv ikoni)
suffixInput'dan keyin