pretty-toast
v1.1.0
Published
A customizable toast notification package for React and Next.js with a clean, modern design.
Downloads
6
Maintainers
Readme
pretty-toast
pretty-toast
is a customizable toast notification package for React and Next.js, providing clean and elegant notifications.
Installation
Install via npm:
npm install pretty-toast
Usage
Here's a basic example of how to use pretty-toast
in your React or Next.js project:
import React from 'react';
import { useToast } from 'pretty-toast';
const Home: React.FC = () => {
const { showToast, ToastContainer } = useToast();
const handleClick = () => {
showToast({
type: 'success',
title: 'Success!',
message: 'Your message has been sent successfully.',
duration: 5000,
});
};
return (
<div>
<h1>Test pretty-Toast</h1>
<button onClick={handleClick}>Show Toast</button>
<ToastContainer />
</div>
);
};
export default Home;
Features
- Customizable: Easily customize the type, duration, and content of the toast notifications.
- Responsive: Works well across different screen sizes.
- Elegant Design: Clean and beautiful notifications to enhance user experience.
Props
type
: The type of notification (e.g.,success
,error
,warning
,info
).title
: The title of the toast notification.message
: The content message of the toast notification.duration
: How long the toast should be displayed (in milliseconds).
License
MIT License. See LICENSE for more details.