npm install toastrr
import { Toaster } from 'toastrr';
export default function App() {
return (
<div>
<Toaster
position="top-right"
theme="light"
duration={3000}
closeButton={true}
/>
<MyComponent />
<MyComponent2 />
</div>
)
}
import { toast } from 'toastrr';
function showToast() {
toast.success('This is a success toast', {
theme: 'dark',
duration: 'infinite',
closeButton: true
});
}
Prop | Required | Type | Possible Values | Default |
---|---|---|---|---|
position | No | string | 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-right' |
theme | No | string | 'light' | 'dark' | 'light' |
duration | No | number | 'infinite' | any number (ms) or 'infinite' | 3000 |
closeButton | No | boolean | true | false | true |