Officina UI
Components

Popover

Click-triggered floating panel anchored to a trigger, with smart positioning and dismiss.

Popover opens a floating panel when its trigger is clicked, positioned next to the trigger with auto-flip and collision handling. Use it for menus, filters, and small contextual forms. It is portaled and dismisses on Escape or outside click. Works uncontrolled (defaultOpen) or controlled (open/onOpenChange); set modal to trap focus and switch to role="dialog". Pass a function as children to receive a close callback.

Example

Preview
import { Popover } from '@officina/ui';

<Popover trigger={<button>Options</button>} side="bottom" align="end">
  {({ close }) => (
    <div className="p-2">
      <button onClick={close}>Rename</button>
      <button onClick={close}>Delete</button>
    </div>
  )}
</Popover>;

API

PropTypeDefaultDescription
children*ReactNode | ((api: { close: () => void; }) => ReactNode)—Panel content, or a render function receiving a `close` callback.
trigger*ReactElement<unknown, string | JSXElementConstructor<any>>—Element that toggles the popover; receives the trigger props.
alignenumstartAlignment along the chosen side.
defaultOpenbooleanfalseInitial open state when uncontrolled.
modalbooleanfalseTrap focus and block outside interaction while open.
onOpenChange(open: boolean) => void—Called when the open state changes.
openboolean—Controlled open state.
sideenumbottomPreferred side of the trigger to position against.
sideOffsetnumber8Gap in pixels between trigger and panel.

On this page