You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReactfrom'react'// POSITION is a helper variable that provides available position values to avoid typosimport{ReactNoti,notify,POSITION}from'react-noti'functionApp(){consthandleSuccessClick=()=>{notify.success('You can put almost anything here.')}consthandleInfoClick=()=>{notify.info('Info message',{title: 'Title here'})}consthandleWarningClick=()=>{notify.warning('Warning message',{title: 'Do not auto dismiss',autoDismiss: false,})}consthandleErrorClick=()=>{notify.error('Error message',{title: 'Close after 9000ms',timeOut: 9000,})}return(<divclassName="App"><ReactNotiposition={POSITION.TOP_RIGHT}/><div><buttononClick={handleSuccessClick}>Success!</button><buttononClick={handleInfoClick}>Info!</button><buttononClick={handleWarningClick}>Warning!</button><buttononClick={handleErrorClick}>Error!</button></div></div>)}exportdefaultApp
API
ReactNoti container
Props
Type
Default
Required
Description
position
string
top-right
✘
Defines location of the ReactNoti component on the screen. Available options: top-right, top-left, top-center, bottom-right, bottom-left, bottom-center.
autoDismiss
boolean
true
✘
Auto dismisses notification after the timeOut. Can be overridden individually.
timeOut
number
5000
✘
The default time in ms for the all toast notifications in the container tray. Can be overridden individually.
single
boolean
false
✘
Single notification mode. Show only the last notification.
icons
boolean
true
✘
Show default toast notifications icons or not.
pauseOnHover
boolean
true
✘
Pause auto-dismissing countdown on mouse hover. Can be overridden individually.
showProgress
boolean
true
✘
Show countdown progress-bar on toast notifications. Can be overridden individually.
className
string
undefined
✘
Adds a class to the ReactNoti container for custom styling.
notify toast options
Params
Type
Default
Required
Description
content
string | element
-
✓
A text string or a component containing the content of the Toast notification.
options
object
{}
✘
Options are listed bellow.
Optional notify methods parameters
Options
Type
Default
Description
title
string
undefined
Text string containing the title of the Toast notification.
autoDismiss
boolean
true
Auto dismiss notification after the timeOut. Overrides global ReactNoti autoDismiss.
timeOut
number
5000
Time in ms for individual Toast in the tray. Overrides global ReactNoti timeOut.
pauseOnHover
boolean
true
Pause auto-dismissing countdown on mouse hover. Overrides global ReactNoti pauseOnHover.
showProgress
boolean
false
Show countdown progress-bar on toast notifications. Overrides global ReactNoti showProgress.