Notifications
Example showing how to:
- Toggle built-in toast notifications
- Customize toast position and duration
- Listen to
@notifyevents for external UI/logging
Live Demo
Code Example
vue
<template>
<div class="notify-example">
<vue-finder id="notify-demo" :driver="driver" :config="config" @notify="handleNotify" />
<div class="notify-example__bottom">
<section class="notify-example__card">
<h3 class="notify-example__title">Notification Settings</h3>
<label class="notify-example__field notify-example__field--inline">
<input v-model="notificationsEnabled" type="checkbox" />
Enable toasts
</label>
<label class="notify-example__field">
<span>Position</span>
<select v-model="notificationPosition" class="notify-example__input">
<option value="top-left">top-left</option>
<option value="top-center">top-center</option>
<option value="top-right">top-right</option>
<option value="bottom-left">bottom-left</option>
<option value="bottom-center">bottom-center</option>
<option value="bottom-right">bottom-right</option>
</select>
</label>
<label class="notify-example__field">
<span>Duration (ms)</span>
<input v-model.number="notificationDuration" class="notify-example__input" type="number" min="500" step="250" />
</label>
<button @click="clearNotifyEvents">Clear event log</button>
</section>
<section class="notify-example__card notify-example__card--log">
<h3 class="notify-example__title">@notify event log</h3>
<div v-if="notifyEvents.length === 0">No notifications yet.</div>
<div v-for="(entry, index) in notifyEvents" :key="`${entry.at}-${index}`">
<small>{{ entry.at }} · {{ entry.type }}</small>
<div>{{ entry.message }}</div>
</div>
</section>
</div>
</div>
</template>Notes
@notifyemits{ type, message }even whennotificationsEnabledisfalse.notificationsEnabledcontrols only toast rendering.- This is useful when you want to render notifications in your own custom UI.
See: