<template> <AcceleratorPopover :on-confirm="onConfirmAsync" :close-on-confirm="false"> <template #trigger> <AcceleratorButton>Don't close on confirm</AcceleratorButton> </template> <template #content> <p>This popover will not close after successful confirmation</p> </template> </AcceleratorPopover></template><script setup lang="ts">async function onConfirmAsync() { await Promise.resolve(); console.log('Popover confirmed');}</script>
The popover will not close on error by default
<template> <AcceleratorPopover :on-confirm="onConfirmAsyncError"> <template #trigger> <AcceleratorButton>Don't close on error</AcceleratorButton> </template> <template #content> <p>This popover will not close after error</p> </template> </AcceleratorPopover></template><script setup lang="ts">async function onConfirmAsyncError() { throw new Error('Example confirmation error');}</script>
<AcceleratorPopover direction="bottom" close-when-trigger-offscreen> <template #trigger> <AcceleratorButton>Will close if trigger is offscreen</AcceleratorButton> </template> <template #content> <p>This popover will close if the trigger is offscreen</p> </template></AcceleratorPopover>
<AcceleratorPopover direction="bottom" align-with-cursor-x> <template #trigger> <AcceleratorButton>Align with cursor x</AcceleratorButton> </template> <template #content> <p>As close as possible to the cursor</p> </template></AcceleratorPopover>
<div class="popover-preview-col"> <AcceleratorPopover> <template #trigger> <AcceleratorTooltip> <template #trigger> <AcceleratorButton>Inner popover</AcceleratorButton> </template> <template #content> <p>This is the tooltip popover</p> </template> </AcceleratorTooltip> </template> <template #content> <AcceleratorButton>This is the Tooltip popover</AcceleratorButton> </template> </AcceleratorPopover></div>
Props
closeOnOutsideClick:boolean— optional
default:true
Closes the popover on outside click. Set to false to keep this popover and its parent overlays open.
direction:AccPopoverDirection— optional
default:bottom
The direction the popover should appear relative to the trigger. Includes top, bottom, left, right, corner placements, and start/end aligned placements. left-start and right-start align the popover top with the trigger top; left-end and right-end align their bottom edges.
onConfirm:function— optional
default:undefined
Callback function to be executed when the confirm AcceleratorButton is clicked.
onClose:function— optional
default:undefined
Callback function to be executed when the popover is closed.
disableConfirm:boolean— optional
default:false
Disables the confirm button.
closeOnConfirm:boolean— optional
default:true
Closes the popover when the confirm AcceleratorButton is clicked.
awaitOnConfirm:boolean— optional
default:true
Whether to await the onConfirm promise before closing the popover.
resize:boolean— optional
default:true
Whether the popover should resize when the window is resized.
closeWhenTriggerOffscreen:boolean— optional
default:false
Whether the popover should close when the trigger is scrolled offscreen.
matchTriggerWidth:boolean— optional
default:false
Whether the popover should match the width of the trigger.
alignWithCursorX:boolean— optional
default:false
Whether the popover should align with the cursor x position.
disableTrigger:boolean— optional
default:false
Disables the trigger element.
preserveContent:boolean— optional
default:false
Whether the popover should preserve its content when closed.
gap:number— optional
default:8
The gap between the trigger and the popover.
popoverClass:string— optional
default:undefined
Custom CSS class to apply to the popover content container.
Bindings
v-model:open:boolean
Controls whether the popover is open.
Emits
@update:open
Emitted when the popover open state changes.
Slots
The popover component provides the following slots for customization.
#trigger
The element that triggers the popover on click. This is typically a button.