Toast
Provides a brief notification.
View source codeBasic usage
<Toast title="Your receipt has been uploaded" onClose={() => closeToast()} />
Variant
The Toast comes with two visual styles: success (default) and alert.
<>
<Toast
title="Your receipt has been uploaded"
variant="success"
onClose={() => closeToast()}
/>
<Toast
title="Your receipt has been uploaded"
variant="alert"
onClose={() => closeToast()}
/>
</>
Content
Use the children
prop to add any content to the Toast.
<Toast title="Your receipt has been uploaded" onClose={() => closeToast()}>
Description (optional)
</Toast>
Action
Use the action
prop to add a button (action) to your Toast. Only one action is supported.
<Toast
title="Your receipt has been uploaded"
onClose={() => closeToast()}
action={{
text: "Action",
onClick: () => {},
}}
/>
Sticky
Setting the canExpire
prop to false will make the Toast component stay on the page. No timer will be shown to be user.
<Toast
title="Your receipt has been uploaded"
onClose={() => closeToast()}
canExpire={false}
/>