Skip to content

Input

Input component is the most fundamental form element, allowing users to enter and edit text content.

Basic Usage

Supports two-way binding via v-model and various type values such as text, password, email, number, etc.

Show Code
vue

<TInput placeholder="Enter text..."/>
<TInput type="password" placeholder="Enter password..."/>
<TInput type="number" placeholder="Enter a number..."/>
<TInput type="email" placeholder="email@example.com"/>

Use the size prop to control the input size: 'lg' (large), default (medium), 'sm' (small).

Show Code
vue

<TInput size="lg" placeholder="Large input"/>
<TInput placeholder="Default input"/>
<TInput size="sm" placeholder="Small input"/>

Style Variants

Two variants: rounded (pill shape) and flush (borderless).

Show Code
vue

<TInput rounded placeholder="Rounded input"/>
<TInput flush placeholder="Borderless input"/>
<TInput disabled placeholder="Disabled input"/>

With Icons

Use prepend-icon and append-icon props to add icons before or after the input. Icons come from @tabler/icons-vue.

Show Code
vue

<TInput :prepend-icon="IconSearch" placeholder="Search..."/>
<TInput type="password" :append-icon="IconUser" placeholder="Username"/>
<TInput :prepend-icon="IconMail" :append-icon="IconAt" placeholder="email@example.com"/>
<TInput :prepend-icon="IconSearch" placeholder="Search users..."/>

Input Groups

Use prepend-text / append-text to add text prefixes/suffixes, or use #prepend / #append slots for custom content like buttons.

Show Code
vue

<TInput prepend-text="https://" placeholder="your-domain.com"/>
<TInput append-text="¥" placeholder="Amount" type="number"/>
<TInput placeholder="Enter email">
  <template #prepend>
    <span class="input-group-text"><IconMail :size="18"/></span>
  </template>
  <template #append>
    <button class="btn btn-primary" type="button">Verify</button>
  </template>
</TInput>

Validation States

Use the validation prop to set validation state: 'valid' (green), 'invalid' (red). Pair with .valid-feedback / .invalid-feedback for messages.

Show Code
vue

<TInput validation="valid" placeholder="Correct input"/>
<div class="valid-feedback">Looks good!</div>

<TInput validation="invalid" placeholder="Wrong input"/>
<div class="invalid-feedback">Please check your input.</div>

Two-way Binding

Supports v-model with string and number types, implemented via defineModel().

Show Code
vue

<script setup lang="ts">
  import {ref} from 'vue'

  const value = ref('')
</script>
<template>
  <p>Current value: {{ value }}</p>
  <TInput v-model="value" placeholder="Try typing something..."/>
</template>

Labels & Hints

Use label, hint, required, and label-description props to quickly build complete form fields with labels and help text.

Show Code
vue

<TInput label="Email address" hint="We'll never share your email with anyone else." placeholder="email@example.com"/>

<TInput label="ZIP Code" label-description="Optional" required placeholder="Your ZIP Code" hint="ZIP Code must be US or CDN format."/>

<TInput placeholder="Enter content...">
  <template #label>Custom label <span class="badge bg-blue ms-1">NEW</span></template>
  <template #hint>Custom <a href="#">hint link</a></template>
</TInput>

TInput Props

PropDescriptionTypeDefault
typeNative input typestring'text'
placeholderPlaceholder textstringundefined
sizeInput size'sm' | 'lg'undefined
roundedPill/rounded stylebooleanfalse
flushBorderless stylebooleanfalse
disabledDisabled statebooleanfalse
readonlyReadonly statebooleanfalse
maxlengthMax character lengthnumberundefined
minlengthMin character lengthnumberundefined
nameNative name attributestringundefined
idNative id attributestringundefined
autocompleteAutocomplete hintstringundefined
requiredWhether requiredbooleanfalse
prepend-iconPrepend icon (Tabler icon component)Iconundefined
append-iconAppend icon (Tabler icon component)Iconundefined
prepend-textPrepend textstringundefined
append-textAppend textstringundefined
validationValidation state'valid' | 'invalid'undefined
blockFull width (w-100)booleanfalse
labelLabel textstringundefined
label-descriptionLabel description (e.g. char counter)stringundefined
hintHint text below inputstringundefined
wrapper-classOuter wrapper class (e.g. "mb-3")stringundefined

TInput Emits

EventDescriptionCallback
update:modelValueTriggered when input value changes(value: string | number) => void

TInput Slots

SlotDescription
prependPrepend content (replaces prepend-text), appears before <input>
appendAppend content (replaces append-text), appears after <input>
labelCustom label content (replaces label prop)
hintCustom hint content (replaces hint prop)