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

Function ToastProvider

starters/hooks/src/Toast.tsx:21–30  ·  view source on GitHub ↗
({children}: ToastProviderProps)

Source from the content-addressed store, hash-verified

19}
20
21export function ToastProvider({children}: ToastProviderProps) {
22 let state = useToastState<string>({maxVisibleToasts: 5});
23
24 return (
25 <>
26 {children(state)}
27 {state.visibleToasts.length > 0 && <ToastRegion state={state} />}
28 </>
29 );
30}
31
32function ToastRegion({state, ...props}: AriaToastRegionProps & {state: ToastState<string>}) {
33 let ref = useRef<HTMLDivElement>(null);

Callers

nothing calls this directly

Calls 2

useToastStateFunction · 0.90
childrenFunction · 0.85

Tested by

no test coverage detected