@lidofinance/toast
v1.12.0
Published
React component for Lido Finance projects based on React-Toastify (https://github.com/fkhadra/react-toastify). Part of [Lido UI Components](https://github.com/lidofinance/ui/#readme)
Downloads
7,764
Readme
Toast Component
React component for Lido Finance projects based on React-Toastify (https://github.com/fkhadra/react-toastify). Part of Lido UI Components
Install
yarn add @lidofinance/toast
Usage
For example will use ToastDefault
, also you can use ToastError
, ToastSuccess
, ToastInfo
and other.
Also, you can use native React-Toastify functional, just import { toast } from '@lidofinance/toast'
(see example below), but be careful @lidofinance/toast
does not support full functionality of React-Toastify!!!
import { ToastContainer, ToastDefault, toast } from '@lidofinance/toast'
function ExampleToast() {
const notifyDefault = () => ToastDefault('🚀🚀🚀 Wow so easy!')
const dismissAll = () => toast.dismiss()
return (
<>
<button onClick={notifyDefault}>Show notify!</button>
<Button onClick={dismissAll} size='xs' variant='translucent'>
Dismiss all
</Button>
<ToastContainer />
</>
)
}
IMPORTANT:
Remember to render the ToastContainer once in your application tree. If you can not figure out where to put it, rendering it in the application root would be the best bet;
@lidofinance/toast
use own scss styles, seepackages/toast/src/ToastContainer.tsx
;@lidofinance/toast
does not support full functionality of React-Toastify!!!
Check out our Storybook at https://ui.lido.fi