Popover

A click-triggered, non-modal floating panel anchored to its trigger. Focus moves in on open but is never trapped; Escape and outside clicks close it.

Installation

npx dafink-ui add popover

Demo

Props

NameTypeDefaultDescription
triggerReactNode-Content of the built-in trigger button.
childrenReactNode-Panel content. May contain interactive elements.
side'top' | 'right' | 'bottom' | 'left''bottom'Which side of the trigger the panel appears on.
align'start' | 'center' | 'end''center'Alignment along the chosen side.
labelstringundefinedAccessible name for the panel (aria-label).
onOpenChange(open: boolean) => voidundefinedCalled whenever the popover opens or closes.
disabledbooleanfalseDisables the trigger.
classNamestring''Additional classes on the panel.
triggerClassNamestring''Additional classes on the trigger button.

Accessibility

Popover is a non-modal floating panel (role="dialog", no aria-modal) with no focus trap. On open, focus moves to the first focusable element inside the panel (or the panel itself if empty). Tab is never intercepted: it walks through the panel's own content, and once focus leaves the panel entirely (Tab, Shift+Tab, or an outside click) a blur/pointerdown handler closes it without pulling focus back. Escape is the one path that both closes it and returns focus to the trigger.

KeyFunction
escapeCloses the popover and returns focus to the trigger.
tabMoves through the panel's focusable content; once focus leaves the panel it closes without stealing focus back.
shift+tabSame as Tab, in reverse.
enterToggles the popover from the trigger button (native activation).