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

Function Modal

starters/hooks/src/Modal.tsx:39–52  ·  view source on GitHub ↗
({state, children, ...props}: ModalProps)

Source from the content-addressed store, hash-verified

37}
38
39export function Modal({state, children, ...props}: ModalProps) {
40 let ref = useRef<HTMLDivElement>(null);
41 let {modalProps, underlayProps} = useModalOverlay(props, state, ref);
42
43 return (
44 <Overlay>
45 <div {...underlayProps} className="react-aria-ModalOverlay">
46 <div {...modalProps} ref={ref} className="react-aria-Modal">
47 <OverlayStateContext.Provider value={state}>{children}</OverlayStateContext.Provider>
48 </div>
49 </div>
50 </Overlay>
51 );
52}
53
54export function ModalTrigger({label, children, ...props}: ModalTriggerProps) {
55 let state = useOverlayTriggerState(props);

Callers

nothing calls this directly

Calls 1

useModalOverlayFunction · 0.90

Tested by

no test coverage detected