Formulários
VTagInput
Campo para adicionar, editar e remover tags com sugestões, validação e suporte a colar listas. Cada token é um `VTag` (`variant="soft"`, removível) — não um `VBadge`.
<script setup lang="ts">
import { VTagInput } 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 VTagInput.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.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref(['Design', 'UI'])
</script>
<template>
<VTagInput v-model="value" />
</template>With Suggestions
Variação Com Suggestions.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref(['vue'])
const suggestions = ['vue', 'vue3', 'vue-router', 'vuex', 'vueuse']
</script>
<template>
<VTagInput v-model="value" :suggestions="suggestions" />
</template>Readonly
Variação Somente leitura. Props: readonly=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref(['Vue', 'Components'])
</script>
<template>
<VTagInput v-model="value" readonly />
</template>Disabled
Variação Desabilitado. Props: disabled=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref(['Tag'])
</script>
<template>
<VTagInput v-model="value" disabled />
</template>Sizes
Variação Tamanhos.
Ver código
<script setup lang="ts">
import { VTagInput } from 'vueui-nova-kit'
</script>
<template>
<div style="display:flex;flex-direction:column;gap:16px;max-width:420px">
<VTagInput size="sm" :model-value="['Tag']" />
<VTagInput size="md" :model-value="['Tag']" />
<VTagInput size="lg" :model-value="['Tag']" />
</div>
</template>Interactive
Variação Interativo. Interativo: o estado é mantido na própria story (v-model).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const tags = ref([
'design',
'component',
'ui'
])
const suggestions = [
'vue',
'vue3',
'vue-router',
'vuex',
'vueuse',
'component',
'composable',
'configuration'
]
</script>
<template>
<VTagInput
v-model="tags"
:suggestions="suggestions"
placeholder="Add a tag…" />
</template>Max Tags
Variação Max Tags. Props: maxTags=3, placeholder="Máx. 3 tags".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref(['vue', 'ui'])
</script>
<template>
<VTagInput v-model="value" placeholder="Máx. 3 tags" :max-tags="3" />
</template>Delimiters
Variação Delimiters. Props: placeholder="Enter, vírgula ou Tab".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref([])
const delimiters = ['enter', 'comma', 'tab']
</script>
<template>
<VTagInput
v-model="value"
placeholder="Enter, vírgula ou Tab"
:delimiters="delimiters" />
</template>Allow Duplicates
Variação Allow Duplicates. Props: allowDuplicates=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref(['vue', 'vue'])
</script>
<template>
<VTagInput v-model="value" allow-duplicates />
</template>Validate Tag
Variação Validate Tag. Props: placeholder="Somente e-mails".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref(['a@b.com'])
</script>
<template>
<VTagInput v-model="value" placeholder="Somente e-mails" />
</template>Empty Text
Variação Vazio texto. Props: readonly=true, emptyText="Nenhuma tag".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref([])
</script>
<template>
<VTagInput v-model="value" readonly empty-text="Nenhuma tag" />
</template>Closable
Variação Closable. Props: closable=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref(['vue', 'storybook'])
</script>
<template>
<VTagInput v-model="value" />
</template>Multiline
Variação Multiline. Props: multiline=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VTagInput } from 'vueui-nova-kit'
const value = ref([
'um',
'dois',
'três',
'quatro',
'cinco',
'seis',
'sete',
'oito',
])
</script>
<template>
<VTagInput v-model="value" multiline />
</template>Acessibilidade
Combobox com aria-expanded, remove com aria-label, aria-live para adições/remoções, navegação por teclado.
Estados
Empty · Typing · Focus · Hover tag · Selected suggestion · Disabled · Read-only.
Motion
| Trigger | Property | Duration | Easing |
|---|---|---|---|
| Chip add | transform/opacity | 150ms | ease-out |
| Chip remove | transform/opacity | 120ms | ease-out |
| Suggestions | translateY/opacity | 200ms | 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[] | [] | — |
suggestions | string[] | [] | — |
placeholder | string | "Add a tag…" | — |
ariaLabel | string | — | Nome acessível do campo (padrão: o placeholder ou "Tags") |
disabled | boolean | false | — |
readonly | boolean | false | — |
closable | boolean | true | — |
multiline | boolean | false | — |
maxTags | number | — | — |
delimiters | VTagInputDelimiter[] | ['enter', 'comma'] | — |
allowDuplicates | boolean | false | — |
validateTag | (tag: string) => boolean | — | — |
id | string | — | — |
size | VTagInputSize | "md" | — |
emptyText | string | "No tags yet." | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:modelValue | value: string[] | — |
@add | tag: string | — |
@remove | tag: string | — |
@focus | payload: FocusEvent | — |
@blur | payload: FocusEvent | — |
Slots
Sem slots.
Fonte: src/components/form/VTagInput/VTagInput.vue · tipos: src/components/form/VTagInput/VTagInput.types.ts