To install, type the following into the command line at the root of your project:
npm i @brighthr/component-toast
Where you add the Toaster
component to the app will be the container that the toast messages will appear in.
Recommended that this should be at the root of your app so they appear in the bottom left corner.
import { Toaster } from '@brighthr/component-toast';
<div>
<Toaster />
</div>;
Import into your file:
import { useToast } from '@brighthr/component-toast';
const { createToast } = useToast();
<Button onClick={() => createToast({
text: 'message for toast',
type: 'information'
})}>