UiInput

Text, number, password, email, phone and textarea input.

Contents

A single control covering text, number (with steppers), password (with a visibility toggle), email, phone and textarea, plus optional leading/trailing icons, a clear button and built-in validation.

Examples

Types

Text, email and phone in one control. Email and phone validate on blur.

<div class="flex max-w-sm flex-col gap-3">
  <UiInput v-model="state.name" placeholder="Your name" />
  <UiInput v-model="state.email" type="email" icon-left="mdi:email-outline" placeholder="you@example.com" />
  <UiInput v-model="state.phone" type="phone" icon-left="mdi:phone-outline" placeholder="+44 20 7946 0000" />
</div>

Password and clearable

Password mode adds a visibility toggle; clearable adds a clear button while there is a value.

<div class="flex max-w-sm flex-col gap-3">
  <UiInput v-model="state.pw" type="password" placeholder="Password" />
  <UiInput v-model="state.q" clearable placeholder="Type, then clear" />
</div>

Number stepper layouts

Number mode places the +/- controls four ways via stepper-layout: both-sides, stacked-left, stacked-right or none.

<div class="grid max-w-md gap-4 sm:grid-cols-2">
  <label class="text-sm text-gray-500">both-sides
    <UiInput v-model="state.n1" type="number" :min="0" :max="10" stepper-layout="both-sides" class="mt-1" />
  </label>
  <label class="text-sm text-gray-500">stacked-left
    <UiInput v-model="state.n2" type="number" :min="0" :max="10" stepper-layout="stacked-left" class="mt-1" />
  </label>
  <label class="text-sm text-gray-500">stacked-right
    <UiInput v-model="state.n3" type="number" :min="0" :max="10" stepper-layout="stacked-right" class="mt-1" />
  </label>
  <label class="text-sm text-gray-500">none
    <UiInput v-model="state.n4" type="number" :min="0" :max="10" stepper-layout="none" class="mt-1" />
  </label>
</div>

Icons

A leading icon via icon-left and a trailing icon via icon-right.

<div class="flex max-w-sm flex-col gap-3">
  <UiInput v-model="state.search" icon-left="mdi:magnify" placeholder="Search" />
  <UiInput v-model="state.amount" icon-right="mdi:currency-eur" placeholder="Amount" />
</div>

Textarea

Multi-line input; resize can be none, vertical, horizontal or both.

<UiInput v-model="state.note" type="textarea" :rows="3" resize="vertical" placeholder="Drag the corner to resize" class="max-w-sm" />

Validation

Built-in validation for email/phone/number, or a custom validation-pattern with a message. Errors appear below the field after blur.

<div class="flex max-w-sm flex-col gap-3">
  <UiInput v-model="state.em" type="email" placeholder="Enter an email, then click away" />
  <UiInput v-model="state.code" validation-pattern="^[A-Z]{3}$" validation-message="Exactly three uppercase letters." placeholder="ABC" />
</div>

Props

NameTypeDefaultDescription
modelValuestring | number''The field value (v-model).
typestring'text'Input kind. textnumberpasswordemailphonetextarea
placeholderstring''Placeholder text.
requiredbooleanfalseMarks the field required for validation.
disabledbooleanfalseDisables the field.
readonlybooleanfalseMakes the field read-only.
autocompletestringundefinedNative autocomplete hint.
minlengthnumberundefinedMinimum length.
maxlengthnumberundefinedMaximum length.
rowsnumber3Textarea rows.
resizestring'none'Textarea resize behaviour. noneverticalhorizontalboth
minHeightstringundefinedMinimum height (textarea).
maxHeightstringundefinedMaximum height (textarea).
minWidthstringundefinedMinimum width.
maxWidthstringundefinedMaximum width.
patternstringundefinedNative validation pattern.
showTogglebooleantrueShow the password visibility toggle.
minnumberundefinedMinimum value (number).
maxnumberundefinedMaximum value (number).
stepnumber1Step increment (number).
stepperLayoutstring'both-sides'Where the number steppers sit. stacked-leftstacked-rightboth-sidesnone
clearablebooleanfalseShow a clear button when there is a value.
iconLeftstringundefinedLeading MDI icon.
iconRightstringundefinedTrailing MDI icon.
validatebooleantrueEnable built-in validation.
validationPatternstringundefinedCustom validation pattern.
validationMessagestringundefinedMessage shown when validation fails.

Events

EventPayloadDescription
update:modelValuestring | numberEmitted on input; numbers are coerced for number type.
validation{ valid: boolean, error: string }Emitted when the validation state changes.

Slots

SlotDescription
leftCustom content in the left slot (overrides iconLeft).
rightCustom content in the right slot (overrides iconRight).