toasts/notifications
Using Ant Design and the built in useNotificationProvider from refine/antd, how can i make custom ontifications
2 Replies
Hi @PIGFY. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To create custom notifications using Ant Design and the built-in
useNotificationProvider
from @refinedev/antd
, you can follow these steps:
1. Import the necessary modules: You need to import Refine
from @refinedev/core
and useNotificationProvider
from @refinedev/antd
.
2. Set up the Refine
component: Pass the useNotificationProvider
to the notificationProvider
prop of the Refine
component.
3. Use the useNotification
hook: This hook allows you to open and close notifications programmatically.
Here is an example of how you can set this up in your App.tsx
and a sample component to trigger notifications:
App.tsx
HomePage.tsx
In this example:
- The App.tsx
file sets up the Refine
component with the useNotificationProvider
from @refinedev/antd
.
- The HomePage.tsx
file demonstrates how to use the useNotification
hook to open and close notifications.
For more details, you can refer to the Refine documentation on notifications (https://refine.dev/docs/ui-integrations/ant-design/introduction/#notifications) and the example of using the useNotification
hook (https://refine.dev/docs/guides-concepts/notifications/#built-in-notification-providers).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@368167875740958721> kapa.ai is still learning and improving, please let us know how it did by reacting below