MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Popover

Function Popover

starters/hooks/src/Popover.tsx:28–49  ·  view source on GitHub ↗
({state, children, triggerRef, ...props}: PopoverProps)

Source from the content-addressed store, hash-verified

26};
27
28export function Popover({state, children, triggerRef, ...props}: PopoverProps) {
29 let popoverRef = useRef<HTMLDivElement>(null);
30 let {popoverProps, underlayProps, placement} = usePopover(
31 {...props, triggerRef, popoverRef},
32 state
33 );
34
35 return (
36 <Overlay>
37 <div {...underlayProps} style={{position: 'fixed', inset: 0}} />
38 <div
39 {...popoverProps}
40 ref={popoverRef}
41 className="react-aria-Popover"
42 data-placement={placement}>
43 <DismissButton onDismiss={state.close} />
44 {children}
45 <DismissButton onDismiss={state.close} />
46 </div>
47 </Overlay>
48 );
49}
50
51export function PopoverTrigger({label, children, ...props}: PopoverTriggerProps) {
52 let triggerRef = useRef<HTMLButtonElement>(null);

Callers

nothing calls this directly

Calls 1

usePopoverFunction · 0.90

Tested by

no test coverage detected