feat(VAlert): add duration prop to auto-dismiss alerts#22947
Conversation
Add a `duration` prop that automatically dismisses the alert after the given time in milliseconds. A value of `0` (default) preserves the current behavior and never auto-dismisses. The timer restarts when the alert becomes visible or the duration changes, pauses while the alert is hovered or focused, and is cleared on manual close and on unmount — mirroring VSnackbar's timeout handling. resolves vuetifyjs#20409
7226b80 to
ddfea8d
Compare
|
On the prop name: I used |
|
On pausing: I copied the hover/focus handling from |
|
On reuse: I kept the timer inline rather than extracting a shared helper. |
|
On edge values: |
Description
Adds a
durationprop toVAlertthat automatically dismisses the alert after a given time in milliseconds. Currently developers have to wire up their ownsetTimeoutto hide an alert after a delay; this brings the behavior in line withVSnackbar'stimeout.durationaccepts a number (or numeric string) of milliseconds.0(default) keeps the current behavior and never auto-dismisses, so the change is fully backwards compatible.durationchanges, and is cleared on manual close and on unmount — mirroringVSnackbar's timeout handling.A unit test covers both auto-dismiss and the
duration="0"(persistent) case, and the API description has been added.resolves #20409
Markup: