Popover

Displays a popover that appears when clicking on an element.

Install

Run the following command to install the popover component:

npx acc-nuxt add Popover

Directions

Top

Bottom

Left

Top Left

Top Right

Bottom Left

Bottom Right

Top Start

Top End

Bottom Start

Bottom End

Side Alignments

Use left-start and right-start to align the popover's top edge with the trigger. The -end variants align their bottom edges.

Controller and Confirm

onConfirm

onConfirm no async

onClose

disableConfirm

Do not close on confirm

The popover will not close on error by default

Behavior

Custom styles

closeWhenTriggerOffscreen

matchTriggerWidth

alignWithCursorX

disableTrigger

preserveContent

controlled

Add popover on async with default open state as true

Nested popover

Tooltip popover

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.
#content
The main content displayed inside the popover.
#footer="{ confirm, close, isLoadingConfirm, isDisabledConfirm }"
Slot for customizing the popover footer. Receives confirm and close functions, along with loading and disabled states.
#popoverClose
Slot for customizing the close button text or content in the default footer.
#popoverConfirm
Slot for customizing the confirm button text or content in the default footer.

CSS Variables

The popover component can be customized using the following CSS variables.

--lev-popover-bg
default:#ffffff
Background color of the popover.
--lev-popover-color
default:#141414
Text color of the popover content.
--lev-popover-border
default:1px solid #c3c6c7
Border style of the popover.
--lev-popover-shadow
default:0 3px 6px 0 rgba(0, 0, 0, 0.08)
Box shadow applied to the popover.
--lev-popover-padding
default:8px
Padding inside the popover content.
--lev-popover-border-radius
default:4px
Border radius of the popover corners.
--lev-popover-z-index
default:1100
Z-index of standalone popovers to control stacking order. Popovers inside modals use the modal layer automatically.
--lev-popover-min-width
default:200px
Minimum width of the popover.