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

Function Toast

packages/react-aria/stories/toast/Example.tsx:57–74  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

55}
56
57function Toast(props) {
58 let state = useContext(ToastContext)!;
59 let ref = useRef(null);
60 let {toastProps, contentProps, titleProps, closeButtonProps} = useToast(props, state, ref);
61 let buttonRef = useRef(null);
62 let {buttonProps} = useButton(closeButtonProps, buttonRef);
63
64 return (
65 <div {...toastProps} ref={ref} style={{margin: 20, display: 'flex', gap: 5}}>
66 <div {...contentProps}>
67 <div {...titleProps}>{props.toast.content}</div>
68 </div>
69 <button {...buttonProps} ref={buttonRef}>
70 x
71 </button>
72 </div>
73 );
74}

Callers

nothing calls this directly

Calls 2

useToastFunction · 0.90
useButtonFunction · 0.90

Tested by

no test coverage detected