Skip to content

Commit 2143c0e

Browse files
committed
docs(VAlert): add timeout prop example
Document the new `timeout` prop on the alerts page with a runnable example, mirroring the existing `VSnackbar` timeout example.
1 parent d36cc92 commit 2143c0e

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<div>
3+
<v-alert
4+
v-model="alert"
5+
:timeout="3000"
6+
title="Auto-dismiss Alert"
7+
type="success"
8+
variant="tonal"
9+
closable
10+
>
11+
This alert dismisses itself 3 seconds after it appears. The countdown pauses while you hover or focus it.
12+
</v-alert>
13+
14+
<div
15+
v-if="!alert"
16+
class="text-center"
17+
>
18+
<v-btn @click="alert = true">
19+
Reset
20+
</v-btn>
21+
</div>
22+
</div>
23+
</template>
24+
25+
<script setup>
26+
import { ref } from 'vue'
27+
28+
const alert = ref(true)
29+
</script>
30+
31+
<script>
32+
export default {
33+
data: () => ({
34+
alert: true,
35+
}),
36+
}
37+
</script>

packages/docs/src/pages/en/components/alerts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ The close icon automatically applies a default `aria-label` and is configurable
137137
For more information on how to global modify your locale settings, navigate to the [Internationalization page](/features/internationalization).
138138
:::
139139

140+
#### Timeout
141+
142+
The **timeout** property automatically dismisses the alert after the specified time in milliseconds. A value of `0` (the default) keeps the alert visible. The countdown pauses while the alert is hovered or focused, so it stays visible while being read or interacted with.
143+
144+
<ExamplesExample file="v-alert/prop-timeout" />
145+
140146
## Additional Examples
141147

142148
The following is a collection of `v-alert` examples that demonstrate how different the properties work in an application.

0 commit comments

Comments
 (0)