Introducing PrimeReact v11-alpha 🎉Discover Now

Popover

Popover is an overlay container that displays content relative to a trigger.

Installation#

npx shadcn@latest add @primereact/popover

Usage#

import { Popover, PopoverArrow, PopoverClose, PopoverContent, PopoverDescription, PopoverFooter, PopoverHeader, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverTitle, PopoverTrigger } from '@/components/ui/popover';
<Popover>
    <PopoverTrigger>Trigger</PopoverTrigger>
    <PopoverPortal>
        <PopoverPositioner>
            <PopoverPopup>
                <PopoverArrow />
                <PopoverHeader>
                    <PopoverTitle>Title</PopoverTitle>
                    <PopoverClose />
                </PopoverHeader>
                <PopoverContent>
                    <PopoverDescription>Description</PopoverDescription>
                </PopoverContent>
                <PopoverFooter />
            </PopoverPopup>
        </PopoverPositioner>
    </PopoverPortal>
</Popover>

Examples#

Basic#

Contextual content anchored to a trigger element.

basic-demo

Controlled#

Control popover state from outside with the open and onOpenChange props.

controlled-demo

Alignment#

Use side and align to control placement. Use sideOffset and alignOffset to fine-tune spacing.

alignment-demo

Accessibility#

Use labelled and described content with aria-labelledby and aria-describedby, and enable closeOnEscape for keyboard users.

accessibility-demo

API#

Sub-Components#

See Primitive API for PopoverRoot, PopoverTrigger, PopoverPortal, PopoverPositioner, PopoverPopup, PopoverArrow, PopoverHeader, PopoverTitle, PopoverClose, PopoverContent, PopoverDescription, PopoverFooter component documentation.

Hooks#

See Headless API for usePopover hook documentation.

Accessibility#

Accessibility#

See Popover Primitive for WAI-ARIA compliance details and keyboard support.