Skip to content

Toast ​

Lightweight notification component for global feedback.

Basic Usage ​

Control visibility with v-model.

vue
<template>
  <ABtn @click="show = true">Show Toast</ABtn>
  <AToast v-model="show">This is a notification message</AToast>
</template>

<script setup lang="ts">
import { ref } from 'vue'
const show = ref(false)
</script>

Closable ​

Use the closable prop to show a close button.

vue
<template>
  <ABtn @click="show = true">Closable</ABtn>
  <AToast v-model="show" closable>Click the × to close</AToast>
</template>

Auto-Close ​

Set duration in milliseconds. 0 means it won't auto-close.

vue
<template>
  <ABtn @click="show = true">2s auto-close</ABtn>
  <AToast v-model="show" :duration="2000">Auto-disappears after 2s</AToast>
</template>

Combinations ​

Multiple props combined.

vue
<template>
  <ABtn @click="show = true">Show Toast</ABtn>
  <AToast v-model="show" :duration="5000" closable>
    Auto-closes after 5s, or click × to close manually
  </AToast>
</template>

API ​

Props ​

NameTypeDefaultDescription
modelValuebooleanfalseVisibility
durationnumber3000Auto-close delay (ms), 0 means persistent
closablebooleantrueShow close button

Events ​

NameParametersDescription
update:modelValuevalue: booleanVisibility changed
close—Triggered when closed

MIT License