Formulários
VTextInput
Campo de texto de linha única para formulários e busca, com label, helper, erro, ícone, prefixo/sufixo e clear.
<script setup lang="ts">
import { VTextInput } from 'vueui-nova-kit'
</script>Uso
<script setup lang="ts">
</script>
<template>
</template>Playground
Os controles abaixo são gerados a partir das props declaradas em VTextInput.types.ts; o código acompanha cada mudança.
Exemplos
Variantes, tamanhos e estados, extraídos das stories da biblioteca.
Default
Variação Padrão. Estado padrão do componente; use a aba Controls para experimentar as props ao vivo. Props: label="Label", placeholder="Enter text".
Ver código
<script setup lang="ts">
import { VTextInput } from 'vueui-nova-kit'
</script>
<template>
<VTextInput v-model="value" placeholder="Enter text" label="Label" />
</template>With Icon
Variação Com ícone. Props: label="Search", placeholder="Search products...", leadingIcon="search", clearable=true, helperText="Find products, documentatio…".
Ver código
<script setup lang="ts">
import { VTextInput } from 'vueui-nova-kit'
</script>
<template>
<VTextInput
v-model="value"
placeholder="Search products..."
label="Search"
leading-icon="search"
clearable
helper-text="Find products, documentation, and more…" />
</template>With Prefix Suffix
Variação Com Prefix Suffix. Props: label="Amount", modelValue="0.00", prefix="$", suffix="USD", placeholder="0.00".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTextInput } from 'vueui-nova-kit'
const value = ref('0.00')
</script>
<template>
<VTextInput
v-model="value"
placeholder="0.00"
label="Amount"
prefix="$"
suffix="USD" />
</template>Error
Variação Erro. Props: label="Email address", modelValue="invalid", leadingIcon="mail", errorMessage="Please enter a valid email …".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTextInput } from 'vueui-nova-kit'
const value = ref('invalid')
</script>
<template>
<VTextInput
v-model="value"
placeholder="Enter text"
label="Email address"
leading-icon="mail"
error-message="Please enter a valid email address." />
</template>Disabled
Variação Desabilitado. Props: label="Disabled input", modelValue="Cannot edit", disabled=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTextInput } from 'vueui-nova-kit'
const value = ref('Cannot edit')
</script>
<template>
<VTextInput
v-model="value"
placeholder="Enter text"
label="Disabled input"
disabled />
</template>Sizes
Variação Tamanhos.
Ver código
<script setup lang="ts">
import { VTextInput } from 'vueui-nova-kit'
</script>
<template>
<div style="display:flex;flex-direction:column;gap:16px;max-width:420px">
<VTextInput size="sm" label="Small" placeholder="Small input" />
<VTextInput size="md" label="Medium" placeholder="Medium input" />
<VTextInput size="lg" label="Large" placeholder="Large input" />
</div>
</template>Clearable
Variação Limpável. Interativo: o estado é mantido na própria story (v-model).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTextInput } from 'vueui-nova-kit'
const search = ref('Product')
</script>
<template>
<VTextInput
v-model="search"
label="Search"
placeholder="Search products..."
leading-icon="search"
clearable
helper-text="Use clearable for search inputs to help users quickly reset their input." />
</template>Success Message
Variação Sucesso Message. Props: label="Usuário", modelValue="walder", successMessage="Nome disponível".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTextInput } from 'vueui-nova-kit'
const value = ref('walder')
</script>
<template>
<VTextInput
v-model="value"
placeholder="Enter text"
label="Usuário"
success-message="Nome disponível" />
</template>Readonly Required
Variação Somente leitura obrigatório. Props: label="ID", modelValue="ABC-123", readonly=true, required=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTextInput } from 'vueui-nova-kit'
const value = ref('ABC-123')
</script>
<template>
<VTextInput
v-model="value"
placeholder="Enter text"
label="ID"
readonly
required />
</template>Type Email
Variação Type Email. Props: label="E-mail", type="email", placeholder="voce@empresa.com".
Ver código
<script setup lang="ts">
import { VTextInput } from 'vueui-nova-kit'
</script>
<template>
<VTextInput
v-model="value"
placeholder="voce@empresa.com"
label="E-mail"
type="email" />
</template>Type Url Tel
Variação Type Url Tel. Props: label="Site", type="url", placeholder="https://".
Ver código
<script setup lang="ts">
import { VTextInput } from 'vueui-nova-kit'
</script>
<template>
<VTextInput
v-model="value"
placeholder="https://"
label="Site"
type="url" />
</template>Acessibilidade
Label associado via for/id, aria-describedby para helper/erro/sucesso, aria-invalid no erro, clear focável com aria-label, ícones decorativos com aria-hidden, suporte a autocomplete/name/type.
Estados
Default · Hover · Focus-visible · Filled · Invalid · Success · Disabled · Readonly.
Motion
| Trigger | Property | Duration | Easing |
|---|---|---|---|
| Focus ring | border-color/box-shadow/transform | 100ms | ease-out |
| Placeholder → value | placeholder opacity | 100ms | ease-out |
| Clear reveal | opacity/scale | 100ms | ease-out |
Respeitar prefers-reduced-motion.
Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.
Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
modelValue | string | "" | — |
label | string | — | — |
helperText | string | — | — |
errorMessage | string | — | — |
successMessage | string | — | — |
placeholder | string | — | — |
disabled | boolean | false | — |
readonly | boolean | false | — |
required | boolean | false | — |
size | VTextInputSize | "md" | — |
clearable | boolean | false | — |
clearLabel | string | — | — |
leadingIcon | string | — | — |
prefix | string | — | — |
suffix | string | — | — |
name | string | — | — |
id | string | — | — |
autocomplete | string | — | — |
type | VTextInputType | "text" | — |
spellcheck | boolean | — | — |
autocapitalize | 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters' | — | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:modelValue | value: string | — |
@clear | — | — |
@focus | payload: FocusEvent | — |
@blur | payload: FocusEvent | — |
Slots
| Slot | Props do slot |
|---|---|
#leading-icon | — |
Fonte: src/components/form/VTextInput/VTextInput.vue · tipos: src/components/form/VTextInput/VTextInput.types.ts