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
@@ -406,23 +406,19 @@ Offset from the edges of the screen.
406
406
<Toasteroffset="80px" />
407
407
```
408
408
409
-
### Programmatically remove toast
410
-
411
-
To remove a toast programmatically use `toast.dismiss(id)`.
412
-
413
-
```ts
414
-
const toastId =toast('Event has been created')
415
-
416
-
toast.dismiss(toastId)
417
-
```
409
+
### On Close Callback
418
410
419
-
You can also use the dismiss method without the id to dismiss all toasts.
411
+
You can pass `onDismiss` and `onAutoClose` callbacks. `onDismiss` gets fired when either the close button gets clicked or the toast is swiped. `onAutoClose` fires when the toast disappears automatically after it's timeout (`duration` prop).
420
412
421
413
```ts
422
-
toast.dismiss()
414
+
toast('Event has been created', {
415
+
onDismiss: (t) =>console.log(`Toast with id ${t.id} has been dismissed`),
416
+
onAutoClose: (t) =>
417
+
console.log(`Toast with id ${t.id} has been closed automatically`)
418
+
})
423
419
```
424
420
425
-
### Programmatically remove toast
421
+
### Persisting toasts
426
422
427
423
You can change the duration of each toast by using the duration property, or change the duration of all toasts like this:
428
424
@@ -435,22 +431,28 @@ toast('Event has been created', {
You can pass `onDismiss` and `onAutoClose` callbacks. `onDismiss` gets fired when either the close button gets clicked or the toast is swiped. `onAutoClose` fires when the toast disappears automatically after it's timeout (`duration` prop).
444
+
To remove a toast programmatically use `toast.dismiss(id)`.
447
445
448
446
```ts
449
-
toast('Event has been created', {
450
-
onDismiss: (t) =>console.log(`Toast with id ${t.id} has been dismissed`),
451
-
onAutoClose: (t) =>
452
-
console.log(`Toast with id ${t.id} has been closed automatically`)
453
-
})
447
+
const toastId =toast('Event has been created')
448
+
449
+
toast.dismiss(toastId)
450
+
```
451
+
452
+
You can also dismiss all toasts at once by calling `toast.dismiss()` without an id.
0 commit comments