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

Function ToastRegion

starters/hooks/src/Toast.tsx:32–50  ·  view source on GitHub ↗
({state, ...props}: AriaToastRegionProps & {state: ToastState<string>})

Source from the content-addressed store, hash-verified

30}
31
32function ToastRegion({state, ...props}: AriaToastRegionProps & {state: ToastState<string>}) {
33 let ref = useRef<HTMLDivElement>(null);
34 /*- begin highlight -*/
35 let {regionProps} = useToastRegion(props, state, ref);
36 /*- end highlight -*/
37 let {focusProps, isFocusVisible} = useFocusRing();
38
39 return (
40 <div
41 {...mergeProps(regionProps, focusProps)}
42 ref={ref}
43 className="react-aria-ToastRegion"
44 data-focus-visible={isFocusVisible || undefined}>
45 {state.visibleToasts.map(toast => (
46 <Toast key={toast.key} toast={toast} state={state} />
47 ))}
48 </div>
49 );
50}
51
52function Toast({state, toast, ...props}: AriaToastProps<string> & {state: ToastState<string>}) {
53 let ref = useRef<HTMLDivElement>(null);

Callers

nothing calls this directly

Calls 3

useToastRegionFunction · 0.90
useFocusRingFunction · 0.90
mergePropsFunction · 0.90

Tested by

no test coverage detected