vt-notifications
A headless vue notification library to use with tailwind.
? Features
- 100% customizable
- Create different groups of notifications
- Built in transitions
⚡️ Installation
or
You can then register Notifications as a Vue plugin.
? How to use
Basic example
For example in your App.vue
Then in any of your vue files:
The first argument is an object containing the data for the notification
layout, it important to specify the group where the notificatoins are going to be displayed, the second argument is the timeout. The default timeout is 3 seconds.
Example with differents groups
You can use notificationGroup
component to have different types of notifcations. For example, notifcations error messages in top center and generic app notifications in bottom-right corner
Then in any of your vue files:
Using different types of notifcations
You can render different types of notifications in the same group using a conditional, for example v-if="notification.type==='info'"
Then in any of your vue files:
Props
Props for notification component, all are opcional.
Name | Type | Default | Description |
---|---|---|---|
maxNotifications | Number | 10 | Maximum notifications displayed simultaneously |
transitionGroupClasses | Object | {enterActiveClassDelayed:"transform ease-out duration-300 transition delay-300",enterActiveClass:"transform ease-out duration-300 transition",enterClass:"translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-4",enterToClass:"translate-y-0 opacity-100 sm:translate-x-0",leaveActiveClass:"transition ease-in duration-500",leaveClass:"opacity-100",leaveToClass: "opacity-0", moveClass: "transition duration-500 "} | Classes for the transition-group component |
Props for notification group component, all are opcional.
Name | Type | Description |
---|---|---|
position | String | "bottom" or "top are the posible values |
group | String | Name of the group of notifications |
Defualt scoped slot
Scope props:
Name | Type | Description |
---|---|---|
notifications | Array | Arrya of notification object |
close | Function | when called closes the notification. Expect the notification id as input |