Snackbar

The snackbar component is used to give feedback after certain actions.

Props#

useSnackbar#

PropTypeDefaultDescription
actiontype ONLY_FOR_FORMAT = | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | PromiseLikeOfReactNode
containerStyleStylePropsOptional style overrides for the container wrapping the toast component.
descriptiontype ONLY_FOR_FORMAT = | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | PromiseLikeOfReactNodeThe description of the toast
durationnumber5000 ( = 5000ms )The delay before the toast hides (in milliseconds) If set to null, toast will never dismiss.
icontype ONLY_FOR_FORMAT = | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | PromiseLikeOfReactNodeA custom icon that will be displayed by the toast.
idToastIdThe id of the toast. Mostly used when you need to prevent duplicate. By default, we generate a unique id for each toast
isClosablebooleanfalseIf true, toast will show a close button
onCloseComplete() => voidCallback function to run side effects after the toast has closed.
positionToastPositionbottomThe placement of the toast
render(props: RenderProps) => ReactNodeRender a component toast component. Any component passed will receive 2 props: id and onClose.
status"info" | "warning" | "success" | "error" | "loading"The status of the toast.
titletype ONLY_FOR_FORMAT = | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | PromiseLikeOfReactNodeThe title of the toast
variantstring

Was this helpful?