Skip to content

Getting Started

Install

bash
npm install @notifi/vue

Headless by design

Notifi is headless and ships no styles. You can render plain text, or integrate any UI kit/component (e.g., your design system) as the notification content.

Mount

Use the NotifContainer component to render and manage notifications.

vue
<template>
  <NotifContainer />
</template>
<script setup lang="ts">
import { NotifContainer } from '@notifi/vue'
</script>

Show a notification

ts
import { notif } from '@notifi/vue'

const id = notif('Hello Notifi!', { duration: 2500 })

function closeNotification() {
  notif.dismiss(id)
}

function closeAllNotifications() {
  notif.dismiss()
}

API

ts
import { notif } from '@notifi/vue'

// Dismiss by id
notif.dismiss(id)

// Dismiss all
notif.dismiss()

// Get full history (including dismissed until cleaned)
const history = notif.getHistory()

// Get active notifications (not dismissed)
const active = notif.getNotifications()

Notification parameters (ExternalNotification)

nametypedefaultdescription
idstring | numberauto-generatedOptional custom id for the notification. Useful for targeted dismiss/update.
classstring-Extra class applied to the notification root.
styleCSSProperties-Inline styles; supports CSS variables like --notifi-*.
durationnumberlibrary defaultAuto close delay in ms. Use Infinity to disable auto close.
dismissiblebooleantrueWhether the notification can be dismissed via swipe/click.
noPauseOnHoverbooleanfalseIf true, hovering will not pause the auto-close timer.
onDismiss(notification) => void-Called when the notification is dismissed manually or by swipe.
onAutoClose(notification) => void-Called when the notification is closed by timer.
position'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end'container defaultPosition override per notification.
testIdstring-Testing id set on the notification element.
notificationContainerIdstring-Send notification to a specific NotifContainer instance with matching id.

NotifContainer props (NotificationContainerProps)

nametypedefaultdescription
idstring-Identifier to isolate notifications for this NotifContainer instance.
position'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end''bottom-end'Default position for notifications without an explicit position.
expandbooleanfalseExpand the stack on hover/interact.
gapnumber8Gap between stacked notifications (px).
widthnumber448Width of the notification list (px).
visibleNotificationsnumber5How many notifications are visible in the stack.
durationnumber-Default duration for notifications created while this container is mounted.
notificationOptionsNotificationOptions{}Default options applied to each created notification.
classstring``Extra class on the notification list (ol[data-notifi-notifer]).
rootClassstring``Extra class on the outer container section[data-notifi-container].
styleCSSProperties-Inline styles; can provide --notifi-* CSS variables per container.
ariaLabelstring"Notifications"Accessible label for the live region.
offset{ top?; end?; bottom?; start? } | string | number32 (px)Viewport offsets for desktop. Numbers are px; strings accept any CSS length.
mobileOffset{ top?; end?; bottom?; start? } | string | number16 (px)Viewport offsets for mobile (applied under 600px).
absolutebooleanfalsePosition container absolutely instead of fixed.
swipeDirectionsArray<'top' | 'right' | 'bottom' | 'left'>['left','right']Allowed swipe-to-dismiss directions.