Instructions
Learn how to use @raytolfas/toastify to display toast notifications.
Pure JavaScript
Use the toast function to show a notification:
RaytolfasToastify.toast({
message: 'Welcome to Raytolfas!',
type: 'success',
duration: 3000,
position: 'top-right',
theme: 'light',
});
React
Use the useToast hook:
import useToast from '@raytolfas/toastify';
import '@raytolfas/toastify/toastify.css';
function Component() {
const toast = useToast();
const showToast = () => {
toast({
message: 'Welcome to Raytolfas!',
type: 'success',
duration: 3000,
position: 'top-right',
theme: 'light',
});
};
return <button onClick={showToast}>Show Toast</button>;
}
export default Component;
Explore Settings to customize toasts.