@@ -10,6 +10,7 @@ export default function Page() {
1010 const [ ToastContainerConfig , setToastContainerConfig ] = useState ( {
1111 autoClose : 5000 ,
1212 closeButton : true ,
13+ pauseOnHover : true ,
1314 } ) ;
1415 const [ copy , setCopy ] = useState < boolean > ( false ) ;
1516 const messages = {
@@ -78,6 +79,10 @@ export default function Page() {
7879 </ a > { ' ' }
7980 library, designed to display customizable notification messages.
8081 </ p >
82+ < p className = "max-w-xl text-center text-sm text-slate-500" >
83+ Auto-closing toasts pause while hovered by default. Toggle it below to compare
84+ the behavior.
85+ </ p >
8186
8287 < h3 className = "mt-8 text-2xl font-bold" > Toast Configuration</ h3 >
8388
@@ -114,6 +119,23 @@ export default function Page() {
114119 < option value = "false" > False</ option >
115120 </ select >
116121 </ div >
122+ < div className = 'flex flex-col gap-2' >
123+ < label htmlFor = "pauseOnHover" > Pause On Hover</ label >
124+ < select
125+ id = "pauseOnHover"
126+ value = { ToastContainerConfig . pauseOnHover ? 'true' : 'false' }
127+ onChange = { ( e ) =>
128+ setToastContainerConfig ( {
129+ ...ToastContainerConfig ,
130+ pauseOnHover : e . target . value === 'true' ,
131+ } )
132+ }
133+ className = 'border border-gray-200 rounded-md px-2 py-1'
134+ >
135+ < option value = "true" > True</ option >
136+ < option value = "false" > False</ option >
137+ </ select >
138+ </ div >
117139 </ div >
118140
119141 < div className = "flex flex-wrap items-center justify-center gap-4" >
@@ -147,6 +169,12 @@ export default function Page() {
147169 >
148170 Promise (Loader)
149171 </ button >
172+ < button
173+ onClick = { ( ) => toast ( 'Hover this toast to pause the timer' , { duration : 5000 } ) }
174+ className = "rounded-md border border-gray-200 bg-gray-50 px-5 py-2 text-sm hover:bg-gray-200/80 active:scale-95 transition-all duration-300 font-medium text-gray-600"
175+ >
176+ Hover Pause Demo
177+ </ button >
150178 < button
151179 onClick = { ( ) => toast . error ( "Critical server error! Please review." , {
152180 autoClose : false
0 commit comments