Overlays
Layout
Popover
A floating panel anchored to a trigger element. Use it for short forms, pickers or extra detail.
Install
import { Popover } from 'vael-ui'Playground
bottom
center
Usage
<script setup lang="ts">
import { ref } from 'vue'
import { Popover, Button } from 'vael-ui'
const open = ref(false)
</script>
<template>
<Popover v-model:open="open" open-on-trigger-click>
<template #trigger>
<Button>Trigger</Button>
</template>
Popover
</Popover>
</template>Motion New
Popover's motion: values or hooks for positioner and panel, how it opens and closes (morph, surface, resize) and swapped content. false turns it off.
<Popover
:motion="{
initial: { panel: { opacity: 0, y: 8, scale: 0.98 } },
spring: { damping: 0.85, response: 0.35 },
}"
/>| Name | Type | Description |
|---|---|---|
initialexit | positionerpanel | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
morphlinkedexitOrder | 'trigger' | Record<string, LinkedMotion> | 'reverse' | morph: 'trigger' grows it out of the element that opened it. linked moves other elements with it, such as the page receding behind it. exitOrder: 'reverse' closes its children first. |
swapresize | 'sync' | 'wait' | boolean | Content that changes while it's open crossfades ('sync') or waits for the old view to leave ('wait'), and the box eases to its new size unless resize: false. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
| Key | Action |
|---|---|
| Escape | Closes the popover, unless closeOnEsc is false. |
| Tab | Moves focus from the trigger into the panel; past the last element, it closes the panel and moves to the element after the trigger. |
| ShiftTab | Moves focus from the first element in the panel back to the trigger and closes the panel. |
- The panel has no role and isn’t a focus trap. For interactive content, pass
role="dialog"and anaria-label; attributes go on the panel. - A button in the
#triggerslot getsaria-expanded, andaria-controlswhile open. A trigger passed withtriggerElgets neither. - Opening doesn’t move focus. If focus is in the panel when it closes, it returns to the trigger.
- Moving focus outside the panel closes it, unless
closeOnOutsideisfalse.