UI.MD

Popover

A floating panel anchored to a trigger element.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/popover.json

Usage

import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover"

Examples

Default

API Reference

PropTypeDefaultDescription
openPopoverboolean-Controlled open state. Use with onOpenChange.
onOpenChangePopover(open: boolean) => void-Called when the open state changes.
modalPopoverbooleanfalseWhen true, blocks interaction with outside elements while the popover is open.
sidePopoverContent"top" | "right" | "bottom" | "left""bottom"Preferred edge of the trigger to render against.
alignPopoverContent"start" | "center" | "end""center"Alignment against the trigger along the chosen side.
sideOffsetPopoverContentnumber4Distance in pixels between the popover and the trigger.
collisionAvoidancePopoverContentCollisionAvoidance{ fallbackAxisSide: "end" }Object controlling how the popover avoids viewport collisions on the side and alignment axes, e.g. { side: 'none', align: 'none' } to always honor side/align.