<Toaster />
API
This component will render all received toasts. Alternatively you can create own renderer with the headless useToaster()
hook.
position
Prop
You can change the position of all toasts by modifieng supplying positon
prop.
Positions | ||
---|---|---|
top-left | top-center | top-right |
bottom-left | bottom-center | bottom-right |
reverseOrder
Prop
Toasts spawn at top by default. Set to true
if you want new Toasts at the end.
toastOptions
Prop
These will act as default options for all toasts.
Type specific options
You can change the defaults for a specific type by adding, success: {}
, error: {}
or loading: {}
.
Example with all available options
<Toasterposition="top-center"reverseOrder={false}toastOptions={{// Define default optionsclassName: '',style: {margin: '40px',background: '#363636',color: '#fff',zIndex: 1,},duration: 5000,// Default options for specific typessuccess: {duration: 3000,theme: {primary: 'green',secondary: 'black',},},}}/>