Seleção e menus
VSelect
Campo de seleção single-choice com label, placeholder, ícone opcional, validação e menu suspenso acessível.
<script setup lang="ts">
import { VSelect } 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 VSelect.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: modelValue="product", label="Product".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSelect } from 'vueui-nova-kit'
const value = ref('product')
const options = [
{ value: 'product', label: 'Product' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'development', label: 'Development' },
{ value: 'design', label: 'Design' },
{ value: 'human-resources', label: 'Human Resources' },
]
</script>
<template>
<VSelect v-model="value" label="Product" :options="options" />
</template>With Icon
Variação Com ícone. Props: label="Category", placeholder="All categories", leadingIcon="layers".
Ver código
<script setup lang="ts">
import { VSelect } from 'vueui-nova-kit'
const options = [
{ value: 'product', label: 'Product' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'development', label: 'Development' },
{ value: 'design', label: 'Design' },
{ value: 'human-resources', label: 'Human Resources' },
]
</script>
<template>
<VSelect
v-model="value"
label="Category"
placeholder="All categories"
:options="options"
leading-icon="layers" />
</template>Sizes
Variação Tamanhos.
Ver código
<script setup lang="ts">
import { VSelect } from 'vueui-nova-kit'
</script>
<template>
<div style="display:flex;flex-direction:column;gap:16px;max-width:420px">
<VSelect size="sm" label="Small" model-value="product" />
<VSelect size="md" label="Medium" model-value="product" />
<VSelect size="lg" label="Large" model-value="product" />
</div>
</template>Error
Variação Erro. Props: label="Product", modelValue="product", errorMessage="Please choose a valid optio…".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSelect } from 'vueui-nova-kit'
const value = ref('product')
const options = [
{ value: 'product', label: 'Product' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'development', label: 'Development' },
{ value: 'design', label: 'Design' },
{ value: 'human-resources', label: 'Human Resources' },
]
</script>
<template>
<VSelect
v-model="value"
label="Product"
:options="options"
error-message="Please choose a valid option." />
</template>Disabled
Variação Desabilitado. Props: label="Product", modelValue="product", disabled=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSelect } from 'vueui-nova-kit'
const value = ref('product')
const options = [
{ value: 'product', label: 'Product' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'development', label: 'Development' },
{ value: 'design', label: 'Design' },
{ value: 'human-resources', label: 'Human Resources' },
]
</script>
<template>
<VSelect v-model="value" label="Product" :options="options" disabled />
</template>Open
Variação Aberto. Interativo: o estado é mantido na própria story (v-model). Inclui interação automatizada (play).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSelect } from 'vueui-nova-kit'
const value = ref('product')
const open = ref(true)
const options = [
{
value: 'product',
label: 'Product'
},
{
value: 'marketing',
label: 'Marketing'
},
{
value: 'development',
label: 'Development'
},
{
value: 'design',
label: 'Design'
},
{
value: 'human-resources',
label: 'Human Resources'
}
]
</script>
<template>
<VSelect
v-model="value"
label="Product"
:options="options"
@open-change="open = $event" />
</template>Clearable
Variação Limpável. Interativo: permite selecionar e limpar a seleção com o botão de limpeza (clearable).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSelect } from 'vueui-nova-kit'
const value = ref('product')
const options = [
{
value: 'product',
label: 'Product'
},
{
value: 'marketing',
label: 'Marketing'
},
{
value: 'development',
label: 'Development'
},
{
value: 'design',
label: 'Design'
},
{
value: 'human-resources',
label: 'Human Resources'
}
]
</script>
<template>
<VSelect
v-model="value"
label="Product"
:options="options"
clearable />
</template>Inside Overflow Hidden
Variação Dentro de container com overflow hidden. O container tem 160px de altura e overflow: hidden; o painel aberto deve aparecer inteiro, fora do container. Interativo (play abre o painel).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSelect } from 'vueui-nova-kit'
const value = ref('product')
const options = [
{
value: 'product',
label: 'Product'
},
{
value: 'marketing',
label: 'Marketing'
},
{
value: 'development',
label: 'Development'
},
{
value: 'design',
label: 'Design'
},
{
value: 'human-resources',
label: 'Human Resources'
}
]
</script>
<template>
<div data-test-id="overflow-hidden-container" style="height:160px;overflow:hidden;padding:8px;border:1px dashed var(--v-color-border);border-radius:8px;box-sizing:border-box;">
<VSelect v-model="value" label="Product" :options="options" />
</div>
</template>Near Viewport Bottom
Variação Perto da borda inferior. O campo fica no fim de uma área de 100vh; sem espaço abaixo, o painel inverte para cima (data-placement="top-start"). Interativo (play abre o painel).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSelect } from 'vueui-nova-kit'
const value = ref('product')
const options = [
{
value: 'product',
label: 'Product'
},
{
value: 'marketing',
label: 'Marketing'
},
{
value: 'development',
label: 'Development'
},
{
value: 'design',
label: 'Design'
},
{
value: 'human-resources',
label: 'Human Resources'
}
]
</script>
<template>
<div data-test-id="near-bottom-container" style="height:100vh;display:flex;flex-direction:column;justify-content:flex-end;">
<VSelect v-model="value" label="Product" :options="options" />
</div>
</template>In Scroll Container
Variação Em container com scroll. O campo fica no meio de uma área rolável de 200px. Ao abrir e rolar o container, o painel acompanha o trigger. Interativo (play abre o painel).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VSelect } from 'vueui-nova-kit'
const value = ref('product')
const options = [
{
value: 'product',
label: 'Product'
},
{
value: 'marketing',
label: 'Marketing'
},
{
value: 'development',
label: 'Development'
},
{
value: 'design',
label: 'Design'
},
{
value: 'human-resources',
label: 'Human Resources'
}
]
</script>
<template>
<div data-test-id="scroll-container" style="height:200px;overflow:auto;padding:8px;box-sizing:border-box;border:1px solid var(--v-color-border);border-radius:8px;">
<div style="height:240px;"></div>
<VSelect v-model="value" label="Product" :options="options" />
<div style="height:240px;"></div>
</div>
</template>Acessibilidade
Combobox/listbox com aria-expanded, aria-controls, aria-selected, aria-invalid e aria-describedby para erros. Teclado: Tab, ↑/↓, Enter, Esc. Label via for/id ou aria-label.
Estados
Default · Hover · Focus · Open · Selected · Error · Disabled.
Motion
| Trigger | Property | Duration | Easing |
|---|---|---|---|
| Hover | border-color/background | 120ms | ease-out |
| Focus ring | box-shadow/transform | 120ms | ease-out |
| Open | chevron rotate + panel fade/slide | 160ms | standard |
| Option hover | background | 100ms | ease-out |
| Check reveal | opacity/transform | 120ms | 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 | "" | — |
options | VSelectOption[] | — | — |
label | string | — | — |
placeholder | string | "Select option" | — |
disabled | boolean | false | — |
errorMessage | string | — | — |
leadingIcon | string | — | — |
size | VSelectSize | "md" | — |
clearable | boolean | — | — |
clearValue | string | — | — |
id | string | — | — |
motion | VMotionLevel | V_MOTION_DEFAULT ("expressive") | — |
teleport | boolean | true | Renderiza o painel em document.body (fixed + flip). Default true. |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:modelValue | value: string | — |
@open-change | value: boolean | — |
@change | value: string | — |
@clear | — | — |
Slots
| Slot | Props do slot |
|---|---|
#leading-icon | — |
Fonte: src/components/form/VSelect/VSelect.vue · tipos: src/components/form/VSelect/VSelect.types.ts