Toast
Toast Props
Name
Type
Default
Description
Toast Slots
Name
Description
Examples
<template>
<i-page>
<i-navbar title="Toast" />
<i-block strong-ios outline-ios class="space-y-4">
<i-toast position="left" :opened="opened.left">
<template #button>
<i-button clear inline @click="() => (opened.left = false)">
Close
</i-button>
</template>
<div class="shrink">Hello this is left toast!</div>
</i-toast>
<i-toast position="center" :opened="opened.center">
<template #button>
<i-button clear inline @click="() => (opened.center = false)">
Close
</i-button>
</template>
<div class="shrink">Hello this is center toast!</div>
</i-toast>
<i-toast position="right" :opened="opened.right">
<template #button>
<i-button clear inline @click="() => (opened.right = false)">
Close
</i-button>
</template>
<div class="shrink">Hello this is right toast!</div>
</i-toast>
<p>
Toasts provide brief feedback about an operation through a message on
the screen.
</p>
<p>
<i-button @click="() => openToast('left')"> Toast on Left </i-button>
</p>
<p>
<i-button @click="() => openToast('center')">
Toast on Center
</i-button>
</p>
<p>
<i-button @click="() => openToast('right')"> Toast on Right </i-button>
</p>
</i-block>
</i-page>
</template>
<script>
import { ref } from 'vue';
import {
iPage,
iNavbar,
iNavbarBackLink,
iButton,
iToast,
iBlock,
} from 'ina-ui/vue';
export default {
components: {
iPage,
iNavbar,
iNavbarBackLink,
iButton,
iToast,
iBlock,
},
setup() {
const opened = ref({
left: false,
center: false,
right: false,
});
const openToast = (side) => {
// close other toast
opened.value = { left: false, center: false, right: false };
opened.value[side] = true;
};
return {
openToast,
opened,
};
},
};
</script>Last updated
