From ec352321f8ec6684a723e5dff60ef922930e1cb8 Mon Sep 17 00:00:00 2001 From: Jovan Ceprkovic Date: Thu, 8 Dec 2022 15:48:18 +0100 Subject: [PATCH 1/2] Added example for changing icons globally. --- docs/icons.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/icons.md b/docs/icons.md index be89acc..10079d5 100644 --- a/docs/icons.md +++ b/docs/icons.md @@ -59,5 +59,17 @@ toast.success("Even a function, given you return something that can be rendered" }); ``` +You can provide global custom icons through `ToastContainer`. + +```tsx +import { Icons, ToastContainer } from 'react-toastify'; + + { + if(type === 'success') return ; // return custom icon for success type + if(type === 'error') return Icons.error({theme, type}); // return default toastify icon for error type + return // return default icon or return false for no icon +}}/> +``` + :::info If you provide a component, the current `theme` and `type` are passed as props -::: \ No newline at end of file +::: From 31aa995f1b3262405756aebb6baef19822cd21de Mon Sep 17 00:00:00 2001 From: Jovan Ceprkovic Date: Thu, 8 Dec 2022 15:57:57 +0100 Subject: [PATCH 2/2] Global custom icons typo --- docs/icons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/icons.md b/docs/icons.md index 10079d5..dee0d71 100644 --- a/docs/icons.md +++ b/docs/icons.md @@ -67,7 +67,7 @@ import { Icons, ToastContainer } from 'react-toastify'; { if(type === 'success') return ; // return custom icon for success type if(type === 'error') return Icons.error({theme, type}); // return default toastify icon for error type - return // return default icon or return false for no icon + return ; // return default icon or return false for no icon }}/> ```