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

Function Toast

starters/hooks/src/Toast.tsx:52–79  ·  view source on GitHub ↗
({state, toast, ...props}: AriaToastProps<string> & {state: ToastState<string>})

Source from the content-addressed store, hash-verified

50}
51
52function Toast({state, toast, ...props}: AriaToastProps<string> & {state: ToastState<string>}) {
53 let ref = useRef<HTMLDivElement>(null);
54 /*- begin highlight -*/
55 let {toastProps, contentProps, titleProps, closeButtonProps} = useToast(
56 {...props, toast},
57 state,
58 ref
59 );
60 /*- end highlight -*/
61 let {focusProps, isFocusVisible} = useFocusRing();
62
63 return (
64 <div
65 {...mergeProps(toastProps, focusProps)}
66 ref={ref}
67 className="react-aria-Toast"
68 data-focus-visible={isFocusVisible || undefined}>
69 <div {...contentProps} className="react-aria-ToastContent">
70 <div {...titleProps} slot="title">
71 {toast.content}
72 </div>
73 </div>
74 <Button {...closeButtonProps} slot="close" variant="quiet" aria-label="Close">
75 <X size={16} />
76 </Button>
77 </div>
78 );
79}
80
81export {Button};

Callers

nothing calls this directly

Calls 3

useToastFunction · 0.90
useFocusRingFunction · 0.90
mergePropsFunction · 0.90

Tested by

no test coverage detected