
Floating popover with auto-positioning and focus management.
pnpm dlx edbn-ui@latest add popoverCreate a file and paste the following code into it.
Groups all parts of the popover. Doesn't render its own HTML element.
defaultOpenbooleanfalseInitial open state
openbooleanControlled open state
onOpenChange(open: boolean, details) => voidCalled when state changes
onOpenChangeComplete(open: boolean) => voidCalled after animation completes
actionsRefRefObject<Popover.Root.Actions | null>Imperative close and unmount actions
modalboolean | 'trap-focus'falseLimit outside interaction or trap focus when open
handlePopover.Handle<Payload>Handle for detached triggers
defaultTriggerIdstring | nullInitial associated trigger id
triggerIdstring | nullControlled associated trigger id
childrenReactNode | PayloadChildRenderFunction<Payload>Popover content or payload-aware render child
A button that opens the popover. Renders a button element.
handlePopover.Handle<Payload>Associates this trigger with a detached root
payloadPayloadPayload passed to a render-child root
idstringElement and active trigger id
openOnHoverbooleanfalseOpen on hover as well as press/focus
delaynumber300Delay before hover open in milliseconds
closeDelaynumber0Delay before closing a hover-opened popover
nativeButtonbooleantrueRender as native button
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-popup-open | Present when popover is open |
| data-pressed | Present when the trigger is pressed |
Moves the popup to a different part of the DOM. Renders a div element.
containerHTMLElement | ShadowRoot | RefObject | nullPortal container
keepMountedbooleanfalseKeep in DOM when closed
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
An overlay displayed beneath the popover. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popover is open |
| data-closed | Present when popover is closed |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
Positions the popup against the trigger. Renders a div element.
sideSide'bottom'Side relative to anchor
sideOffsetnumber0Distance from anchor
alignOffsetnumber | OffsetFunction0Offset along the alignment axis
arrowPaddingnumber5Minimum arrow distance from popup edges
anchorElement | VirtualElement | RefObject | function | nullCustom positioning anchor
collisionAvoidanceCollisionAvoidanceFlip, shift, or disable collision handling
collisionBoundaryBoundary'clipping-ancestors'Boundary used for collision detection
collisionPaddingPadding5Space from the collision boundary
stickybooleanfalseKeep visible after the anchor scrolls away
positionMethod'absolute' | 'fixed''absolute'CSS positioning strategy
align'start' | 'center' | 'end''center'Alignment relative to side
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popup is open |
| data-closed | Present when popup is closed |
| data-anchor-hidden | Present when the anchor is hidden |
| data-side | Side popup is positioned on |
| data-align | Alignment relative to side |
| Variable | Description |
|---|---|
| --anchor-height | Anchor height |
| --anchor-width | Anchor width |
| --available-height | Available height between anchor and viewport edge |
| --available-width | Available width between anchor and viewport edge |
| --positioner-height | Current positioner height for size animations |
| --positioner-width | Current positioner width for size animations |
| --transform-origin | Transform origin for anchored animations |
A container for the popover contents. Renders a div element.
initialFocusboolean | RefObject<HTMLElement> | functionElement to focus on open
finalFocusboolean | RefObject<HTMLElement> | functionElement to focus on close
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popover is open |
| data-closed | Present when popover is closed |
| data-align | Alignment relative to side |
| data-instant | Present when animations should be skipped |
| data-side | Side popup is positioned on |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
| Variable | Description |
|---|---|
| --popup-height | Current popup height |
| --popup-width | Current popup width |
Displays an arrow element positioned against the anchor. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popover is open |
| data-closed | Present when popover is closed |
| data-uncentered | Present when the arrow cannot be centered |
| data-align | Alignment relative to side |
| data-side | Side popup is positioned on |
An accessible title for the popover. Renders an h2 element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
An accessible description for the popover. Renders a p element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
A button that closes the popover. Renders a button element.
nativeButtonbooleantrueRender as native button
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
EDBN styled corner close button built on Popover.Close with an icon and accessible label.
aria-labelstring'Close popover'Accessible label for the icon button
nativeButtonbooleantrueRender as native button
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
A viewport for animating content transitions between trigger payloads. Renders a div element.
childrenReactNodeContent to render inside the transition container
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-activation-direction | Direction from the previous trigger to the new trigger |
| data-current | Applied to the current content container |
| data-instant | Present when animations should be skipped |
| data-previous | Applied to the exiting content container |
| data-transitioning | Present while content is transitioning |
| Variable | Description |
|---|---|
| --popup-height | Parent popup height for transition containers |
| --popup-width | Parent popup width for transition containers |
Base UI handle utility for detached triggers and imperative popover control.
isOpenbooleanreadonlyWhether the associated popover is open
open(triggerId: string) => voidmethodOpen and associate the popover with a trigger id
close() => voidmethodClose the associated popover
Function exported as createPopoverHandle for creating typed detached-trigger handles.
returnPopover.Handle<Payload>A new imperative popover handle