Vesyl UI

Popover

A floating panel anchored to a trigger and opened on click. Built on base-ui Popover — focus management, outside-press dismissal, and ARIA wiring come for free.

Reach for a Popover when the content is interactive (forms, toggles, a list of actions) and the user opens it deliberately. For passive, read-only preview content use HoverCard, which opens on hover; for a one-line hint on an element use Tooltip.

Compose three required parts: Popover (root, owns the open state), PopoverTrigger (the element that toggles it), and PopoverContent (the floating panel). The optional PopoverHeader, PopoverTitle, and PopoverDescription give the panel a labelled heading block and wire it to the panel for screen readers.

Basic

PopoverTrigger renders its own button by default, but most call sites hand it a Button (or any control) through the render prop so the trigger inherits our styles. PopoverContent portals to the end of the body and animates in from the trigger.

Positioning

PopoverContent accepts side (which edge of the trigger it anchors to) and align (how it lines up along that edge). sideOffset and alignOffset nudge it in pixels. Defaults are side="bottom", align="center", sideOffset={4} — the panel flips automatically when it would overflow the viewport.

Controlled

Popover is uncontrolled by default. To drive it yourself — e.g. to validate before opening, or to close it after a successful mutation — pass open and onOpenChange.

const [open, setOpen] = useState(false);

<Popover open={open} onOpenChange={setOpen}>
  <PopoverTrigger render={(props) => <Button {...props}>Edit parcel</Button>} />
  <PopoverContent>{/* … */}</PopoverContent>
</Popover>;

Reference

Popover

Root container; owns open state. Extends base-ui Popover.Root props.

PropTypeDefaultDescription
defaultOpenbooleanfalseInitial open state (uncontrolled)
openbooleanOpen state (controlled)
onOpenChange(open: boolean) => voidFires when the open state changes
modalbooleanfalseTrap focus and block interaction behind it

PopoverTrigger

The element that toggles the panel. Extends base-ui Popover.Trigger props.

PropTypeDefaultDescription
renderReactElement | (props) => ReactElementRender your own trigger; spread props onto it

PopoverContent

The floating panel. Extends base-ui Popover.Popup props plus the positioner props below.

PropTypeDefaultDescription
side"top" | "right" | "bottom" | "left""bottom"Which edge of the trigger the panel anchors to
align"start" | "center" | "end""center"How the panel lines up along that edge
sideOffsetnumber4Gap in pixels between the trigger and the panel
alignOffsetnumber0Shift in pixels along the alignment axis
classNamestringMerged onto the panel (default width is w-72)

PopoverHeader

Optional heading block — a flex column for the title and description. Renders a div; accepts standard div props.

PopoverTitle

The accessible heading for the panel. Extends base-ui Popover.Title props.

PopoverDescription

Supporting text below the title, wired to the panel as its accessible description. Extends base-ui Popover.Description props.