useXDSPopover@xds/core · Popover

Usage

Headless hook for click-triggered popovers with focus trapping. Combines useXDSLayer with useFocusTrap for dialog-like popover behavior. Use for interactive floating content that needs keyboard navigation.

Best practices

GuidancePractices
DoUse for interactive content (forms, menus, pickers) that needs focus trapping and light dismiss.
DoPrefer the XDSPopover component for standard trigger-content pairs — use the hook for custom trigger patterns.
Don'tUse for non-interactive hover previews — use useXDSHoverCard or useXDSTooltip instead.

Parameters

ParamTypeDescription
contentrequired
ReactNode | ((props: ContextRenderProps) => ReactNode)Content to display in the popover. Can be a render function receiving layer props.
placement
LayerPlacement (default: 'below')Position relative to the trigger.
alignment
LayerAlignment (default: 'start')Alignment along the placement axis.
hasLightDismiss
boolean (default: true)Whether clicking outside dismisses the popover.
hasSurface
boolean (default: true)Whether to apply the default popover surface styles (background, shadow, radius).
onShow
() => voidCallback fired when the popover becomes visible.
onHide
() => voidCallback fired when the popover is hidden.

Returns

FieldTypeDescription
triggerPropsobjectProps to spread on the trigger element (ref, aria-expanded, event handlers).
layerNodeReactNodeThe popover layer to render (include in JSX output).
isOpenbooleanWhether the popover is currently visible.
show() => voidImperatively show the popover.
hide() => voidImperatively hide the popover.

Import

ts
import {useXDSPopover} from '@xds/core/Popover'