Formulários
VSearchField
Campo de busca com ícone, clear, atalho ⌘K, sugestões e loading.
<script setup lang="ts">
import { VSearchField } 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 VSearchField.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="Search", placeholder="Search for anything...".
Ver código
<script setup lang="ts">
import { VSearchField } from 'vueui-nova-kit'
</script>
<template>
<VSearchField
v-model="value"
placeholder="Search for anything..."
label="Search" />
</template>With Shortcut
Variação Com Shortcut. Props: variant="shortcut", shortcut=true, placeholder="Search or jump to...".
Ver código
<script setup lang="ts">
import { VSearchField } from 'vueui-nova-kit'
</script>
<template>
<VSearchField
v-model="value"
placeholder="Search or jump to..."
variant="shortcut"
shortcut />
</template>Command
Variação Command. Props: variant="command", shortcut=true, placeholder="Type a command or search...".
Ver código
<script setup lang="ts">
import { VSearchField } from 'vueui-nova-kit'
</script>
<template>
<VSearchField
v-model="value"
placeholder="Type a command or search..."
variant="command"
shortcut />
</template>With Suggestions
Variação Com Suggestions. Interativo: o estado é mantido na própria story (v-model).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSearchField } from 'vueui-nova-kit'
const query = ref('Vue')
const suggestions = [
{
value: 'vue',
label: 'vue',
category: 'Search suggestion'
},
{
value: 'Vue components',
label: 'Vue components',
category: 'Documentation'
},
{
value: 'vue-router',
label: 'vue-router',
category: 'Package'
},
{
value: 'Vue CLI',
label: 'Vue CLI',
category: 'Command'
}
]
</script>
<template>
<VSearchField
v-model="query"
label="Search"
placeholder="Search products, docs, or anything..."
:suggestions="suggestions" />
</template>Loading
Variação Carregando. Props: label="Search", modelValue="Vue", loading=true, placeholder="Searching...".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSearchField } from 'vueui-nova-kit'
const value = ref('Vue')
</script>
<template>
<VSearchField
v-model="value"
placeholder="Searching..."
label="Search"
loading />
</template>Disabled
Variação Desabilitado. Props: label="Search", placeholder="Search for anything...", disabled=true.
Ver código
<script setup lang="ts">
import { VSearchField } from 'vueui-nova-kit'
</script>
<template>
<VSearchField
v-model="value"
placeholder="Search for anything..."
label="Search"
disabled />
</template>Sizes
Variação Tamanhos.
Ver código
<script setup lang="ts">
import { VSearchField } from 'vueui-nova-kit'
</script>
<template>
<div style="display:flex;flex-direction:column;gap:16px;max-width:480px">
<VSearchField size="sm" label="Small" placeholder="Search..." />
<VSearchField size="md" label="Medium" placeholder="Search..." />
<VSearchField size="lg" label="Large" placeholder="Search..." />
</div>
</template>Custom Shortcut Keys
Variação Personalizado Shortcut Keys. Props: variant="shortcut", shortcut=true, shortcutKeys="Ctrl K".
Ver código
<script setup lang="ts">
import { VSearchField } from 'vueui-nova-kit'
</script>
<template>
<VSearchField
v-model="value"
placeholder="Search products, docs, or anything..."
variant="shortcut"
shortcut
shortcut-keys="Ctrl K" />
</template>Acessibilidade
Checklist literal ("Accessibility — Inclusive by design"):
- Minimum hit target — 44 × 44px.
- Labelled with accessible name — aria-label or
<label>. - Keyboard navigation — Tab, Esc to close.
- Clear action announced — aria-label="Clear search".
- Suggestions use listbox — role="listbox" + aria-activedescendant.
- Focus visible — Clear focus indicator.
- High contrast support — Validated (WCAG AA).
- Disabled state — aria-disabled="true".
Estados
Default · Hover · Focus · Typing · With value · Suggestions open · Loading · Disabled.
Motion
Hover 120ms · focus ring 120ms · painel fade+slide 160ms · clear fade/scale 100ms.
Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.
Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
modelValue | string | "" | — |
label | string | — | — |
placeholder | string | — | — |
disabled | boolean | false | — |
loading | boolean | false | — |
size | VSearchFieldSize | "md" | — |
variant | VSearchFieldVariant | — | — |
shortcut | boolean | false | — |
shortcutKeys | string | — | — |
clearable | boolean | true | — |
clearLabel | string | — | — |
suggestions | VSearchFieldSuggestion[] | [] | — |
name | string | — | — |
id | string | — | — |
autocomplete | string | — | — |
ariaLabel | string | — | — |
inputTestId | string | — | data-test-id do <input> (padrão 'v-searchfield-input'). |
clearTestId | string | — | data-test-id do botão limpar (padrão 'v-searchfield-clear'). |
shortcutTestId | string | — | data-test-id do atalho (padrão 'v-searchfield-shortcut'). |
extraInputAttrs | Record<string, unknown> | — | Atributos extras aplicados ao <input> por último (aria-*, class, data-test-id, value...). Retrocompatível: ausente = sem efeito. |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:modelValue | value: string | — |
@clear | — | — |
@search | value: string | — |
@select | suggestion: import('./VSearchField.types').VSearchFieldSuggestion | — |
@focus | payload: FocusEvent | — |
@blur | payload: FocusEvent | — |
@shortcut | — | — |
Slots
| Slot | Props do slot |
|---|---|
#icon | — |
Fonte: src/components/form/VSearchField/VSearchField.vue · tipos: src/components/form/VSearchField/VSearchField.types.ts