Skip to content
Pixelbits
Docs / Popover
Overlays

Popover

A small non-modal panel attached to a trigger, for extra details or quick actions. It sits in the top layer (never clipped) and closes on outside click, Escape, or the trigger. Focus stays where the user put it; use Dialog when the panel must be dealt with first.

Installation

npm: import
import { Popover } from "pixelbits/popover";
shadcn: copy the source
npx shadcn add https://pixelbits.ali-moradi-develop.com/r/popover.json

API

<Popover>

A small non-modal panel attached to a trigger, for extra details or quick actions. It sits in the top layer (never clipped) and closes on outside click, Escape, or the trigger. Focus stays where the user put it; use Dialog when the panel must be dealt with first.

Example
<Popover trigger={<Button>Share</Button>} title="Share link">
  <Input readOnly value={url} />
</Popover>
PropTypeDefaultDescription
trigger*ReactElement—

The element that toggles the popover, usually a Button.

openboolean—

Whether it is open (controlled).

defaultOpenbooleanfalse

Open on first render (uncontrolled).

onOpenChange(open: boolean) => void—

Called when it opens or closes.

titleReactNode—

Optional heading; it also names the popover for screen readers.

align"start" | "center" | "end""start"

Horizontal alignment with the trigger.

children*ReactNode—

The content: text, a form, a share box…

Also accepts every prop of Omit<HTMLAttributes<HTMLDivElement>, "title">.