Overlays
VPopover
Superfície flutuante contextual ancorada a um trigger — informação rápida, ações ou formulários sem sair da página.
<script setup lang="ts">
import { VPopover } 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 VPopover.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. Slots usados: #trigger.
Ver código
<script setup lang="ts">
import { VPopover, VButton } from 'vueui-nova-kit'
const args = {
size: 'md',
placement: 'bottom',
trigger: 'click',
closable: true,
showArrow: true,
title: 'Quick tip'
}
</script>
<template>
<div style="padding:80px;display:flex;justify-content:center">
<VPopover v-bind="args">
<template #trigger>
<VButton variant="primary">Show popover</VButton>
</template>
<p style="margin:0 0 16px;font-size:14px;color:var(--v-color-text-muted)">
Popovers are perfect for short, contextual content, actions, or forms.
</p>
<div style="display:flex;justify-content:flex-end;gap:8px">
<VButton variant="ghost">Learn more</VButton>
<VButton variant="primary">Got it</VButton>
</div>
</VPopover>
</div>
</template>Hover
Variação Hover. Props: trigger="hover", placement="top". Slots usados: #trigger.
Ver código
<script setup lang="ts">
import { VPopover, VButton } from 'vueui-nova-kit'
const args = {
size: 'md',
placement: 'top',
trigger: 'hover',
closable: true,
showArrow: true,
title: 'Quick tip'
}
</script>
<template>
<div style="padding:80px;display:flex;justify-content:center">
<VPopover v-bind="args">
<template #trigger><VButton variant="secondary">Hover me</VButton></template>
<p style="margin:0">Hover trigger opens the popover.</p>
</VPopover>
</div>
</template>Sizes
Variação Tamanhos. Slots usados: #trigger.
Ver código
<script setup lang="ts">
import { VPopover, VButton } from 'vueui-nova-kit'
</script>
<template>
<div style="padding:80px;display:flex;gap:24px;justify-content:center;flex-wrap:wrap">
<VPopover size="sm" title="Small"><template #trigger><VButton size="sm">Small</VButton></template><p style="margin:0">Compact popover.</p></VPopover>
<VPopover size="md" title="Medium"><template #trigger><VButton>Medium</VButton></template><p style="margin:0">Default popover.</p></VPopover>
<VPopover size="lg" title="Large"><template #trigger><VButton size="lg">Large</VButton></template><p style="margin:0">Spacious popover.</p></VPopover>
</div>
</template>Placements
Variação Placements. Slots usados: #trigger.
Ver código
<script setup lang="ts">
import { VPopover, VButton } from 'vueui-nova-kit'
</script>
<template>
<div style="padding:120px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:48px;justify-items:center">
<VPopover placement="top" title="Top"><template #trigger><VButton variant="secondary">Top</VButton></template><p style="margin:0">Placement top.</p></VPopover>
<VPopover placement="bottom" title="Bottom"><template #trigger><VButton variant="secondary">Bottom</VButton></template><p style="margin:0">Placement bottom.</p></VPopover>
<VPopover placement="left" title="Left"><template #trigger><VButton variant="secondary">Left</VButton></template><p style="margin:0">Placement left.</p></VPopover>
<VPopover placement="right" title="Right"><template #trigger><VButton variant="secondary">Right</VButton></template><p style="margin:0">Placement right.</p></VPopover>
</div>
</template>Disabled
Variação Desabilitado. Props: disabled=true. Slots usados: #trigger.
Ver código
<script setup lang="ts">
import { VPopover, VButton } from 'vueui-nova-kit'
const args = {
size: 'md',
placement: 'bottom',
trigger: 'click',
closable: true,
showArrow: true,
title: 'Quick tip',
disabled: true
}
</script>
<template>
<div style="padding:80px;display:flex;justify-content:center">
<VPopover v-bind="args">
<template #trigger><VButton disabled>Show popover</VButton></template>
<p style="margin:0">Should not open.</p>
</VPopover>
</div>
</template>Aria Labelledby
Variação Aria Labelledby. Props: title="Rotulado por aria-labelledby", ariaLabelledby="popover-title".
Ver código
<script setup lang="ts">
import { VPopover } from 'vueui-nova-kit'
</script>
<template>
<VPopover
v-model="value"
title="Rotulado por aria-labelledby"
aria-labelledby="popover-title" />
</template>Controlled Open
Abertura controlada com v-model:open ligado a um ref.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VPopover, VButton } from 'vueui-nova-kit'
const args = {
size: 'md',
placement: 'bottom',
trigger: 'click',
closable: true,
showArrow: true,
title: 'Quick tip'
}
const open = ref(false)
</script>
<template>
<div style="display:grid;gap:12px;padding:8px 0 140px"><VPopover v-bind="args" v-model:open="open"><template #trigger><VButton variant="secondary">Gatilho</VButton></template>Conteúdo do popover</VPopover><code>open = {{ open }}</code><VButton variant="outline" @click="open = !open">Alternar por código</VButton></div>
</template>Acessibilidade
role="dialog" no painel; trigger com aria-haspopup="dialog" e aria-expanded; suporte a aria-labelledby/aria-describedby; Esc fecha; foco entra no painel e retorna ao trigger; click fora fecha.
Estados
Closed · Hover trigger · Focus trigger · Open (chevron/trigger ativo + painel visível) · Pressed action · Disabled.
Motion
| Trigger | Property | Duration | Easing |
|---|---|---|---|
| Open | opacity/scale | 160ms | ease-out |
| Close | opacity/scale | 160ms | ease-out |
| Trigger hover/focus | background/outline | 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 |
|---|---|---|---|
open | boolean | — | — |
modelValue | boolean | — | — |
disabled | boolean | false | — |
size | VPopoverSize | "md" | — |
placement | VPopoverPlacement | "bottom" | — |
trigger | VPopoverTrigger | "click" | — |
closable | boolean | true | — |
showArrow | boolean | true | — |
title | string | — | — |
ariaLabel | string | — | — |
ariaLabelledby | string | — | — |
ariaDescribedby | string | — | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:open | value: boolean | — |
@update:modelValue | value: boolean | — |
@open-change | value: boolean | — |
@close | reason: VPopoverCloseReason | — |
@dismiss | reason: Exclude<VPopoverCloseReason, 'close'> | — |
Slots
| Slot | Props do slot |
|---|---|
#trigger | — |
#header | — |
#default | — |
#footer | — |
#actions | — |
Fonte: src/components/navigation/VPopover/VPopover.vue · tipos: src/components/navigation/VPopover/VPopover.types.ts