@@ -49,6 +49,9 @@ export default {
49
49
"top-center" ,
50
50
] ,
51
51
} ,
52
+ maxVisibleToasts : {
53
+ control : { type : "number" } ,
54
+ } ,
52
55
hideCloseButton : {
53
56
control : {
54
57
type : "boolean" ,
@@ -80,7 +83,7 @@ const defaultProps = {
80
83
const Template = ( args : ToastProps ) => {
81
84
return (
82
85
< >
83
- < ToastProvider placement = { args . placement } />
86
+ < ToastProvider maxVisibleToasts = { args . maxVisibleToasts } placement = { args . placement } />
84
87
< div >
85
88
< Button
86
89
onPress = { ( ) => {
@@ -100,7 +103,7 @@ const Template = (args: ToastProps) => {
100
103
const ShowTimeoutProgressTemplate = ( args : ToastProps ) => {
101
104
return (
102
105
< >
103
- < ToastProvider placement = { args . placement } />
106
+ < ToastProvider maxVisibleToasts = { args . maxVisibleToasts } placement = { args . placement } />
104
107
< Button
105
108
onPress = { ( ) => {
106
109
addToast ( {
@@ -121,7 +124,7 @@ const ShowTimeoutProgressTemplate = (args: ToastProps) => {
121
124
const WithEndContentTemplate = ( args ) => {
122
125
return (
123
126
< >
124
- < ToastProvider placement = { args . placement } />
127
+ < ToastProvider maxVisibleToasts = { args . maxVisibleToasts } placement = { args . placement } />
125
128
< Button
126
129
onPress = { ( ) => {
127
130
addToast ( {
@@ -147,7 +150,7 @@ const WithEndContentTemplate = (args) => {
147
150
const PlacementTemplate = ( args : ToastProps ) => {
148
151
return (
149
152
< >
150
- < ToastProvider placement = { args . placement } />
153
+ < ToastProvider maxVisibleToasts = { args . maxVisibleToasts } placement = { args . placement } />
151
154
< div >
152
155
< Button
153
156
onPress = { ( ) => {
@@ -168,7 +171,11 @@ const PlacementTemplate = (args: ToastProps) => {
168
171
const DisableAnimationTemplate = ( args : ToastProps ) => {
169
172
return (
170
173
< >
171
- < ToastProvider disableAnimation = { true } placement = { args . placement } />
174
+ < ToastProvider
175
+ disableAnimation = { true }
176
+ maxVisibleToasts = { args . maxVisibleToasts }
177
+ placement = { args . placement }
178
+ />
172
179
< div >
173
180
< Button
174
181
onPress = { ( ) => {
@@ -189,14 +196,16 @@ const DisableAnimationTemplate = (args: ToastProps) => {
189
196
const PromiseToastTemplate = ( args : ToastProps ) => {
190
197
return (
191
198
< >
192
- < ToastProvider placement = { args . placement } />
199
+ < ToastProvider maxVisibleToasts = { args . maxVisibleToasts } placement = { args . placement } />
193
200
< div >
194
201
< Button
195
202
onPress = { ( ) => {
196
203
addToast ( {
197
204
title : "Toast Title" ,
198
205
description : "Toast Displayed Successfully" ,
199
- promise : new Promise ( ( resolve ) => setTimeout ( resolve , 5000 ) ) ,
206
+ promise : new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ,
207
+ timeout : 3000 ,
208
+ shouldShowTimeoutProgess : false ,
200
209
...args ,
201
210
} ) ;
202
211
} }
@@ -265,7 +274,7 @@ const CustomToastTemplate = (args) => {
265
274
266
275
return (
267
276
< >
268
- < ToastProvider placement = { args . placement } />
277
+ < ToastProvider maxVisibleToasts = { args . maxVisibleToasts } placement = { args . placement } />
269
278
< div className = "flex gap-2" >
270
279
{ colors . map ( ( color , idx ) => (
271
280
< CustomToastComponent key = { idx } color = { color } />
@@ -279,6 +288,7 @@ const CustomCloseButtonTemplate = (args) => {
279
288
return (
280
289
< >
281
290
< ToastProvider
291
+ maxVisibleToasts = { args . maxVisibleToasts }
282
292
placement = { args . placement }
283
293
toastProps = { {
284
294
classNames : {
0 commit comments